1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
void DrawGDIStretch3(HDC& p_hdc)
{
Matrix transMatrix, rotmatrix;
HDC hCompatible;
HBITMAP hBitmapSource;
//gdi bitmap
hCompatible = CreateCompatibleDC(p_hdc);
hBitmapSource = CreateCompatibleBitmap(hCompatible, GetDeviceCaps(p_hdc, HORZRES), GetDeviceCaps(p_hdc, VERTRES));
Bitmap* pBitmap = new Bitmap(L"error.png");
Status stat = pBitmap->GetHBITMAP(Color(255, 255, 255), &hBitmapSource);
SelectObject(hCompatible, hBitmapSource);
//the graphics object
Graphics graphics(hCompatible);
//matrix
//transMatrix.Reset();
//transMatrix.Translate(50.f, 50.f);
//graphics.SetTransform(&transMatrix);
rotmatrix.Reset();
rotmatrix.Rotate(45.f);
graphics.SetTransform(&rotmatrix);
CachedBitmap cbBitmap(pBitmap, &graphics);
graphics.DrawCachedBitmap(&cbBitmap, 0, 0);
BitBlt(p_hdc, 0, 0, GetDeviceCaps(p_hdc, HORZRES), GetDeviceCaps(p_hdc, VERTRES), hCompatible, 0, 0, SRCCOPY); //bring to screen
DeleteObject(hBitmapSource);
DeleteDC(hCompatible);
}
|