+bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest,
+ wxCoord width, wxCoord height,
+ wxDC *source,
+ wxCoord WXUNUSED(xsrc), wxCoord WXUNUSED(ysrc),
+ int WXUNUSED(rop), bool useMask,
+ wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask))
+{
+ wxBitmap& bmp = source->GetSelectedBitmap();
+ wxMask *mask = useMask ? bmp.GetMask() : NULL;
+ if ( mask )
+ {
+ // If we are printing source colours are screen colours not printer
+ // colours and so we need copy the bitmap pixel by pixel.
+ RECT rect;
+ HDC dcSrc = GetHdcOf(*source);
+ MemoryHDC dcMask(dcSrc);
+ SelectInHDC selectMask(dcMask, (HBITMAP)mask->GetMaskBitmap());
+
+ for (int x = 0; x < width; x++)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ COLORREF cref = ::GetPixel(dcMask, x, y);
+ if (cref)
+ {
+ HBRUSH brush = ::CreateSolidBrush(::GetPixel(dcSrc, x, y));
+ rect.left = xdest + x;
+ rect.right = rect.left + 1;
+ rect.top = ydest + y;
+ rect.bottom = rect.top + 1;
+ ::FillRect(GetHdc(), &rect, brush);
+ ::DeleteObject(brush);
+ }
+ }
+ }