How to create drawing brush and draw a colored block in windows
http://msdn.microsoft.com/en-us/library/windows/desktop/dd756651(v=vs.85).aspx
m_hWndTarget->Clear(D2D1::ColorF(D2D1::ColorF::Black));
m_hWndTarget->DrawBitmap(m_bitmap,
rectangle);
//this
function needs to be called between BegeinDraw() and EndDraw()
if (1)
{
ID2D1SolidColorBrush* m_pSolidColorBrush;
m_hWndTarget->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::Purple, 1.0f),
&m_pSolidColorBrush
);
D2D1_SIZE_F rtSize =
m_hWndTarget->GetSize();
// Draw a grid background.
int width = static_cast<int>(rtSize.width);
int height = static_cast<int>(rtSize.height);
// Draw two rectangles.
D2D1_RECT_F rectangle1 =
D2D1::RectF(
rtSize.width / 2 - 50.0f,
rtSize.height / 2 - 50.0f,
rtSize.width / 2 + 50.0f,
rtSize.height / 2 + 50.0f
);
m_hWndTarget->FillRectangle(&rectangle1,
m_pSolidColorBrush);
}
HRESULT hr =
m_hWndTarget->EndDraw();

0 Comments:
Post a Comment
<< Home