UpdateWindow(hwnd);
}
+static HBRUSH CreateCheckerBoardBrush(HDC hdc)
+{
+ static const CHAR pattern[] =
+ "\x28\x00\x00\x00\x10\x00\x00\x00\x10\x00\x00\x00\x01\x00\x04\x00\x00\x00"
+ "\x00\x00\x80\x00\x00\x00\x23\x2E\x00\x00\x23\x2E\x00\x00\x10\x00\x00\x00"
+ "\x00\x00\x00\x00\x99\x99\x99\x00\xCC\xCC\xCC\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11"
+ "\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00"
+ "\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00"
+ "\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11"
+ "\x11\x11\x00\x00\x00\x00\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00"
+ "\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11"
+ "\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11"
+ "\x00\x00\x00\x00\x11\x11\x11\x11\x00\x00\x00\x00\x11\x11\x11\x11";
+
+ return CreateDIBPatternBrushPt(pattern, DIB_RGB_COLORS);
+}
+
static VOID
ImageView_DrawImage(HWND hwnd)
{
HDC hdc;
HBRUSH white;
HGDIOBJ hbrOld;
+ UINT uFlags;
hdc = BeginPaint(hwnd, &ps);
if (!hdc)
GdipSetSmoothingMode(graphics, SmoothingModeHighQuality);
}
- hbrOld = SelectObject(hdc, GetStockObject(NULL_BRUSH));
- Rectangle(hdc, x - 1, y - 1, x + ZoomedWidth + 1, y + ZoomedHeight + 1);
- SelectObject(hdc, hbrOld);
+ uFlags = 0;
+ GdipGetImageFlags(image, &uFlags);
+
+ if (uFlags & (ImageFlagsHasAlpha | ImageFlagsHasTranslucent))
+ {
+ HBRUSH hbr = CreateCheckerBoardBrush(hdc);
+ hbrOld = SelectObject(hdc, hbr);
+ Rectangle(hdc, x - 1, y - 1, x + ZoomedWidth + 1, y + ZoomedHeight + 1);
+ SelectObject(hdc, hbrOld);
+ DeleteObject(hbr);
+ }
+ else
+ {
+ hbrOld = SelectObject(hdc, GetStockObject(NULL_BRUSH));
+ Rectangle(hdc, x - 1, y - 1, x + ZoomedWidth + 1, y + ZoomedHeight + 1);
+ SelectObject(hdc, hbrOld);
+ }
+
GdipDrawImageRectI(graphics, image, x, y, ZoomedWidth, ZoomedHeight);
}
GdipDeleteGraphics(graphics);