// clipping
// ---------------------------------------------------------------------------
+#define DO_SET_CLIPPING_BOX() \
+{ \
+ RECT rect; \
+ \
+ GetClipBox(GetHdc(), &rect); \
+ \
+ m_clipX1 = (wxCoord) XDEV2LOG(rect.left); \
+ m_clipY1 = (wxCoord) YDEV2LOG(rect.top); \
+ m_clipX2 = (wxCoord) XDEV2LOG(rect.right); \
+ m_clipY2 = (wxCoord) YDEV2LOG(rect.bottom); \
+}
+
void wxDC::DoSetClippingRegion(wxCoord cx, wxCoord cy, wxCoord cw, wxCoord ch)
{
m_clipping = TRUE;
- m_clipX1 = (int)cx;
- m_clipY1 = (int)cy;
- m_clipX2 = (int)(cx + cw);
- m_clipY2 = (int)(cy + ch);
-
- DoClipping((WXHDC) m_hDC);
+ IntersectClipRect(GetHdc(), XLOG2DEV(cx), YLOG2DEV(cy),
+ XLOG2DEV(cx + cw), YLOG2DEV(cy + ch));
+ DO_SET_CLIPPING_BOX()
}
void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
{
wxCHECK_RET( region.GetHRGN(), wxT("invalid clipping region") );
- wxRect box = region.GetBox();
-
m_clipping = TRUE;
- m_clipX1 = box.x;
- m_clipY1 = box.y;
- m_clipX2 = box.x + box.width;
- m_clipY2 = box.y + box.height;
#ifdef __WIN16__
SelectClipRgn(GetHdc(), (HRGN) region.GetHRGN());
#else
ExtSelectClipRgn(GetHdc(), (HRGN) region.GetHRGN(), RGN_AND);
#endif
-}
-void wxDC::DoClipping(WXHDC dc)
-{
- if (m_clipping && dc)
- {
- IntersectClipRect((HDC) dc, XLOG2DEV(m_clipX1), YLOG2DEV(m_clipY1),
- XLOG2DEV(m_clipX2), YLOG2DEV(m_clipY2));
- }
+ DO_SET_CLIPPING_BOX()
}
void wxDC::DestroyClippingRegion()
// get the color of the pixel
COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y));
+ // JACS: what was this for?
+#if 0
// get the color of the pen
COLORREF pencolor = 0x00ffffff;
if (m_pen.Ok())
{
pencolor = m_pen.GetColour().GetPixel();
}
+#endif
// return the color of the pixel
if( col )
// check, if color of the pixels is the same as the color of the current
// pen and return TRUE if it is, FALSE otherwise
- return pixelcolor == pencolor;
+ // JACS, 24/02/2000: can't understand the reason for this, so returning TRUE instead.
+ // return pixelcolor == pencolor;
+
+ return TRUE;
}
void wxDC::DoCrossHair(wxCoord x, wxCoord y)
// In WIN16, draw a cross
HPEN blackPen = ::CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
HPEN whiteBrush = (HPEN)::GetStockObject(WHITE_BRUSH);
- HPEN hPenOld = (HPEN)::SelectObject(hdcMem, blackPen);
- HPEN hBrushOld = (HPEN)::SelectObject(hdcMem, whiteBrush);
+ HPEN hPenOld = (HPEN)::SelectObject(GetHdc(), blackPen);
+ HPEN hBrushOld = (HPEN)::SelectObject(GetHdc(), whiteBrush);
::SetROP2(GetHdc(), R2_COPYPEN);
Rectangle(GetHdc(), x1, y1, x2, y2);
MoveTo(GetHdc(), x1, y1);