前田稔(Maeda Minoru)の超初心者のプログラム入門
Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_bitmapPerspective; void Main::CreateDeviceResources() { DirectXBase::CreateDeviceResources(); m_bitmapPerspective = LoadBitmapFile(m_d2dContext, m_wicFactory, L"ayu.jpg"); //m_bitmapPerspective = LoadBitmapFile(m_d2dContext, m_wicFactory, L"girl.gif"); } |
void Main::Render() { m_d2dContext->BeginDraw(); m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::CornflowerBlue)); m_d2dContext->DrawBitmap(m_bitmapPerspective.Get()); D2D1_RECT_F dest = D2D1::RectF(0, 0, 280, 170.0f); D2D1::Matrix4x4F matrix = D2D1::Matrix4x4F::RotationZ(90) * D2D1::Matrix4x4F::Translation(300, 300, 0); m_d2dContext->DrawBitmap( m_bitmapPerspective.Get(), &dest, 1.0f, D2D1_INTERPOLATION_MODE_LINEAR, nullptr, // Use the full source bitmap for sampling. &matrix ); D2D1::Matrix4x4F matrix2 = D2D1::Matrix4x4F::RotationZ(200) * D2D1::Matrix4x4F::Translation(800, 600, 0); m_d2dContext->DrawBitmap( m_bitmapPerspective.Get(), &dest, 1.0f, D2D1_INTERPOLATION_MODE_LINEAR, nullptr, &matrix2 ); HRESULT hr = m_d2dContext->EndDraw(); if (hr != D2DERR_RECREATE_TARGET) { DX::ThrowIfFailed(hr); } Present(); } |
void Main::CreateDeviceResources() { DirectXBase::CreateDeviceResources(); //m_bitmapPerspective = LoadBitmapFile(m_d2dContext, m_wicFactory, L"ayu.jpg"); m_bitmapPerspective = LoadBitmapFile(m_d2dContext, m_wicFactory, L"girl.gif"); } |
void Main::Render() { m_d2dContext->BeginDraw(); m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::CornflowerBlue)); m_d2dContext->DrawBitmap(m_bitmapPerspective.Get()); D2D1_RECT_F destRect = D2D1::RectF(100.0f, 300.0f, 228.0f, 516.0f); D2D1_RECT_F souRect = D2D1::RectF(0.0f, 0.0f, 128.0f, 216.0f); m_d2dContext->DrawBitmap( m_bitmapPerspective.Get(), &destRect, 1.0f, D2D1_INTERPOLATION_MODE_LINEAR, &souRect ); D2D1_RECT_F destRect2 = D2D1::RectF(300.0f, 300.0f, 428.0f, 516.0f); D2D1_RECT_F souRect2 = D2D1::RectF(128.0f, 0.0f, 256.0f, 216.0f); m_d2dContext->DrawBitmap( m_bitmapPerspective.Get(), &destRect2, 1.0f, D2D1_INTERPOLATION_MODE_LINEAR, &souRect2 ); D2D1_RECT_F destRect3 = D2D1::RectF(500.0f, 300.0f, 628.0f, 600.0f); D2D1_RECT_F souRect3 = D2D1::RectF(256.0f, 0.0f, 384.0f, 216.0f); m_d2dContext->DrawBitmap( m_bitmapPerspective.Get(), &destRect3, 1.0f, D2D1_INTERPOLATION_MODE_LINEAR, &souRect3 ); HRESULT hr = m_d2dContext->EndDraw(); if (hr != D2DERR_RECREATE_TARGET) { DX::ThrowIfFailed(hr); } Present(); } |