+}
+
+int wxMSWDCImpl::GetDepth() const
+{
+ WXMICROWIN_CHECK_HDC_RET(16)
+
+ return (int)::GetDeviceCaps(GetHdc(), BITSPIXEL);
+}
+
+// ---------------------------------------------------------------------------
+// drawing
+// ---------------------------------------------------------------------------
+
+void wxMSWDCImpl::Clear()
+{
+ WXMICROWIN_CHECK_HDC
+
+ RECT rect;
+ if (m_window)
+ {
+ GetClientRect((HWND) m_window->GetHWND(), &rect);
+ }
+ else
+ {
+ // No, I think we should simply ignore this if printing on e.g.
+ // a printer DC.
+ // wxCHECK_RET( m_selectedBitmap.IsOk(), wxT("this DC can't be cleared") );
+ if (!m_selectedBitmap.IsOk())
+ return;
+
+ rect.left = -m_deviceOriginX; rect.top = -m_deviceOriginY;
+ rect.right = m_selectedBitmap.GetWidth()-m_deviceOriginX;
+ rect.bottom = m_selectedBitmap.GetHeight()-m_deviceOriginY;
+ }
+
+#ifndef __WXWINCE__
+ (void) ::SetMapMode(GetHdc(), MM_TEXT);
+#endif
+
+ DWORD colour = ::GetBkColor(GetHdc());
+ HBRUSH brush = ::CreateSolidBrush(colour);
+ ::FillRect(GetHdc(), &rect, brush);
+ ::DeleteObject(brush);
+
+ RealizeScaleAndOrigin();
+}
+
+bool wxMSWDCImpl::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x),
+ wxCoord WXUNUSED_IN_WINCE(y),
+ const wxColour& WXUNUSED_IN_WINCE(col),
+ wxFloodFillStyle WXUNUSED_IN_WINCE(style))
+{
+#ifdef __WXWINCE__
+ return false;
+#else
+ WXMICROWIN_CHECK_HDC_RET(false)
+
+ bool success = (0 != ::ExtFloodFill(GetHdc(), XLOG2DEV(x), YLOG2DEV(y),
+ col.GetPixel(),
+ style == wxFLOOD_SURFACE ? FLOODFILLSURFACE
+ : FLOODFILLBORDER) ) ;
+ if (!success)
+ {
+ // quoting from the MSDN docs:
+ //
+ // Following are some of the reasons this function might fail:
+ //
+ // * The filling could not be completed.
+ // * The specified point has the boundary color specified by the
+ // crColor parameter (if FLOODFILLBORDER was requested).
+ // * The specified point does not have the color specified by
+ // crColor (if FLOODFILLSURFACE was requested)
+ // * The point is outside the clipping region that is, it is not
+ // visible on the device.
+ //
+ wxLogLastError(wxT("ExtFloodFill"));
+ }
+
+ CalcBoundingBox(x, y);
+
+ return success;
+#endif
+}
+
+bool wxMSWDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
+{
+ WXMICROWIN_CHECK_HDC_RET(false)
+
+ wxCHECK_MSG( col, false, wxT("NULL colour parameter in wxMSWDCImpl::GetPixel") );
+
+ // get the color of the pixel
+ COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y));
+
+ wxRGBToColour(*col, pixelcolor);
+
+ return true;
+}
+
+void wxMSWDCImpl::DoCrossHair(wxCoord x, wxCoord y)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxCoord x1 = x-VIEWPORT_EXTENT;
+ wxCoord y1 = y-VIEWPORT_EXTENT;
+ wxCoord x2 = x+VIEWPORT_EXTENT;
+ wxCoord y2 = y+VIEWPORT_EXTENT;
+
+ wxDrawLine(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y));
+ wxDrawLine(GetHdc(), XLOG2DEV(x), YLOG2DEV(y1), XLOG2DEV(x), YLOG2DEV(y2));
+
+ CalcBoundingBox(x1, y1);
+ CalcBoundingBox(x2, y2);
+}
+
+void wxMSWDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxDrawLine(GetHdc(), XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2));
+
+ CalcBoundingBox(x1, y1);
+ CalcBoundingBox(x2, y2);
+}
+
+// Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
+// and ending at (x2, y2)
+void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord xc, wxCoord yc)
+{
+ double dx = xc - x1;
+ double dy = yc - y1;
+ wxCoord r = (wxCoord)sqrt(dx*dx + dy*dy);
+
+
+#ifdef __WXWINCE__
+ // Slower emulation since WinCE doesn't support Pie and Arc
+ double sa = acos((x1-xc)/r)/M_PI*180; // between 0 and 180
+ if( y1>yc )
+ sa = -sa; // below center
+ double ea = atan2(yc-y2, x2-xc)/M_PI*180;
+ DoDrawEllipticArcRot( xc-r, yc-r, 2*r, 2*r, sa, ea );
+#else
+
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ // treat the special case of full circle separately
+ if ( x1 == x2 && y1 == y2 )
+ {
+ GetOwner()->DrawEllipse(xc - r, yc - r, 2*r, 2*r);
+ return;
+ }
+
+ wxCoord xx1 = XLOG2DEV(x1);
+ wxCoord yy1 = YLOG2DEV(y1);
+ wxCoord xx2 = XLOG2DEV(x2);
+ wxCoord yy2 = YLOG2DEV(y2);
+ wxCoord xxc = XLOG2DEV(xc);
+ wxCoord yyc = YLOG2DEV(yc);
+ dx = xxc - xx1;
+ dy = yyc - yy1;
+ wxCoord ray = (wxCoord)sqrt(dx*dx + dy*dy);
+
+ wxCoord xxx1 = (wxCoord) (xxc-ray);
+ wxCoord yyy1 = (wxCoord) (yyc-ray);
+ wxCoord xxx2 = (wxCoord) (xxc+ray);
+ wxCoord yyy2 = (wxCoord) (yyc+ray);
+
+ if ( m_brush.IsNonTransparent() )
+ {
+ // Have to add 1 to bottom-right corner of rectangle
+ // to make semi-circles look right (crooked line otherwise).
+ // Unfortunately this is not a reliable method, depends
+ // on the size of shape.
+ // TODO: figure out why this happens!
+ Pie(GetHdc(),xxx1,yyy1,xxx2+1,yyy2+1, xx1,yy1,xx2,yy2);
+ }
+ else
+ {
+ Arc(GetHdc(),xxx1,yyy1,xxx2,yyy2, xx1,yy1,xx2,yy2);
+ }
+
+ CalcBoundingBox(xc - r, yc - r);
+ CalcBoundingBox(xc + r, yc + r);
+#endif
+}
+
+void wxMSWDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1,
+ wxCoord width, wxCoord height)
+{
+ // cases when we don't have DrawFrameControl()
+#if defined(__SYMANTEC__) || defined(__WXMICROWIN__)
+ return wxDCBase::DoDrawCheckMark(x1, y1, width, height);
+#else // normal case
+ wxCoord x2 = x1 + width,
+ y2 = y1 + height;
+
+ RECT rect;
+ rect.left = x1;
+ rect.top = y1;
+ rect.right = x2;
+ rect.bottom = y2;
+
+#ifdef __WXWINCE__
+ DrawFrameControl(GetHdc(), &rect, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED);
+#else
+ DrawFrameControl(GetHdc(), &rect, DFC_MENU, DFCS_MENUCHECK);
+#endif
+
+ CalcBoundingBox(x1, y1);
+ CalcBoundingBox(x2, y2);
+#endif // Microwin/Normal
+}
+
+void wxMSWDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
+{
+ WXMICROWIN_CHECK_HDC
+
+ COLORREF color = 0x00ffffff;
+ if (m_pen.IsOk())
+ {
+ color = m_pen.GetColour().GetPixel();
+ }
+
+ SetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), color);
+
+ CalcBoundingBox(x, y);
+}
+
+void wxMSWDCImpl::DoDrawPolygon(int n,
+ const wxPoint points[],
+ wxCoord xoffset,
+ wxCoord yoffset,
+ wxPolygonFillMode WXUNUSED_IN_WINCE(fillStyle))
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ // Do things less efficiently if we have offsets
+ if (xoffset != 0 || yoffset != 0)
+ {
+ POINT *cpoints = new POINT[n];
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ cpoints[i].x = (int)(points[i].x + xoffset);
+ cpoints[i].y = (int)(points[i].y + yoffset);
+
+ CalcBoundingBox(cpoints[i].x, cpoints[i].y);
+ }
+#ifndef __WXWINCE__
+ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
+#endif
+ (void)Polygon(GetHdc(), cpoints, n);
+#ifndef __WXWINCE__
+ SetPolyFillMode(GetHdc(),prev);
+#endif
+ delete[] cpoints;
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < n; i++)
+ CalcBoundingBox(points[i].x, points[i].y);
+
+#ifndef __WXWINCE__
+ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
+#endif
+ (void)Polygon(GetHdc(), (POINT*) points, n);
+#ifndef __WXWINCE__
+ SetPolyFillMode(GetHdc(),prev);
+#endif
+ }
+}
+
+void
+wxMSWDCImpl::DoDrawPolyPolygon(int n,
+ const int count[],
+ const wxPoint points[],
+ wxCoord xoffset,
+ wxCoord yoffset,
+ wxPolygonFillMode fillStyle)
+{
+#ifdef __WXWINCE__
+ wxDCImpl::DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle);
+#else
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+ int i, cnt;
+ for (i = cnt = 0; i < n; i++)
+ cnt += count[i];
+
+ // Do things less efficiently if we have offsets
+ if (xoffset != 0 || yoffset != 0)
+ {
+ POINT *cpoints = new POINT[cnt];
+ for (i = 0; i < cnt; i++)
+ {
+ cpoints[i].x = (int)(points[i].x + xoffset);
+ cpoints[i].y = (int)(points[i].y + yoffset);
+
+ CalcBoundingBox(cpoints[i].x, cpoints[i].y);
+ }
+#ifndef __WXWINCE__
+ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
+#endif
+ (void)PolyPolygon(GetHdc(), cpoints, count, n);
+#ifndef __WXWINCE__
+ SetPolyFillMode(GetHdc(),prev);
+#endif
+ delete[] cpoints;
+ }
+ else
+ {
+ for (i = 0; i < cnt; i++)
+ CalcBoundingBox(points[i].x, points[i].y);
+
+#ifndef __WXWINCE__
+ int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
+#endif
+ (void)PolyPolygon(GetHdc(), (POINT*) points, count, n);
+#ifndef __WXWINCE__
+ SetPolyFillMode(GetHdc(),prev);
+#endif
+ }
+#endif
+ // __WXWINCE__
+}
+
+void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+{
+ WXMICROWIN_CHECK_HDC
+
+ // Do things less efficiently if we have offsets
+ if (xoffset != 0 || yoffset != 0)
+ {
+ POINT *cpoints = new POINT[n];
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ cpoints[i].x = (int)(points[i].x + xoffset);
+ cpoints[i].y = (int)(points[i].y + yoffset);
+
+ CalcBoundingBox(cpoints[i].x, cpoints[i].y);
+ }
+ (void)Polyline(GetHdc(), cpoints, n);
+ delete[] cpoints;
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < n; i++)
+ CalcBoundingBox(points[i].x, points[i].y);
+
+ (void)Polyline(GetHdc(), (POINT*) points, n);
+ }
+}
+
+void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ wxCoord x2 = x + width;
+ wxCoord y2 = y + height;
+
+ wxCoord x2dev = XLOG2DEV(x2),
+ y2dev = YLOG2DEV(y2);
+
+ // Windows (but not Windows CE) draws the filled rectangles without outline
+ // (i.e. drawn with a transparent pen) one pixel smaller in both directions
+ // and we want them to have the same size regardless of which pen is used
+#ifndef __WXWINCE__
+ if ( m_pen.IsTransparent() )
+ {
+ x2dev++;
+ y2dev++;
+ }
+#endif // !__WXWINCE__
+
+ (void)Rectangle(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), x2dev, y2dev);
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x2, y2);
+}
+
+void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ // Now, a negative radius value is interpreted to mean
+ // 'the proportion of the smallest X or Y dimension'
+
+ if (radius < 0.0)
+ {
+ double smallest = (width < height) ? width : height;
+ radius = (- radius * smallest);
+ }
+
+ wxCoord x2 = (x+width);
+ wxCoord y2 = (y+height);
+
+ // Windows draws the filled rectangles without outline (i.e. drawn with a
+ // transparent pen) one pixel smaller in both directions and we want them
+ // to have the same size regardless of which pen is used - adjust
+ if ( m_pen.IsTransparent() )
+ {
+ x2++;
+ y2++;
+ }
+
+ (void)RoundRect(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2),
+ YLOG2DEV(y2), (int) (2*XLOG2DEV(radius)), (int)( 2*YLOG2DEV(radius)));
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x2, y2);
+}
+
+void wxMSWDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ // +1 below makes the ellipse more similar to other platforms.
+ // In particular, DoDrawEllipse(x,y,1,1) should draw one point.
+ wxCoord x2 = x + width + 1;
+ wxCoord y2 = y + height + 1;
+
+ // Problem: Windows GDI Ellipse() with x2-x == y2-y == 3 and transparent
+ // pen doesn't draw anything. Should we provide a workaround?
+
+ ::Ellipse(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2));
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x2, y2);
+}
+
+#if wxUSE_SPLINES && !defined(__WXWINCE__)
+void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
+{
+ // quadratic b-spline to cubic bezier spline conversion
+ //
+ // quadratic spline with control points P0,P1,P2
+ // P(s) = P0*(1-s)^2 + P1*2*(1-s)*s + P2*s^2
+ //
+ // bezier spline with control points B0,B1,B2,B3
+ // B(s) = B0*(1-s)^3 + B1*3*(1-s)^2*s + B2*3*(1-s)*s^2 + B3*s^3
+ //
+ // control points of bezier spline calculated from b-spline
+ // B0 = P0
+ // B1 = (2*P1 + P0)/3
+ // B2 = (2*P1 + P2)/3
+ // B3 = P2
+
+ WXMICROWIN_CHECK_HDC
+
+ wxASSERT_MSG( points, wxT("NULL pointer to spline points?") );
+
+ const size_t n_points = points->GetCount();
+ wxASSERT_MSG( n_points > 2 , wxT("incomplete list of spline points?") );
+
+ const size_t n_bezier_points = n_points * 3 + 1;
+ POINT *lppt = (POINT *)malloc(n_bezier_points*sizeof(POINT));
+ size_t bezier_pos = 0;
+ wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4;
+
+ wxPointList::compatibility_iterator node = points->GetFirst();
+ wxPoint *p = node->GetData();
+ lppt[ bezier_pos ].x = x1 = p->x;
+ lppt[ bezier_pos ].y = y1 = p->y;
+ bezier_pos++;
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+
+ node = node->GetNext();
+ p = node->GetData();
+
+ x2 = p->x;
+ y2 = p->y;
+ cx1 = ( x1 + x2 ) / 2;
+ cy1 = ( y1 + y2 ) / 2;
+ lppt[ bezier_pos ].x = XLOG2DEV(cx1);
+ lppt[ bezier_pos ].y = YLOG2DEV(cy1);
+ bezier_pos++;
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+
+#if !wxUSE_STD_CONTAINERS
+ while ((node = node->GetNext()) != NULL)
+#else
+ while ((node = node->GetNext()))
+#endif // !wxUSE_STD_CONTAINERS
+ {
+ p = (wxPoint *)node->GetData();
+ x1 = x2;
+ y1 = y2;
+ x2 = p->x;
+ y2 = p->y;
+ cx4 = (x1 + x2) / 2;
+ cy4 = (y1 + y2) / 2;
+ // B0 is B3 of previous segment
+ // B1:
+ lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx1)/3);
+ lppt[ bezier_pos ].y = YLOG2DEV((y1*2+cy1)/3);
+ bezier_pos++;
+ // B2:
+ lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx4)/3);
+ lppt[ bezier_pos ].y = YLOG2DEV((y1*2+cy4)/3);
+ bezier_pos++;
+ // B3:
+ lppt[ bezier_pos ].x = XLOG2DEV(cx4);
+ lppt[ bezier_pos ].y = YLOG2DEV(cy4);
+ bezier_pos++;
+ cx1 = cx4;
+ cy1 = cy4;
+ }
+
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+ lppt[ bezier_pos ].x = XLOG2DEV(x2);
+ lppt[ bezier_pos ].y = YLOG2DEV(y2);
+ bezier_pos++;
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+
+ ::PolyBezier( GetHdc(), lppt, bezier_pos );
+
+ free(lppt);
+}
+#endif // wxUSE_SPLINES
+
+// Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows
+void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+{
+#ifdef __WXWINCE__
+ DoDrawEllipticArcRot( x, y, w, h, sa, ea );
+#else
+
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ wxCoord x2 = x + w;
+ wxCoord y2 = y + h;
+
+ int rx1 = XLOG2DEV(x+w/2);
+ int ry1 = YLOG2DEV(y+h/2);
+ int rx2 = rx1;
+ int ry2 = ry1;
+
+ sa = DegToRad(sa);
+ ea = DegToRad(ea);
+
+ rx1 += (int)(100.0 * abs(w) * cos(sa));
+ ry1 -= (int)(100.0 * abs(h) * m_signY * sin(sa));
+ rx2 += (int)(100.0 * abs(w) * cos(ea));
+ ry2 -= (int)(100.0 * abs(h) * m_signY * sin(ea));
+
+ // Swap start and end positions if the end angle is less than the start angle.
+ if (ea < sa) {
+ int temp;
+ temp = rx2;
+ rx2 = rx1;
+ rx1 = temp;
+ temp = ry2;
+ ry2 = ry1;
+ ry1 = temp;
+ }
+
+ // draw pie with NULL_PEN first and then outline otherwise a line is
+ // drawn from the start and end points to the centre
+ HPEN hpenOld = (HPEN) ::SelectObject(GetHdc(), (HPEN) ::GetStockObject(NULL_PEN));
+ if (m_signY > 0)
+ {
+ (void)Pie(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2)+1, YLOG2DEV(y2)+1,
+ rx1, ry1, rx2, ry2);
+ }
+ else
+ {
+ (void)Pie(GetHdc(), XLOG2DEV(x), YLOG2DEV(y)-1, XLOG2DEV(x2)+1, YLOG2DEV(y2),
+ rx1, ry1-1, rx2, ry2-1);
+ }
+
+ ::SelectObject(GetHdc(), hpenOld);
+
+ (void)Arc(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2),
+ rx1, ry1, rx2, ry2);
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x2, y2);
+#endif
+}
+
+void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxCHECK_RET( icon.IsOk(), wxT("invalid icon in DrawIcon") );
+
+#ifdef __WIN32__
+ ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL);
+#else
+ ::DrawIcon(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon));
+#endif
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x + icon.GetWidth(), y + icon.GetHeight());
+}
+
+void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxCHECK_RET( bmp.IsOk(), wxT("invalid bitmap in wxMSWDCImpl::DrawBitmap") );
+
+ int width = bmp.GetWidth(),
+ height = bmp.GetHeight();
+
+ HBITMAP hbmpMask = 0;
+
+#if wxUSE_PALETTE
+ HPALETTE oldPal = 0;
+#endif // wxUSE_PALETTE
+
+ if ( bmp.HasAlpha() )
+ {
+ MemoryHDC hdcMem;
+ SelectInHDC select(hdcMem, GetHbitmapOf(bmp));