]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dc.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/dialog.h"
31 #include "wx/dcprint.h"
32 #include "wx/msw/private.h"
38 #if USE_COMMON_DIALOGS
58 #if !USE_SHARED_LIBRARY
59 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxObject
)
62 // Declarations local to this file
64 #define YSCALE(y) (yorigin - (y))
66 // #define wx_round(a) (int)((a)+.5)
68 // Default constructor
71 // Stop internal GDI objects being found and pointers kept
72 // after these objects have been deleted.
73 // No - it's OK; these lists won't return them
74 // because their 'visible' status will be FALSE.
76 wxTheFontList->RemoveFont(&m_font);
77 wxThePenList->RemovePen(&m_pen);
78 wxTheBrushList->RemoveBrush(&m_brush);
79 wxTheBrushList->RemoveBrush(&m_backgroundBrush);
82 m_minX
= 0; m_minY
= 0; m_maxX
= 0; m_maxY
= 0;
84 m_autoSetting
= TRUE
;
88 // m_selectedBitmap = NULL;
101 m_minX
= 0; m_minY
= 0; m_maxX
= 0; m_maxY
= 0;
103 m_logicalOriginX
= 0;
104 m_logicalOriginY
= 0;
107 m_logicalScaleX
= 1.0;
108 m_logicalScaleY
= 1.0;
113 m_systemScaleX
= 1.0;
114 m_systemScaleY
= 1.0;
115 m_mappingMode
= MM_TEXT
;
116 // m_dontDelete = FALSE;
121 m_windowExtX
= VIEWPORT_EXTENT
;
122 m_windowExtY
= VIEWPORT_EXTENT
;
123 m_logicalFunction
= -1;
125 m_backgroundBrush
= *wxWHITE_BRUSH
;
126 // m_backgroundBrush.UseResource();
128 m_textForegroundColour
= *wxBLACK
;
129 m_textBackgroundColour
= *wxWHITE
;
131 m_colour
= wxColourDisplay();
140 SelectOldObjects(m_hDC
);
142 if ( m_canvas
== NULL
)
143 ::DeleteDC((HDC
)m_hDC
);
145 ::ReleaseDC((HWND
)m_canvas
->GetHWND(), (HDC
)m_hDC
);
152 SelectOldObjects(m_hDC);
153 ::DeleteDC((HDC) m_hDC);
158 // This will select current objects out of the DC,
159 // which is what you have to do before deleting the
161 void wxDC::SelectOldObjects(WXHDC dc
)
164 wxDebugMsg("wxDC::SelectOldObjects %X\n", this);
171 wxDebugMsg("wxDC::SelectOldObjects: Selecting old HBITMAP %X\n", m_oldBitmap
);
173 ::SelectObject((HDC
) dc
, (HBITMAP
) m_oldBitmap
);
174 if (m_selectedBitmap
.Ok())
176 m_selectedBitmap
.SetSelectedInto(NULL
);
183 wxDebugMsg("wxDC::SelectOldObjects: Selecting old HPEN %X\n", m_oldPen
);
185 ::SelectObject((HDC
) dc
, (HPEN
) m_oldPen
);
191 wxDebugMsg("wxDC::SelectOldObjects: Selecting old HBRUSH %X\n", m_oldBrush
);
193 ::SelectObject((HDC
) dc
, (HBRUSH
) m_oldBrush
);
199 wxDebugMsg("wxDC::SelectOldObjects: Selecting old HFONT %X\n", m_oldFont
);
201 ::SelectObject((HDC
) dc
, (HFONT
) m_oldFont
);
207 wxDebugMsg("wxDC::SelectOldObjects: Selecting old HPALETTE %X\n", m_oldPalette
);
209 ::SelectPalette((HDC
) dc
, (HPALETTE
) m_oldPalette
, TRUE
);
212 wxDebugMsg("wxDC::SelectOldObjects: Done.\n");
218 m_font.ReleaseResource();
220 m_pen.ReleaseResource();
222 m_brush.ReleaseResource();
223 if (m_backgroundBrush.Ok())
224 m_backgroundBrush.ReleaseResource();
227 m_brush
= wxNullBrush
;
229 m_palette
= wxNullPalette
;
231 m_backgroundBrush
= wxNullBrush
;
232 m_selectedBitmap
= wxNullBitmap
;
235 void wxDC::SetClippingRegion(long cx
, long cy
, long cw
, long ch
)
240 m_clipX2
= (int)(cx
+ cw
);
241 m_clipY2
= (int)(cy
+ ch
);
245 DoClipping((WXHDC
) m_hDC
);
250 void wxDC::DoClipping(WXHDC dc
)
252 if (m_clipping
&& dc
)
254 IntersectClipRect((HDC
) dc
, XLOG2DEV(m_clipX1
), YLOG2DEV(m_clipY1
),
255 XLOG2DEV(m_clipX2
), YLOG2DEV(m_clipY2
));
261 m_canvas
->CalcScrolledPosition(0, 0, &x_off
, &y_off
);
263 // HRGN rgn = CreateRectRgn(XLOG2DEV(m_clipX1 + x_off), YLOG2DEV(m_clipY1 + y_off),
264 // XLOG2DEV(m_clipX2 + x_off), YLOG2DEV(m_clipY2 + y_off));
266 // SelectClipRgn(dc, rgn);
267 // DeleteObject(rgn);
268 IntersectClipRect((HDC
) dc
, XLOG2DEV(m_clipX1
+ x_off
), YLOG2DEV(m_clipY1
+ y_off
),
269 XLOG2DEV(m_clipX2
+ x_off
), YLOG2DEV(m_clipY2
+ y_off
));
274 void wxDC::DestroyClippingRegion(void)
278 if (m_clipping
&& m_hDC
)
280 // SelectClipRgn(dc, NULL);
281 HRGN rgn
= CreateRectRgn(0, 0, 32000, 32000);
283 wxDebugMsg("wxDC::DestroyClippingRegion: Selecting HRGN %X\n", rgn
);
285 SelectClipRgn((HDC
) m_hDC
, rgn
);
287 wxDebugMsg("wxDC::DestroyClippingRegion: Deleting HRGN %X\n", rgn
);
296 bool wxDC::CanDrawBitmap(void) const
301 bool wxDC::CanGetTextExtent(void) const
303 // What sort of display is it?
304 int technology
= ::GetDeviceCaps((HDC
) m_hDC
, TECHNOLOGY
);
308 if (technology
!= DT_RASDISPLAY
&& technology
!= DT_RASPRINTER
)
315 void wxDC::SetPalette(const wxPalette
& palette
)
319 m_palette
= m_palette
;
323 // Setting a NULL colourmap is a way of restoring
324 // the original colourmap
327 ::SelectPalette((HDC
) m_hDC
, (HPALETTE
) m_oldPalette
, TRUE
);
329 wxDebugMsg("wxDC::SetPalette: set old palette %X\n", m_oldPalette
);
337 if (m_palette
.Ok() && m_palette
.GetHPALETTE())
339 HPALETTE oldPal
= ::SelectPalette((HDC
) m_hDC
, (HPALETTE
) m_palette
.GetHPALETTE(), TRUE
);
341 m_oldPalette
= (WXHPALETTE
) oldPal
;
344 wxDebugMsg("wxDC::SetPalette %X: selected palette %X\n", this, m_palette
.GetHPALETTE());
346 wxDebugMsg("wxDC::SetPalette: oldPal was palette %X\n", oldPal
);
348 wxDebugMsg("wxDC::SetPalette: m_oldPalette is palette %X\n", m_oldPalette
);
350 ::RealizePalette((HDC
) m_hDC
);
356 void wxDC::Clear(void)
362 GetClientRect((HWND
) m_canvas
->GetHWND(), &rect
);
363 else if (m_selectedBitmap
.Ok())
365 rect
.left
= 0; rect
.top
= 0;
366 rect
.right
= m_selectedBitmap
.GetWidth();
367 rect
.bottom
= m_selectedBitmap
.GetHeight();
369 (void) ::SetMapMode((HDC
) m_hDC
, MM_TEXT
);
371 DWORD colour
= GetBkColor((HDC
) m_hDC
);
372 HBRUSH brush
= CreateSolidBrush(colour
);
373 FillRect((HDC
) m_hDC
, &rect
, brush
);
376 ::SetMapMode((HDC
) m_hDC
, MM_ANISOTROPIC
);
377 ::SetViewportExtEx((HDC
) m_hDC
, VIEWPORT_EXTENT
, VIEWPORT_EXTENT
, NULL
);
378 ::SetWindowExtEx((HDC
) m_hDC
, m_windowExtX
, m_windowExtY
, NULL
);
379 ::SetViewportOrgEx((HDC
) m_hDC
, (int)m_deviceOriginX
, (int)m_deviceOriginY
, NULL
);
380 ::SetWindowOrgEx((HDC
) m_hDC
, (int)m_logicalOriginX
, (int)m_logicalOriginY
, NULL
);
385 void wxDC::FloodFill(long x
, long y
, wxColour
*col
, int style
)
390 if (m_brush
.Ok() && m_autoSetting
)
394 // m_canvas->CalcScrolledPosition((int)x, (int)y, &xx, &yy);
398 (void)ExtFloodFill((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
),
400 style
==wxFLOOD_SURFACE
?
401 FLOODFILLSURFACE
:FLOODFILLBORDER
406 CalcBoundingBox(x
, y
);
409 bool wxDC::GetPixel(long x
, long y
, wxColour
*col
) const
411 // added by steve 29.12.94 (copied from DrawPoint)
412 // returns TRUE for pixels in the color of the current pen
413 // and FALSE for all other pixels colors
414 // if col is non-NULL return the color of the pixel
419 m_canvas->CalcScrolledPosition((int)x, (int)y, &xx1, &yy1);
422 // get the color of the pixel
423 COLORREF pixelcolor
= ::GetPixel((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
));
424 // get the color of the pen
425 COLORREF pencolor
= 0x00ffffff;
428 pencolor
= m_pen
.GetColour().GetPixel() ;
431 // return the color of the pixel
433 col
->Set(GetRValue(pixelcolor
),GetGValue(pixelcolor
),GetBValue(pixelcolor
));
435 // check, if color of the pixels is the same as the color
436 // of the current pen
437 return(pixelcolor
==pencolor
);
440 void wxDC::CrossHair(long x
, long y
)
442 if (m_pen
.Ok() && m_autoSetting
)
445 // We suppose that our screen is 2000x2000 max.
460 m_canvas->CalcScrolledPosition(x1, y1, &xx1, &yy1);
461 m_canvas->CalcScrolledPosition(x2, y2, &xx2, &yy2);
462 m_canvas->CalcScrolledPosition(x, y, &xx, &yy);
468 (void)MoveToEx((HDC
) m_hDC
, XLOG2DEV(x1
), YLOG2DEV(y
), NULL
);
469 (void)LineTo((HDC
) m_hDC
, XLOG2DEV(x2
), YLOG2DEV(y
));
471 (void)MoveToEx((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y1
), NULL
);
472 (void)LineTo((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y2
));
476 CalcBoundingBox(x1
, y1
);
477 CalcBoundingBox(x2
, y2
);
480 void wxDC::DrawLine(long x1
, long y1
, long x2
, long y2
)
482 // BUGBUG - is this necessary? YES YES YES YEs Yes yes ye....
483 if (m_pen
.Ok() && m_autoSetting
)
492 m_canvas->CalcScrolledPosition((int)x1, (int)y1, &xx1, &yy1);
493 m_canvas->CalcScrolledPosition((int)x2, (int)y2, &xx2, &yy2);
499 (void)MoveToEx((HDC
) m_hDC
, XLOG2DEV(x1
), YLOG2DEV(y1
), NULL
);
500 (void)LineTo((HDC
) m_hDC
, XLOG2DEV(x2
), YLOG2DEV(y2
));
502 /* MATTHEW: [6] New normalization */
503 #if WX_STANDARD_GRAPHICS
504 (void)LineTo((HDC
) m_hDC
, XLOG2DEV(x2
) + 1, YLOG2DEV(y2
));
509 CalcBoundingBox(x1
, y1
);
510 CalcBoundingBox(x2
, y2
);
513 void wxDC::DrawArc(long x1
,long y1
,long x2
,long y2
,double xc
,double yc
)
526 double radius
= (double)sqrt(dx
*dx
+dy
*dy
) ;;
527 if (x1
==x2
&& x2
==y2
)
529 DrawEllipse(xc
,yc
,(double)(radius
*2.0),(double)(radius
*2)) ;
533 // BUGBUG - is this necessary?
534 if (m_pen
.Ok() && m_autoSetting
)
540 m_canvas->CalcScrolledPosition((int)x1, (int)y1, &xx1, &yy1);
541 m_canvas->CalcScrolledPosition((int)x2, (int)y2, &xx2, &yy2);
542 m_canvas->CalcScrolledPosition((int)xc, (int)yc, &xxc, &yyc);
548 long xx1
= XLOG2DEV(x1
) ;
549 long yy1
= YLOG2DEV(y1
) ;
550 long xx2
= XLOG2DEV(x2
) ;
551 long yy2
= YLOG2DEV(y2
) ;
552 long xxc
= XLOG2DEV(xc
) ;
553 long yyc
= YLOG2DEV(yc
) ;
554 long ray
= (long) sqrt(double((xxc
-xx1
)*(xxc
-xx1
)+(yyc
-yy1
)*(yyc
-yy1
))) ;
556 (void)MoveToEx((HDC
) m_hDC
, (int) xx1
, (int) yy1
, NULL
);
557 long xxx1
= (long) (xxc
-ray
);
558 long yyy1
= (long) (yyc
-ray
);
559 long xxx2
= (long) (xxc
+ray
);
560 long yyy2
= (long) (yyc
+ray
);
561 if (m_brush
.Ok() && m_brush
.GetStyle() !=wxTRANSPARENT
)
563 // BUGBUG - is this necessary?
564 if (m_brush
.GetStyle()!=wxTRANSPARENT
&&m_autoSetting
)
566 Pie((HDC
) m_hDC
,xxx1
,yyy1
,xxx2
,yyy2
,
570 Arc((HDC
) m_hDC
,xxx1
,yyy1
,xxx2
,yyy2
,
575 CalcBoundingBox((xc
-radius
), (yc
-radius
));
576 CalcBoundingBox((xc
+radius
), (yc
+radius
));
579 void wxDC::DrawPoint(long x
, long y
)
581 // BUGBUG - is this necessary?
582 if (m_pen
.Ok() && m_autoSetting
)
589 m_canvas->CalcScrolledPosition((int)x, (int)y, &xx1, &yy1);
594 COLORREF color
= 0x00ffffff;
597 // m_pen.RealizeResource();
598 color
= m_pen
.GetColour().GetPixel() ;
602 color = RGB(m_pen->GetColour().Red(),
603 m_pen->GetColour().Green(),
604 m_pen->GetColour().Blue());
607 SetPixel((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), color
);
611 CalcBoundingBox(x
, y
);
614 void wxDC::DrawPolygon(int n
, wxPoint points
[], long xoffset
, long yoffset
,int fillStyle
)
616 // BUGBUG - is this necessary?
617 if (m_pen
.Ok() && m_autoSetting
)
624 m_canvas->CalcScrolledPosition(0, 0, &xoffset1, &yoffset1);
626 xoffset1 += (int)xoffset; yoffset1 += (int)yoffset;
631 POINT
*cpoints
= new POINT
[n
];
633 for (i
= 0; i
< n
; i
++)
635 cpoints
[i
].x
= (int)(XLOG2DEV(points
[i
].x
));
636 cpoints
[i
].y
= (int)(YLOG2DEV(points
[i
].y
));
638 CalcBoundingBox(points
[i
].x
, points
[i
].y
);
641 int prev
= SetPolyFillMode((HDC
) m_hDC
,fillStyle
==wxODDEVEN_RULE
?ALTERNATE
:WINDING
) ;
642 (void)Polygon((HDC
) m_hDC
, cpoints
, n
);
643 SetPolyFillMode((HDC
) m_hDC
,prev
) ;
650 void wxDC::DrawLines(int n
, wxPoint points
[], long xoffset
, long yoffset
)
652 // BUGBUG - is this necessary?
653 if (m_pen
.Ok() && m_autoSetting
)
662 m_canvas->CalcScrolledPosition(0, 0, &xoffset1, &yoffset1);
664 xoffset1 += (int)xoffset; yoffset1 += (int)yoffset;
669 POINT
*cpoints
= new POINT
[n
];
671 for (i
= 0; i
< n
; i
++)
673 cpoints
[i
].x
= (int)(XLOG2DEV(points
[i
].x
));
674 cpoints
[i
].y
= (int)(YLOG2DEV(points
[i
].y
));
676 CalcBoundingBox(points
[i
].x
, points
[i
].y
);
679 (void)Polyline((HDC
) m_hDC
, cpoints
, n
);
686 void wxDC::DrawRectangle(long x
, long y
, long width
, long height
)
688 // BUGBUG - is this necessary?
689 if (m_pen
.Ok() && m_autoSetting
)
695 int x2 = (int)(x+width);
696 int y2 = (int)(y+height);
700 m_canvas->CalcScrolledPosition((int)x, (int)y, &x1, &y1);
701 m_canvas->CalcScrolledPosition((int)(x+width), (int)(y+height), &x2, &y2);
705 long y2
= y
+ height
;
709 /* MATTHEW: [6] new normalization */
710 #if WX_STANDARD_GRAPHICS
711 bool do_brush
, do_pen
;
713 do_brush
= m_brush
.Ok() && m_brush
.GetStyle() != wxTRANSPARENT
;
714 do_pen
= m_pen
.Ok() && m_pen
.GetStyle() != wxTRANSPARENT
;
717 HPEN orig_pen
= NULL
;
719 if (do_pen
|| !m_pen
.Ok())
720 orig_pen
= ::SelectObject((HDC
) m_hDC
, ::GetStockObject(NULL_PEN
));
722 (void)Rectangle((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
),
723 XLOG2DEV(x2
) + 1, YLOG2DEV(y2
) + 1);
725 if (do_pen
|| !m_pen
.Ok())
726 ::SelectObject((HDC
) m_hDC
, orig_pen
);
729 HBRUSH orig_brush
= NULL
;
731 if (do_brush
|| !m_brush
.Ok())
732 orig_brush
= ::SelectObject((HDC
) m_hDC
, ::GetStockObject(NULL_BRUSH
));
734 (void)Rectangle((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
),
735 XLOG2DEV(x2
), YLOG2DEV(y2
));
737 if (do_brush
|| !m_brush
.Ok())
738 ::SelectObject((HDC
) m_hDC
, orig_brush
);
741 (void)Rectangle((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), XLOG2DEV(x2
), YLOG2DEV(y2
));
744 CalcBoundingBox(x
, y
);
745 CalcBoundingBox(x2
, y2
);
750 void wxDC::DrawRoundedRectangle(long x
, long y
, long width
, long height
, double radius
)
752 // BUGBUG - is this necessary?
753 if (m_pen
.Ok() && m_autoSetting
)
756 // Now, a negative radius value is interpreted to mean
757 // 'the proportion of the smallest X or Y dimension'
761 double smallest
= 0.0;
766 radius
= (- radius
* smallest
);
775 m_canvas->CalcScrolledPosition((int)x, (int)y, &x1, &y1);
776 m_canvas->CalcScrolledPosition((int)(x+width), (int)(y+height), &x2, &y2);
781 long y2
= (y
+height
);
785 (void)RoundRect((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), XLOG2DEV(x2
),
786 YLOG2DEV(y2
), 2*XLOG2DEV(radius
), 2*YLOG2DEV(radius
));
788 CalcBoundingBox(x
, y
);
789 CalcBoundingBox(x2
, y2
);
794 void wxDC::DrawEllipse(long x
, long y
, long width
, long height
)
796 // BUGBUG - is this necessary?
797 if (m_pen
.Ok() && m_autoSetting
)
806 m_canvas->CalcScrolledPosition((int)x, (int)y, &x1, &y1);
807 m_canvas->CalcScrolledPosition((int)(x+width), (int)(y+height), &x2, &y2);
812 long y2
= (y
+height
);
816 (void)Ellipse((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), XLOG2DEV(x2
), YLOG2DEV(y2
));
820 CalcBoundingBox(x
, y
);
821 CalcBoundingBox(x2
, y2
);
824 // Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows
825 void wxDC::DrawEllipticArc(long x
,long y
,long w
,long h
,double sa
,double ea
)
827 // BUGBUG - is this necessary?
828 if (m_pen
.Ok() && m_autoSetting
)
836 const double deg2rad
= 3.14159265359 / 180.0;
837 int rx1
= XLOG2DEV(x
+w
/2);
838 int ry1
= YLOG2DEV(y
+h
/2);
841 rx1
+= (int)(100.0 * abs(w
) * cos(sa
* deg2rad
));
842 ry1
-= (int)(100.0 * abs(h
) * m_signY
* sin(sa
* deg2rad
));
843 rx2
+= (int)(100.0 * abs(w
) * cos(ea
* deg2rad
));
844 ry2
-= (int)(100.0 * abs(h
) * m_signY
* sin(ea
* deg2rad
));
846 // draw pie with NULL_PEN first and then outline otherwise a line is
847 // drawn from the start and end points to the centre
848 HPEN orig_pen
= ::SelectObject((HDC
) m_hDC
, ::GetStockObject(NULL_PEN
));
851 (void)Pie((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), XLOG2DEV(x2
)+1, YLOG2DEV(y2
)+1,
856 (void)Pie((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
)-1, XLOG2DEV(x2
)+1, YLOG2DEV(y2
),
857 rx1
, ry1
-1, rx2
, ry2
-1);
859 ::SelectObject((HDC
) m_hDC
, orig_pen
);
860 (void)Arc((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), XLOG2DEV(x2
), YLOG2DEV(y2
),
865 CalcBoundingBox(x
, y
);
866 CalcBoundingBox(x2
, y2
);
869 void wxDC::DrawIcon(const wxIcon
& icon
, long x
, long y
)
876 m_canvas->CalcScrolledPosition(int)x, (int)y, &x1, &y1);
881 ::DrawIcon((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), (HICON
) icon
.GetHICON());
882 CalcBoundingBox(x
, y
);
883 CalcBoundingBox(x
+icon
.GetWidth(), y
+icon
.GetHeight());
888 void wxDC::SetFont(const wxFont
& the_font
)
890 // Release the current font from servitude (decrements the usage count)
892 // m_font.ReleaseResource();
901 ::SelectObject((HDC
) m_hDC
, (HFONT
) m_oldFont
);
905 if (m_font
.Ok() && m_font
.GetResourceHandle())
908 wxDebugMsg("wxDC::SetFont: Selecting HFONT %X\n", m_font
.GetResourceHandle());
910 HFONT f
= (HFONT
) ::SelectObject((HDC
) m_hDC
, (HFONT
) m_font
.GetResourceHandle());
912 m_oldFont
= (WXHFONT
) f
;
917 void wxDC::SetPen(const wxPen
& pen
)
922 // m_pen.ReleaseResource();
929 ::SelectObject((HDC
) m_hDC
, (HPEN
) m_oldPen
);
935 // m_pen.UseResource();
936 // m_pen.RealizeResource();
937 if (m_pen
.GetResourceHandle())
939 HPEN p
= (HPEN
) ::SelectObject((HDC
) m_hDC
, (HPEN
)m_pen
.GetResourceHandle()) ;
941 m_oldPen
= (WXHPEN
) p
;
948 void wxDC::SetBrush(const wxBrush
& brush
)
953 // m_brush.ReleaseResource();
960 ::SelectObject((HDC
) m_hDC
, (HBRUSH
) m_oldBrush
);
966 // m_brush.UseResource();
967 // m_brush.RealizeResource();
969 if (m_brush
.GetResourceHandle())
972 b
= ::SelectObject((HDC
) m_hDC
, (HBRUSH
)m_brush
.GetResourceHandle()) ;
974 m_oldBrush
= (WXHBRUSH
) b
;
980 void wxDC::DrawText(const wxString
& text
, long x
, long y
, bool use16bit
)
987 m_canvas->CalcScrolledPosition((int)x, (int)y, &xx1, &yy1);
992 if (m_font
.Ok() && m_font
.GetResourceHandle())
995 wxDebugMsg("wxDC::DrawText: Selecting HFONT %X\n", m_font
.GetResourceHandle());
997 HFONT f
= ::SelectObject((HDC
) m_hDC
, (HFONT
) m_font
.GetResourceHandle());
999 m_oldFont
= (WXHFONT
) f
;
1002 if (m_textForegroundColour
.Ok())
1003 SetTextColor((HDC
) m_hDC
, m_textForegroundColour
.GetPixel() ) ;
1005 DWORD old_background
;
1006 if (m_textBackgroundColour
.Ok())
1008 old_background
= SetBkColor((HDC
) m_hDC
, m_textBackgroundColour
.GetPixel() ) ;
1011 if (m_backgroundMode
== wxTRANSPARENT
)
1012 SetBkMode((HDC
) m_hDC
, TRANSPARENT
);
1014 SetBkMode((HDC
) m_hDC
, OPAQUE
);
1016 (void)TextOut((HDC
) m_hDC
, XLOG2DEV(x
), YLOG2DEV(y
), (char *) (const char *)text
, strlen((const char *)text
));
1018 if (m_textBackgroundColour
.Ok())
1019 (void)SetBkColor((HDC
) m_hDC
, old_background
);
1021 CalcBoundingBox(x
, y
);
1024 GetTextExtent(text
, &w
, &h
);
1025 CalcBoundingBox((x
+ w
), (y
+ h
));
1030 void wxDC::SetBackground(const wxBrush
& brush
)
1032 // if (m_backgroundBrush.Ok())
1033 // m_backgroundBrush.ReleaseResource();
1035 m_backgroundBrush
= brush
;
1037 if (!m_backgroundBrush
.Ok())
1040 // m_backgroundBrush.UseResource();
1041 // m_backgroundBrush.RealizeResource() ;
1045 bool customColours
= TRUE
;
1046 // If we haven't specified wxUSER_COLOURS, don't allow the panel/dialog box to
1047 // change background colours from the control-panel specified colours.
1048 if (m_canvas
->IsKindOf(CLASSINFO(wxWindow
)) && ((m_canvas
->GetWindowStyleFlag() & wxUSER_COLOURS
) != wxUSER_COLOURS
))
1049 customColours
= FALSE
;
1053 // HBRUSH br = (m_backgroundBrush.GetStyle()==wxTRANSPARENT) ?
1054 // GetStockObject(NULL_BRUSH) : (HBRUSH) m_backgroundBrush.GetResourceHandle();
1055 if (m_backgroundBrush
.GetStyle()==wxTRANSPARENT
)
1057 m_canvas
->m_backgroundTransparent
= TRUE
;
1061 m_canvas
->SetBackgroundColour(m_backgroundBrush
.GetColour());
1062 m_canvas
->m_backgroundTransparent
= FALSE
;
1068 COLORREF new_color
= m_backgroundBrush
.GetColour().GetPixel() ;
1070 (void)SetBkColor((HDC
) m_hDC
, new_color
);
1076 void wxDC::SetBackgroundMode(int mode
)
1078 m_backgroundMode
= mode
;
1082 if (m_backgroundMode
== wxTRANSPARENT
)
1083 ::SetBkMode((HDC
) m_hDC
, TRANSPARENT
);
1085 ::SetBkMode((HDC
) m_hDC
, OPAQUE
);
1090 void wxDC::SetLogicalFunction(int function
)
1092 m_logicalFunction
= function
;
1096 SetRop((WXHDC
) m_hDC
);
1101 void wxDC::SetRop(WXHDC dc
)
1103 if (!dc
|| m_logicalFunction
< 0)
1107 // These may be wrong
1108 switch (m_logicalFunction
)
1110 // case wxXOR: c_rop = R2_XORPEN; break;
1111 case wxXOR
: c_rop
= R2_NOTXORPEN
; break;
1112 case wxINVERT
: c_rop
= R2_NOT
; break;
1113 case wxOR_REVERSE
: c_rop
= R2_MERGEPENNOT
; break;
1114 case wxAND_REVERSE
: c_rop
= R2_MASKPENNOT
; break;
1115 case wxCLEAR
: c_rop
= R2_WHITE
; break;
1116 case wxSET
: c_rop
= R2_BLACK
; break;
1117 case wxSRC_INVERT
: c_rop
= R2_NOTCOPYPEN
; break;
1118 case wxOR_INVERT
: c_rop
= R2_MERGENOTPEN
; break;
1119 case wxAND
: c_rop
= R2_MASKPEN
; break;
1120 case wxOR
: c_rop
= R2_MERGEPEN
; break;
1121 case wxAND_INVERT
: c_rop
= R2_MASKNOTPEN
; break;
1126 c_rop
= R2_COPYPEN
; break;
1128 SetROP2((HDC
) dc
, c_rop
);
1131 bool wxDC::StartDoc(const wxString
& message
)
1133 if (!this->IsKindOf(CLASSINFO(wxPrinterDC
)))
1139 docinfo
.cbSize
= sizeof(DOCINFO
);
1140 docinfo
.lpszDocName
= (const char *)message
;
1141 docinfo
.lpszOutput
= (const char *)m_filename
;
1142 #if defined(__WIN95__)
1143 docinfo
.lpszDatatype
= NULL
;
1147 if (m_hDC
) flag
= (SP_ERROR
!=
1149 ::StartDoc((HDC
) m_hDC
, &docinfo
));
1152 ::StartDocW((HDC
) m_hDC
, &docinfo
));
1154 ::StartDocA((HDC
) m_hDC
, &docinfo
));
1163 void wxDC::EndDoc(void)
1165 if (!this->IsKindOf(CLASSINFO(wxPrinterDC
)))
1167 if (m_hDC
) ::EndDoc((HDC
) m_hDC
);
1170 void wxDC::StartPage(void)
1172 if (!this->IsKindOf(CLASSINFO(wxPrinterDC
)))
1175 ::StartPage((HDC
) m_hDC
);
1178 void wxDC::EndPage(void)
1180 if (!this->IsKindOf(CLASSINFO(wxPrinterDC
)))
1183 ::EndPage((HDC
) m_hDC
);
1186 long wxDC::GetCharHeight(void) const
1188 TEXTMETRIC lpTextMetric
;
1190 GetTextMetrics((HDC
) m_hDC
, &lpTextMetric
);
1192 return YDEV2LOGREL(lpTextMetric
.tmHeight
);
1195 long wxDC::GetCharWidth(void) const
1197 TEXTMETRIC lpTextMetric
;
1199 GetTextMetrics((HDC
) m_hDC
, &lpTextMetric
);
1201 return XDEV2LOGREL(lpTextMetric
.tmAveCharWidth
);
1204 void wxDC::GetTextExtent(const wxString
& string
, long *x
, long *y
,
1205 long *descent
, long *externalLeading
, wxFont
*theFont
, bool use16bit
) const
1207 wxFont
*fontToUse
= (wxFont
*) theFont
;
1209 fontToUse
= (wxFont
*) &m_font
;
1214 GetTextExtentPoint((HDC
) m_hDC
, (char *)(const char *) string
, strlen((char *)(const char *) string
), &sizeRect
);
1215 GetTextMetrics((HDC
) m_hDC
, &tm
);
1217 *x
= XDEV2LOGREL(sizeRect
.cx
);
1218 *y
= YDEV2LOGREL(sizeRect
.cy
);
1219 if (descent
) *descent
= tm
.tmDescent
;
1220 if (externalLeading
) *externalLeading
= tm
.tmExternalLeading
;
1223 void wxDC::SetMapMode(int mode
)
1225 m_mappingMode
= mode
;
1227 int pixel_width
= 0;
1228 int pixel_height
= 0;
1234 pixel_width
= GetDeviceCaps((HDC
) m_hDC
, HORZRES
);
1235 pixel_height
= GetDeviceCaps((HDC
) m_hDC
, VERTRES
);
1236 mm_width
= GetDeviceCaps((HDC
) m_hDC
, HORZSIZE
);
1237 mm_height
= GetDeviceCaps((HDC
) m_hDC
, VERTSIZE
);
1239 if ((pixel_width
== 0) || (pixel_height
== 0) || (mm_width
== 0) || (mm_height
== 0))
1241 // if (!m_hDC && m_canvas)
1242 // m_canvas->ReleaseHDC() ;
1246 double mm2pixelsX
= pixel_width
/mm_width
;
1247 double mm2pixelsY
= pixel_height
/mm_height
;
1253 m_logicalScaleX
= (twips2mm
* mm2pixelsX
);
1254 m_logicalScaleY
= (twips2mm
* mm2pixelsY
);
1259 m_logicalScaleX
= (pt2mm
* mm2pixelsX
);
1260 m_logicalScaleY
= (pt2mm
* mm2pixelsY
);
1265 m_logicalScaleX
= mm2pixelsX
;
1266 m_logicalScaleY
= mm2pixelsY
;
1271 m_logicalScaleX
= (mm2pixelsX
/10.0);
1272 m_logicalScaleY
= (mm2pixelsY
/10.0);
1278 m_logicalScaleX
= 1.0;
1279 m_logicalScaleY
= 1.0;
1284 if (::GetMapMode((HDC
) m_hDC
) != MM_ANISOTROPIC
)
1285 ::SetMapMode((HDC
) m_hDC
, MM_ANISOTROPIC
);
1287 SetViewportExtEx((HDC
) m_hDC
, VIEWPORT_EXTENT
, VIEWPORT_EXTENT
, NULL
);
1288 m_windowExtX
= (int)MS_XDEV2LOGREL(VIEWPORT_EXTENT
);
1289 m_windowExtY
= (int)MS_YDEV2LOGREL(VIEWPORT_EXTENT
);
1290 ::SetWindowExtEx((HDC
) m_hDC
, m_windowExtX
, m_windowExtY
, NULL
);
1291 ::SetViewportOrgEx((HDC
) m_hDC
, (int)m_deviceOriginX
, (int)m_deviceOriginY
, NULL
);
1292 ::SetWindowOrgEx((HDC
) m_hDC
, (int)m_logicalOriginX
, (int)m_logicalOriginY
, NULL
);
1297 void wxDC::SetUserScale(double x
, double y
)
1302 SetMapMode(m_mappingMode
);
1305 void wxDC::SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
1307 m_signX
= xLeftRight
? 1 : -1;
1308 m_signY
= yBottomUp
? -1 : 1;
1310 SetMapMode(m_mappingMode
);
1313 void wxDC::SetSystemScale(double x
, double y
)
1318 SetMapMode(m_mappingMode
);
1321 void wxDC::SetLogicalOrigin(long x
, long y
)
1323 m_logicalOriginX
= x
;
1324 m_logicalOriginY
= y
;
1328 ::SetWindowOrgEx((HDC
) m_hDC
, (int)m_logicalOriginX
, (int)m_logicalOriginY
, NULL
);
1333 void wxDC::SetDeviceOrigin(long x
, long y
)
1335 m_deviceOriginX
= x
;
1336 m_deviceOriginY
= y
;
1340 ::SetViewportOrgEx((HDC
) m_hDC
, (int)m_deviceOriginX
, (int)m_deviceOriginY
, NULL
);
1345 long wxDC::DeviceToLogicalX(long x
) const
1347 return (long) (((x
) - m_deviceOriginX
)/(m_logicalScaleX
*m_userScaleX
*m_signX
*m_systemScaleX
) - m_logicalOriginX
) ;
1350 long wxDC::DeviceToLogicalXRel(long x
) const
1352 return (long) ((x
)/(m_logicalScaleX
*m_userScaleX
*m_signX
*m_systemScaleX
)) ;
1355 long wxDC::DeviceToLogicalY(long y
) const
1357 return (long) (((y
) - m_deviceOriginY
)/(m_logicalScaleY
*m_userScaleY
*m_signY
*m_systemScaleY
) - m_logicalOriginY
) ;
1360 long wxDC::DeviceToLogicalYRel(long y
) const
1362 return (long) ((y
)/(m_logicalScaleY
*m_userScaleY
*m_signY
*m_systemScaleY
)) ;
1365 long wxDC::LogicalToDeviceX(long x
) const
1367 return (long) (floor((x
) - m_logicalOriginX
)*m_logicalScaleX
*m_userScaleX
*m_signX
*m_systemScaleX
+ m_deviceOriginX
) ;
1370 long wxDC::LogicalToDeviceXRel(long x
) const
1372 return (long) (floor(x
)*m_logicalScaleX
*m_userScaleX
*m_signX
*m_systemScaleX
) ;
1375 long wxDC::LogicalToDeviceY(long y
) const
1377 return (long) (floor((y
) - m_logicalOriginY
)*m_logicalScaleY
*m_userScaleY
*m_signY
*m_systemScaleY
+ m_deviceOriginY
);
1380 long wxDC::LogicalToDeviceYRel(long y
) const
1382 return (long) (floor(y
)*m_logicalScaleY
*m_userScaleY
*m_signY
*m_systemScaleY
) ;
1385 // This group of functions may not do any conversion
1386 // if m_scaleGDI is TRUE, since the HDC does the
1387 // conversion automatically.
1389 long wxDC::ImplDeviceToLogicalX(long x
) const
1391 // return (m_scaleGDI ? x : DeviceToLogicalX(x));
1395 long wxDC::ImplDeviceToLogicalY(long y
) const
1397 // return (m_scaleGDI ? y : DeviceToLogicalY(y));
1401 long wxDC::ImplDeviceToLogicalXRel(long x
) const
1403 // return (m_scaleGDI ? x : DeviceToLogicalXRel(x));
1407 long wxDC::ImplDeviceToLogicalYRel(long y
) const
1409 // return (m_scaleGDI ? y : DeviceToLogicalYRel(y));
1413 long wxDC::ImplLogicalToDeviceX(long x
) const
1415 // return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceX(x));
1419 long wxDC::ImplLogicalToDeviceY(long y
) const
1421 // return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceY(y));
1425 long wxDC::ImplLogicalToDeviceXRel(long x
) const
1427 // return (m_scaleGDI ? (floor(double(x))) : LogicalToDeviceXRel(x));
1431 long wxDC::ImplLogicalToDeviceYRel(long y
) const
1433 // return (m_scaleGDI ? (floor(double(y))) : LogicalToDeviceYRel(y));
1437 bool wxDC::Blit(long xdest
, long ydest
, long width
, long height
,
1438 wxDC
*source
, long xsrc
, long ysrc
, int rop
, bool useMask
)
1441 source
->BeginDrawing();
1443 long xdest1
= xdest
;
1444 long ydest1
= ydest
;
1448 // Chris Breeze 18/5/98: use text foreground/background colours
1449 // when blitting from 1-bit bitmaps
1450 COLORREF old_textground
= ::GetTextColor((HDC
)m_hDC
);
1451 COLORREF old_background
= ::GetBkColor((HDC
)m_hDC
);
1452 if (m_textForegroundColour
.Ok())
1454 ::SetTextColor((HDC
) m_hDC
, m_textForegroundColour
.GetPixel() ) ;
1456 if (m_textBackgroundColour
.Ok())
1458 ::SetBkColor((HDC
) m_hDC
, m_textBackgroundColour
.GetPixel() ) ;
1461 DWORD dwRop
= rop
== wxCOPY
? SRCCOPY
:
1462 rop
== wxCLEAR
? WHITENESS
:
1463 rop
== wxSET
? BLACKNESS
:
1464 rop
== wxINVERT
? DSTINVERT
:
1465 rop
== wxAND
? MERGECOPY
:
1466 rop
== wxOR
? MERGEPAINT
:
1467 rop
== wxSRC_INVERT
? NOTSRCCOPY
:
1468 rop
== wxXOR
? SRCINVERT
:
1469 rop
== wxOR_REVERSE
? MERGEPAINT
:
1470 rop
== wxAND_REVERSE
? SRCERASE
:
1471 rop
== wxSRC_OR
? SRCPAINT
:
1472 rop
== wxSRC_AND
? SRCAND
:
1476 if (useMask
&& source
->m_selectedBitmap
.Ok() && source
->m_selectedBitmap
.GetMask())
1480 // Not implemented under Win95 (or maybe a specific device?)
1481 if (MaskBlt((HDC
) m_hDC
, xdest1
, ydest1
, (int)width
, (int)height
,
1482 (HDC
) source
->m_hDC
, xsrc1
, ysrc1
, (HBITMAP
) source
->m_selectedBitmap
.GetMask()->GetMaskBitmap(),
1492 HDC dc_mask
= CreateCompatibleDC((HDC
) source
->m_hDC
);
1493 ::SelectObject(dc_mask
, (HBITMAP
) source
->m_selectedBitmap
.GetMask()->GetMaskBitmap());
1494 success
= (BitBlt((HDC
) m_hDC
, xdest1
, ydest1
, (int)width
, (int)height
,
1495 dc_mask
, xsrc1
, ysrc1
, 0x00220326 /* NOTSRCAND */) != 0);
1496 success
= (BitBlt((HDC
) m_hDC
, xdest1
, ydest1
, (int)width
, (int)height
,
1497 (HDC
) source
->m_hDC
, xsrc1
, ysrc1
, SRCPAINT
) != 0);
1498 ::SelectObject(dc_mask
, 0);
1499 ::DeleteDC(dc_mask
);
1501 // New code from Chris Breeze, 8/5/98
1503 // create a temp buffer bitmap and DCs to access it and the mask
1504 HDC dc_mask
= ::CreateCompatibleDC((HDC
) source
->m_hDC
);
1505 HDC dc_buffer
= ::CreateCompatibleDC((HDC
) m_hDC
);
1506 HBITMAP buffer_bmap
= ::CreateCompatibleBitmap((HDC
) m_hDC
, width
, height
);
1507 ::SelectObject(dc_mask
, (HBITMAP
) source
->m_selectedBitmap
.GetMask()->GetMaskBitmap());
1508 ::SelectObject(dc_buffer
, buffer_bmap
);
1510 // copy dest to buffer
1511 ::BitBlt(dc_buffer
, 0, 0, (int)width
, (int)height
,
1512 (HDC
) m_hDC
, xdest1
, ydest1
, SRCCOPY
);
1514 // copy src to buffer using selected raster op
1515 ::BitBlt(dc_buffer
, 0, 0, (int)width
, (int)height
,
1516 (HDC
) source
->m_hDC
, xsrc1
, ysrc1
, dwRop
);
1518 // set masked area in buffer to BLACK (pixel value 0)
1519 COLORREF prevBkCol
= ::SetBkColor((HDC
) m_hDC
, RGB(255, 255, 255));
1520 COLORREF prevCol
= ::SetTextColor((HDC
) m_hDC
, RGB(0, 0, 0));
1521 ::BitBlt(dc_buffer
, 0, 0, (int)width
, (int)height
,
1522 dc_mask
, xsrc1
, ysrc1
, SRCAND
);
1524 // set unmasked area in dest to BLACK
1525 ::SetBkColor((HDC
) m_hDC
, RGB(0, 0, 0));
1526 ::SetTextColor((HDC
) m_hDC
, RGB(255, 255, 255));
1527 ::BitBlt((HDC
) m_hDC
, xdest1
, ydest1
, (int)width
, (int)height
,
1528 dc_mask
, xsrc1
, ysrc1
, SRCAND
);
1529 ::SetBkColor((HDC
) m_hDC
, prevBkCol
); // restore colours to original values
1530 ::SetTextColor((HDC
) m_hDC
, prevCol
);
1532 // OR buffer to dest
1533 success
= (::BitBlt((HDC
) m_hDC
, xdest1
, ydest1
, (int)width
, (int)height
,
1534 dc_buffer
, 0, 0, SRCPAINT
) != 0);
1536 // tidy up temporary DCs and bitmap
1537 ::SelectObject(dc_mask
, 0);
1538 ::DeleteDC(dc_mask
);
1539 ::SelectObject(dc_buffer
, 0);
1540 ::DeleteDC(dc_buffer
);
1541 ::DeleteObject(buffer_bmap
);
1546 success
= (BitBlt((HDC
) m_hDC
, xdest1
, ydest1
, (int)width
, (int)height
, (HDC
) source
->m_hDC
,
1547 xsrc1
, ysrc1
, dwRop
) != 0);
1549 ::SetTextColor((HDC
)m_hDC
, old_textground
);
1550 ::SetBkColor((HDC
)m_hDC
, old_background
);
1551 source
->EndDrawing();
1557 void wxDC::GetSize(int* width
, int* height
) const
1559 long w
=::GetDeviceCaps((HDC
) m_hDC
,HORZRES
);
1560 long h
=::GetDeviceCaps((HDC
) m_hDC
,VERTRES
);
1565 void wxDC::GetSizeMM(long *width
, long *height
) const
1567 long w
=::GetDeviceCaps((HDC
) m_hDC
,HORZSIZE
);
1568 long h
=::GetDeviceCaps((HDC
) m_hDC
,VERTSIZE
);
1575 # if USE_XFIG_SPLINE_CODE
1576 # include "../common/xfspline.inc"
1578 # include "../common/wxspline.inc"
1580 #endif // USE_SPLINES
1584 #include "xfspline.inc"
1585 #endif // USE_SPLINES
1587 void wxDC::DrawPolygon(wxList
*list
, long xoffset
, long yoffset
,int fillStyle
)
1589 int n
= list
->Number();
1590 wxPoint
*points
= new wxPoint
[n
];
1593 for(wxNode
*node
= list
->First(); node
; node
= node
->Next()) {
1594 wxPoint
*point
= (wxPoint
*)node
->Data();
1595 points
[i
].x
= point
->x
;
1596 points
[i
++].y
= point
->y
;
1598 DrawPolygon(n
, points
, xoffset
, yoffset
,fillStyle
);
1602 void wxDC::DrawLines(wxList
*list
, long xoffset
, long yoffset
)
1604 int n
= list
->Number();
1605 wxPoint
*points
= new wxPoint
[n
];
1608 for(wxNode
*node
= list
->First(); node
; node
= node
->Next()) {
1609 wxPoint
*point
= (wxPoint
*)node
->Data();
1610 points
[i
].x
= point
->x
;
1611 points
[i
++].y
= point
->y
;
1613 DrawLines(n
, points
, xoffset
, yoffset
);
1617 void wxDC::SetTextForeground(const wxColour
& colour
)
1619 m_textForegroundColour
= colour
;
1622 void wxDC::SetTextBackground(const wxColour
& colour
)
1624 m_textBackgroundColour
= colour
;
1628 // Make a 3-point spline
1629 void wxDC::DrawSpline(long x1
, long y1
, long x2
, long y2
, long x3
, long y3
)
1631 wxList
*point_list
= new wxList
;
1633 wxPoint
*point1
= new wxPoint
;
1634 point1
->x
= x1
; point1
->y
= y1
;
1635 point_list
->Append((wxObject
*)point1
);
1637 wxPoint
*point2
= new wxPoint
;
1638 point2
->x
= x2
; point2
->y
= y2
;
1639 point_list
->Append((wxObject
*)point2
);
1641 wxPoint
*point3
= new wxPoint
;
1642 point3
->x
= x3
; point3
->y
= y3
;
1643 point_list
->Append((wxObject
*)point3
);
1645 DrawSpline(point_list
);
1647 for(wxNode
*node
= point_list
->First(); node
; node
= node
->Next()) {
1648 wxPoint
*p
= (wxPoint
*)node
->Data();
1653 wxSpline spline(point_list);
1655 wx_draw_open_spline(this, &spline);
1656 spline.DeletePoints();
1661 // For use by wxWindows only, unless custom units are required.
1662 void wxDC::SetLogicalScale(double x
, double y
)
1664 m_logicalScaleX
= x
;
1665 m_logicalScaleY
= y
;
1668 void wxDC::CalcBoundingBox(long x
, long y
)
1670 if (x
< m_minX
) m_minX
= x
;
1671 if (y
< m_minY
) m_minY
= y
;
1672 if (x
> m_maxX
) m_maxX
= x
;
1673 if (y
> m_maxY
) m_maxY
= y
;
1676 void wxDC::GetClippingBox(long *x
,long *y
,long *w
,long *h
) const
1682 *w
= (m_clipX2
- m_clipX1
) ;
1683 *h
= (m_clipY2
- m_clipY1
) ;
1686 *x
= *y
= *w
= *h
= 0 ;
1689 #if WXWIN_COMPATIBILITY
1690 void wxDC::GetTextExtent(const wxString
& string
, float *x
, float *y
,
1691 float *descent
, float *externalLeading
,
1692 wxFont
*theFont
, bool use16bit
) const
1694 long x1
, y1
, descent1
, externalLeading1
;
1695 GetTextExtent(string
, & x1
, & y1
, & descent1
, & externalLeading1
, theFont
, use16bit
);
1698 *descent
= descent1
;
1699 if (externalLeading
)
1700 *externalLeading
= externalLeading1
;