1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DC_H_BASE_
13 #define _WX_DC_H_BASE_
15 // ----------------------------------------------------------------------------
16 // headers which we must include here
17 // ----------------------------------------------------------------------------
19 #include "wx/object.h" // the base class
21 #include "wx/intl.h" // for wxLayoutDirection
22 #include "wx/cursor.h" // we have member variables of these classes
23 #include "wx/font.h" // so we can't do without them
24 #include "wx/colour.h"
25 #include "wx/bitmap.h" // for wxNullBitmap
28 #include "wx/palette.h"
29 #include "wx/dynarray.h"
32 #include "wx/cmndata.h"
34 #define wxUSE_NEW_DC 1
36 class WXDLLIMPEXP_FWD_CORE wxDC
;
37 class WXDLLIMPEXP_FWD_CORE wxClientDC
;
38 class WXDLLIMPEXP_FWD_CORE wxPaintDC
;
39 class WXDLLIMPEXP_FWD_CORE wxWindowDC
;
40 class WXDLLIMPEXP_FWD_CORE wxScreenDC
;
41 class WXDLLIMPEXP_FWD_CORE wxMemoryDC
;
42 class WXDLLIMPEXP_FWD_CORE wxPrinterDC
;
43 class WXDLLIMPEXP_FWD_CORE wxPrintData
;
46 enum wxRasterOperationMode
51 wxOR_REVERSE
, // src OR (NOT dst)
52 wxAND_REVERSE
, // src AND (NOT dst)
55 wxAND_INVERT
, // (NOT src) AND dst
57 wxNOR
, // (NOT src) AND (NOT dst)
58 wxEQUIV
, // (NOT src) XOR dst
59 wxSRC_INVERT
, // (NOT src)
60 wxOR_INVERT
, // (NOT src) OR dst
61 wxNAND
, // (NOT src) OR (NOT dst)
64 #if WXWIN_COMPATIBILITY_2_8
65 ,wxROP_BLACK
= wxCLEAR
,
66 wxBLIT_BLACKNESS
= wxCLEAR
,
68 wxBLIT_SRCINVERT
= wxXOR
,
70 wxBLIT_DSTINVERT
= wxINVERT
,
71 wxROP_MERGEPENNOT
= wxOR_REVERSE
,
72 wxBLIT_00DD0228
= wxOR_REVERSE
,
73 wxROP_MASKPENNOT
= wxAND_REVERSE
,
74 wxBLIT_SRCERASE
= wxAND_REVERSE
,
75 wxROP_COPYPEN
= wxCOPY
,
76 wxBLIT_SRCCOPY
= wxCOPY
,
77 wxROP_MASKPEN
= wxAND
,
78 wxBLIT_SRCAND
= wxAND
,
79 wxROP_MASKNOTPEN
= wxAND_INVERT
,
80 wxBLIT_00220326
= wxAND_INVERT
,
82 wxBLIT_00AA0029
= wxNO_OP
,
83 wxROP_NOTMERGEPEN
= wxNOR
,
84 wxBLIT_NOTSRCERASE
= wxNOR
,
85 wxROP_NOTXORPEN
= wxEQUIV
,
86 wxBLIT_00990066
= wxEQUIV
,
87 wxROP_NOTCOPYPEN
= wxSRC_INVERT
,
88 wxBLIT_NOTSCRCOPY
= wxSRC_INVERT
,
89 wxROP_MERGENOTPEN
= wxOR_INVERT
,
90 wxBLIT_MERGEPAINT
= wxOR_INVERT
,
91 wxROP_NOTMASKPEN
= wxNAND
,
92 wxBLIT_007700E6
= wxNAND
,
93 wxROP_MERGEPEN
= wxOR
,
94 wxBLIT_SRCPAINT
= wxOR
,
96 wxBLIT_WHITENESS
= wxSET
97 #endif //WXWIN_COMPATIBILITY_2_8
101 enum wxFloodFillStyle
107 // Mapping modes (same values as used by Windows, don't change)
122 #if WXWIN_COMPATIBILITY_2_8
124 //-----------------------------------------------------------------------------
125 // wxDrawObject helper class
126 //-----------------------------------------------------------------------------
128 class WXDLLIMPEXP_CORE wxDrawObject
131 wxDEPRECATED_CONSTRUCTOR(wxDrawObject
)()
132 : m_isBBoxValid(false)
133 , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
136 virtual ~wxDrawObject() { }
138 virtual void Draw(wxDC
&) const { }
140 virtual void CalcBoundingBox(wxCoord x
, wxCoord y
)
144 if ( x
< m_minX
) m_minX
= x
;
145 if ( y
< m_minY
) m_minY
= y
;
146 if ( x
> m_maxX
) m_maxX
= x
;
147 if ( y
> m_maxY
) m_maxY
= y
;
151 m_isBBoxValid
= true;
160 void ResetBoundingBox()
162 m_isBBoxValid
= false;
164 m_minX
= m_maxX
= m_minY
= m_maxY
= 0;
167 // Get the final bounding box of the PostScript or Metafile picture.
169 wxCoord
MinX() const { return m_minX
; }
170 wxCoord
MaxX() const { return m_maxX
; }
171 wxCoord
MinY() const { return m_minY
; }
172 wxCoord
MaxY() const { return m_maxY
; }
174 //to define the type of object for derived objects
175 virtual int GetType()=0;
178 //for boundingbox calculation
179 bool m_isBBoxValid
:1;
180 //for boundingbox calculation
181 wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
;
184 #endif // WXWIN_COMPATIBILITY_2_8
187 //-----------------------------------------------------------------------------
189 //-----------------------------------------------------------------------------
191 class WXDLLIMPEXP_FWD_CORE wxDCImpl
;
193 class WXDLLIMPEXP_CORE wxDCFactory
197 virtual ~wxDCFactory() {}
199 virtual wxDCImpl
* CreateWindowDC( wxWindowDC
*owner
, wxWindow
*window
) = 0;
200 virtual wxDCImpl
* CreateClientDC( wxClientDC
*owner
, wxWindow
*window
) = 0;
201 virtual wxDCImpl
* CreatePaintDC( wxPaintDC
*owner
, wxWindow
*window
) = 0;
202 virtual wxDCImpl
* CreateMemoryDC( wxMemoryDC
*owner
) = 0;
203 virtual wxDCImpl
* CreateMemoryDC( wxMemoryDC
*owner
, wxBitmap
&bitmap
) = 0;
204 virtual wxDCImpl
* CreateMemoryDC( wxMemoryDC
*owner
, wxDC
*dc
) = 0;
205 virtual wxDCImpl
* CreateScreenDC( wxScreenDC
*owner
) = 0;
206 #if wxUSE_PRINTING_ARCHITECTURE
207 virtual wxDCImpl
* CreatePrinterDC( wxPrinterDC
*owner
, const wxPrintData
&data
) = 0;
210 static void Set(wxDCFactory
*factory
);
211 static wxDCFactory
*Get();
214 static wxDCFactory
*m_factory
;
217 //-----------------------------------------------------------------------------
219 //-----------------------------------------------------------------------------
221 class WXDLLIMPEXP_CORE wxNativeDCFactory
: public wxDCFactory
224 wxNativeDCFactory() {}
226 virtual wxDCImpl
* CreateWindowDC( wxWindowDC
*owner
, wxWindow
*window
);
227 virtual wxDCImpl
* CreateClientDC( wxClientDC
*owner
, wxWindow
*window
);
228 virtual wxDCImpl
* CreatePaintDC( wxPaintDC
*owner
, wxWindow
*window
);
229 virtual wxDCImpl
* CreateMemoryDC( wxMemoryDC
*owner
);
230 virtual wxDCImpl
* CreateMemoryDC( wxMemoryDC
*owner
, wxBitmap
&bitmap
);
231 virtual wxDCImpl
* CreateMemoryDC( wxMemoryDC
*owner
, wxDC
*dc
);
232 virtual wxDCImpl
* CreateScreenDC( wxScreenDC
*owner
);
233 #if wxUSE_PRINTING_ARCHITECTURE
234 virtual wxDCImpl
* CreatePrinterDC( wxPrinterDC
*owner
, const wxPrintData
&data
);
238 //-----------------------------------------------------------------------------
240 //-----------------------------------------------------------------------------
242 class WXDLLIMPEXP_CORE wxDCImpl
: public wxObject
245 wxDCImpl( wxDC
*owner
);
248 wxDC
*GetOwner() const { return m_owner
; }
250 wxWindow
* GetWindow() const { return m_window
; }
252 virtual bool IsOk() const { return m_ok
; }
254 // query capabilities
256 virtual bool CanDrawBitmap() const = 0;
257 virtual bool CanGetTextExtent() const = 0;
260 virtual void* GetCairoContext() const
265 // query dimension, colour deps, resolution
267 virtual void DoGetSize(int *width
, int *height
) const = 0;
268 void GetSize(int *width
, int *height
) const
270 DoGetSize(width
, height
);
274 wxSize
GetSize() const
281 virtual void DoGetSizeMM(int* width
, int* height
) const = 0;
283 virtual int GetDepth() const = 0;
284 virtual wxSize
GetPPI() const = 0;
286 // Right-To-Left (RTL) modes
288 virtual void SetLayoutDirection(wxLayoutDirection
WXUNUSED(dir
)) { }
289 virtual wxLayoutDirection
GetLayoutDirection() const { return wxLayout_Default
; }
293 virtual bool StartDoc(const wxString
& WXUNUSED(message
)) { return true; }
294 virtual void EndDoc() { }
296 virtual void StartPage() { }
297 virtual void EndPage() { }
299 // flushing the content of this dc immediately eg onto screen
300 virtual void Flush() { }
304 virtual void CalcBoundingBox(wxCoord x
, wxCoord y
)
308 if ( x
< m_minX
) m_minX
= x
;
309 if ( y
< m_minY
) m_minY
= y
;
310 if ( x
> m_maxX
) m_maxX
= x
;
311 if ( y
> m_maxY
) m_maxY
= y
;
315 m_isBBoxValid
= true;
323 void ResetBoundingBox()
325 m_isBBoxValid
= false;
327 m_minX
= m_maxX
= m_minY
= m_maxY
= 0;
330 wxCoord
MinX() const { return m_minX
; }
331 wxCoord
MaxX() const { return m_maxX
; }
332 wxCoord
MinY() const { return m_minY
; }
333 wxCoord
MaxY() const { return m_maxY
; }
335 // setters and getters
337 virtual void SetFont(const wxFont
& font
) = 0;
338 virtual const wxFont
& GetFont() const { return m_font
; }
340 virtual void SetPen(const wxPen
& pen
) = 0;
341 virtual const wxPen
& GetPen() const { return m_pen
; }
343 virtual void SetBrush(const wxBrush
& brush
) = 0;
344 virtual const wxBrush
& GetBrush() const { return m_brush
; }
346 virtual void SetBackground(const wxBrush
& brush
) = 0;
347 virtual const wxBrush
& GetBackground() const { return m_backgroundBrush
; }
349 virtual void SetBackgroundMode(int mode
) = 0;
350 virtual int GetBackgroundMode() const { return m_backgroundMode
; }
352 virtual void SetTextForeground(const wxColour
& colour
)
353 { m_textForegroundColour
= colour
; }
354 virtual const wxColour
& GetTextForeground() const
355 { return m_textForegroundColour
; }
357 virtual void SetTextBackground(const wxColour
& colour
)
358 { m_textBackgroundColour
= colour
; }
359 virtual const wxColour
& GetTextBackground() const
360 { return m_textBackgroundColour
; }
363 virtual void SetPalette(const wxPalette
& palette
) = 0;
364 #endif // wxUSE_PALETTE
366 // inherit the DC attributes (font and colours) from the given window
368 // this is called automatically when a window, client or paint DC is
370 virtual void InheritAttributes(wxWindow
*win
);
375 virtual void SetLogicalFunction(wxRasterOperationMode function
) = 0;
376 virtual wxRasterOperationMode
GetLogicalFunction() const
377 { return m_logicalFunction
; }
381 virtual wxCoord
GetCharHeight() const = 0;
382 virtual wxCoord
GetCharWidth() const = 0;
383 virtual void DoGetTextExtent(const wxString
& string
,
384 wxCoord
*x
, wxCoord
*y
,
385 wxCoord
*descent
= NULL
,
386 wxCoord
*externalLeading
= NULL
,
387 const wxFont
*theFont
= NULL
) const = 0;
388 virtual void GetMultiLineTextExtent(const wxString
& string
,
391 wxCoord
*heightLine
= NULL
,
392 const wxFont
*font
= NULL
) const;
393 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
397 virtual void Clear() = 0;
401 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
402 wxCoord width
, wxCoord height
) = 0;
404 // NB: this function works with device coordinates, not the logical ones!
405 virtual void DoSetDeviceClippingRegion(const wxRegion
& region
) = 0;
407 virtual void DoGetClippingBox(wxCoord
*x
, wxCoord
*y
,
408 wxCoord
*w
, wxCoord
*h
) const
415 *w
= m_clipX2
- m_clipX1
;
417 *h
= m_clipY2
- m_clipY1
;
420 virtual void DestroyClippingRegion() { ResetClipping(); }
423 // coordinates conversions and transforms
425 virtual wxCoord
DeviceToLogicalX(wxCoord x
) const;
426 virtual wxCoord
DeviceToLogicalY(wxCoord y
) const;
427 virtual wxCoord
DeviceToLogicalXRel(wxCoord x
) const;
428 virtual wxCoord
DeviceToLogicalYRel(wxCoord y
) const;
429 virtual wxCoord
LogicalToDeviceX(wxCoord x
) const;
430 virtual wxCoord
LogicalToDeviceY(wxCoord y
) const;
431 virtual wxCoord
LogicalToDeviceXRel(wxCoord x
) const;
432 virtual wxCoord
LogicalToDeviceYRel(wxCoord y
) const;
434 virtual void SetMapMode(wxMappingMode mode
);
435 virtual wxMappingMode
GetMapMode() const { return m_mappingMode
; }
437 virtual void SetUserScale(double x
, double y
);
438 virtual void GetUserScale(double *x
, double *y
) const
440 if ( x
) *x
= m_userScaleX
;
441 if ( y
) *y
= m_userScaleY
;
444 virtual void SetLogicalScale(double x
, double y
);
445 virtual void GetLogicalScale(double *x
, double *y
)
447 if ( x
) *x
= m_logicalScaleX
;
448 if ( y
) *y
= m_logicalScaleY
;
451 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
452 virtual void DoGetLogicalOrigin(wxCoord
*x
, wxCoord
*y
) const
454 if ( x
) *x
= m_logicalOriginX
;
455 if ( y
) *y
= m_logicalOriginY
;
458 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
459 virtual void DoGetDeviceOrigin(wxCoord
*x
, wxCoord
*y
) const
461 if ( x
) *x
= m_deviceOriginX
;
462 if ( y
) *y
= m_deviceOriginY
;
465 virtual void SetDeviceLocalOrigin( wxCoord x
, wxCoord y
);
467 virtual void ComputeScaleAndOrigin();
469 // this needs to overidden if the axis is inverted
470 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
472 // ---------------------------------------------------------
473 // the actual drawing API
475 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
476 wxFloodFillStyle style
= wxFLOOD_SURFACE
) = 0;
478 virtual void DoGradientFillLinear(const wxRect
& rect
,
479 const wxColour
& initialColour
,
480 const wxColour
& destColour
,
481 wxDirection nDirection
= wxEAST
);
483 virtual void DoGradientFillConcentric(const wxRect
& rect
,
484 const wxColour
& initialColour
,
485 const wxColour
& destColour
,
486 const wxPoint
& circleCenter
);
488 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const = 0;
490 virtual void DoDrawPoint(wxCoord x
, wxCoord y
) = 0;
491 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) = 0;
493 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
494 wxCoord x2
, wxCoord y2
,
495 wxCoord xc
, wxCoord yc
) = 0;
496 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
,
497 wxCoord width
, wxCoord height
);
498 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
499 double sa
, double ea
) = 0;
501 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) = 0;
502 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
503 wxCoord width
, wxCoord height
,
505 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
,
506 wxCoord width
, wxCoord height
) = 0;
508 virtual void DoCrossHair(wxCoord x
, wxCoord y
) = 0;
510 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) = 0;
511 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
512 bool useMask
= false) = 0;
514 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
) = 0;
515 virtual void DoDrawRotatedText(const wxString
& text
,
516 wxCoord x
, wxCoord y
, double angle
) = 0;
518 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
,
519 wxCoord width
, wxCoord height
,
521 wxCoord xsrc
, wxCoord ysrc
,
522 wxRasterOperationMode rop
= wxCOPY
,
523 bool useMask
= false,
524 wxCoord xsrcMask
= wxDefaultCoord
,
525 wxCoord ysrcMask
= wxDefaultCoord
) = 0;
527 virtual bool DoStretchBlit(wxCoord xdest
, wxCoord ydest
,
528 wxCoord dstWidth
, wxCoord dstHeight
,
530 wxCoord xsrc
, wxCoord ysrc
,
531 wxCoord srcWidth
, wxCoord srcHeight
,
532 wxRasterOperationMode rop
= wxCOPY
,
533 bool useMask
= false,
534 wxCoord xsrcMask
= wxDefaultCoord
,
535 wxCoord ysrcMask
= wxDefaultCoord
);
537 virtual wxBitmap
DoGetAsBitmap(const wxRect
*WXUNUSED(subrect
)) const
538 { return wxNullBitmap
; }
541 virtual void DoDrawLines(int n
, wxPoint points
[],
542 wxCoord xoffset
, wxCoord yoffset
) = 0;
543 virtual void DrawLines(const wxPointList
*list
,
544 wxCoord xoffset
, wxCoord yoffset
);
546 virtual void DoDrawPolygon(int n
, wxPoint points
[],
547 wxCoord xoffset
, wxCoord yoffset
,
548 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
) = 0;
549 virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[],
550 wxCoord xoffset
, wxCoord yoffset
,
551 wxPolygonFillMode fillStyle
);
552 void DrawPolygon(const wxPointList
*list
,
553 wxCoord xoffset
, wxCoord yoffset
,
554 wxPolygonFillMode fillStyle
);
558 void DrawSpline(wxCoord x1
, wxCoord y1
,
559 wxCoord x2
, wxCoord y2
,
560 wxCoord x3
, wxCoord y3
);
561 void DrawSpline(int n
, wxPoint points
[]);
562 void DrawSpline(const wxPointList
*points
) { DoDrawSpline(points
); }
564 virtual void DoDrawSpline(const wxPointList
*points
);
567 // ---------------------------------------------------------
568 // wxMemoryDC Impl API
570 virtual void DoSelect(const wxBitmap
& WXUNUSED(bmp
))
573 virtual const wxBitmap
& GetSelectedBitmap() const
574 { return wxNullBitmap
; }
575 virtual wxBitmap
& GetSelectedBitmap()
576 { return wxNullBitmap
; }
578 // ---------------------------------------------------------
579 // wxPrinterDC Impl API
581 virtual wxRect
GetPaperRect() const
582 { int w
= 0; int h
= 0; DoGetSize( &w
, &h
); return wxRect(0,0,w
,h
); }
584 virtual int GetResolution() const
591 // unset clipping variables (after clipping region was destroyed)
596 m_clipX1
= m_clipX2
= m_clipY1
= m_clipY2
= 0;
600 //! Generic method to draw ellipses, circles and arcs with current pen and brush.
601 /*! \param x Upper left corner of bounding box.
602 * \param y Upper left corner of bounding box.
603 * \param w Width of bounding box.
604 * \param h Height of bounding box.
605 * \param sa Starting angle of arc
606 * (counterclockwise, start at 3 o'clock, 360 is full circle).
607 * \param ea Ending angle of arc.
608 * \param angle Rotation angle, the Arc will be rotated after
609 * calculating begin and end.
611 void DrawEllipticArcRot( wxCoord x
, wxCoord y
,
612 wxCoord width
, wxCoord height
,
613 double sa
= 0, double ea
= 0, double angle
= 0 )
614 { DoDrawEllipticArcRot( x
, y
, width
, height
, sa
, ea
, angle
); }
616 void DrawEllipticArcRot( const wxPoint
& pt
,
618 double sa
= 0, double ea
= 0, double angle
= 0 )
619 { DoDrawEllipticArcRot( pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
, angle
); }
621 void DrawEllipticArcRot( const wxRect
& rect
,
622 double sa
= 0, double ea
= 0, double angle
= 0 )
623 { DoDrawEllipticArcRot( rect
.x
, rect
.y
, rect
.width
, rect
.height
, sa
, ea
, angle
); }
625 virtual void DoDrawEllipticArcRot( wxCoord x
, wxCoord y
,
626 wxCoord w
, wxCoord h
,
627 double sa
= 0, double ea
= 0, double angle
= 0 );
629 //! Rotates points around center.
630 /*! This is a quite straight method, it calculates in pixels
631 * and so it produces rounding errors.
632 * \param points The points inside will be rotated.
633 * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle).
634 * \param center Center of rotation.
636 void Rotate( wxPointList
* points
, double angle
, wxPoint center
= wxPoint(0,0) );
638 // used by DrawEllipticArcRot
639 // Careful: wxList gets filled with points you have to delete later.
640 void CalculateEllipticPoints( wxPointList
* points
,
641 wxCoord xStart
, wxCoord yStart
,
642 wxCoord w
, wxCoord h
,
643 double sa
, double ea
);
644 #endif // __WXWINCE__
646 // returns adjustment factor for converting wxFont "point size"; in wx
647 // it is point size on screen and needs to be multiplied by this value
648 // for rendering on higher-resolution DCs such as printer ones
649 static float GetFontPointSizeAdjustment(float dpi
);
651 // window on which the DC draws or NULL
658 bool m_isInteractive
:1;
659 bool m_isBBoxValid
:1;
661 // coordinate system variables
663 wxCoord m_logicalOriginX
, m_logicalOriginY
;
664 wxCoord m_deviceOriginX
, m_deviceOriginY
; // Usually 0,0, can be change by user
666 wxCoord m_deviceLocalOriginX
, m_deviceLocalOriginY
; // non-zero if native top-left corner
667 // is not at 0,0. This was the case under
668 // Mac's GrafPorts (coordinate system
669 // used toplevel window's origin) and
670 // e.g. for Postscript, where the native
671 // origin in the bottom left corner.
672 double m_logicalScaleX
, m_logicalScaleY
;
673 double m_userScaleX
, m_userScaleY
;
674 double m_scaleX
, m_scaleY
; // calculated from logical scale and user scale
676 int m_signX
, m_signY
; // Used by SetAxisOrientation() to invert the axes
678 // what is a mm on a screen you don't know the size of?
679 double m_mm_to_pix_x
,
682 // bounding and clipping boxes
683 wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
;
684 wxCoord m_clipX1
, m_clipY1
, m_clipX2
, m_clipY2
;
686 wxRasterOperationMode m_logicalFunction
;
687 int m_backgroundMode
;
688 wxMappingMode m_mappingMode
;
692 wxBrush m_backgroundBrush
;
693 wxColour m_textForegroundColour
;
694 wxColour m_textBackgroundColour
;
699 bool m_hasCustomPalette
;
700 #endif // wxUSE_PALETTE
703 DECLARE_ABSTRACT_CLASS(wxDCImpl
)
707 class WXDLLIMPEXP_CORE wxDC
: public wxObject
710 virtual ~wxDC() { delete m_pimpl
; }
714 const wxDCImpl
*GetImpl() const
717 wxWindow
*GetWindow() const
718 { return m_pimpl
->GetWindow(); }
721 { return m_pimpl
&& m_pimpl
->IsOk(); }
723 // query capabilities
725 bool CanDrawBitmap() const
726 { return m_pimpl
->CanDrawBitmap(); }
727 bool CanGetTextExtent() const
728 { return m_pimpl
->CanGetTextExtent(); }
730 // query dimension, colour deps, resolution
732 void GetSize(int *width
, int *height
) const
733 { m_pimpl
->DoGetSize(width
, height
); }
734 wxSize
GetSize() const
735 { return m_pimpl
->GetSize(); }
737 void GetSizeMM(int* width
, int* height
) const
738 { m_pimpl
->DoGetSizeMM(width
, height
); }
739 wxSize
GetSizeMM() const
742 m_pimpl
->DoGetSizeMM(&w
, &h
);
747 { return m_pimpl
->GetDepth(); }
748 wxSize
GetPPI() const
749 { return m_pimpl
->GetPPI(); }
751 virtual int GetResolution() const
752 { return m_pimpl
->GetResolution(); }
754 // Right-To-Left (RTL) modes
756 void SetLayoutDirection(wxLayoutDirection dir
)
757 { m_pimpl
->SetLayoutDirection( dir
); }
758 wxLayoutDirection
GetLayoutDirection() const
759 { return m_pimpl
->GetLayoutDirection(); }
763 bool StartDoc(const wxString
& message
)
764 { return m_pimpl
->StartDoc(message
); }
766 { m_pimpl
->EndDoc(); }
769 { m_pimpl
->StartPage(); }
771 { m_pimpl
->EndPage(); }
775 void CalcBoundingBox(wxCoord x
, wxCoord y
)
776 { m_pimpl
->CalcBoundingBox(x
,y
); }
777 void ResetBoundingBox()
778 { m_pimpl
->ResetBoundingBox(); }
781 { return m_pimpl
->MinX(); }
783 { return m_pimpl
->MaxX(); }
785 { return m_pimpl
->MinY(); }
787 { return m_pimpl
->MaxY(); }
789 // setters and getters
791 void SetFont(const wxFont
& font
)
792 { m_pimpl
->SetFont( font
); }
793 const wxFont
& GetFont() const
794 { return m_pimpl
->GetFont(); }
796 void SetPen(const wxPen
& pen
)
797 { m_pimpl
->SetPen( pen
); }
798 const wxPen
& GetPen() const
799 { return m_pimpl
->GetPen(); }
801 void SetBrush(const wxBrush
& brush
)
802 { m_pimpl
->SetBrush( brush
); }
803 const wxBrush
& GetBrush() const
804 { return m_pimpl
->GetBrush(); }
806 void SetBackground(const wxBrush
& brush
)
807 { m_pimpl
->SetBackground( brush
); }
808 const wxBrush
& GetBackground() const
809 { return m_pimpl
->GetBackground(); }
811 void SetBackgroundMode(int mode
)
812 { m_pimpl
->SetBackgroundMode( mode
); }
813 int GetBackgroundMode() const
814 { return m_pimpl
->GetBackgroundMode(); }
816 void SetTextForeground(const wxColour
& colour
)
817 { m_pimpl
->SetTextForeground(colour
); }
818 const wxColour
& GetTextForeground() const
819 { return m_pimpl
->GetTextForeground(); }
821 void SetTextBackground(const wxColour
& colour
)
822 { m_pimpl
->SetTextBackground(colour
); }
823 const wxColour
& GetTextBackground() const
824 { return m_pimpl
->GetTextBackground(); }
827 void SetPalette(const wxPalette
& palette
)
828 { m_pimpl
->SetPalette(palette
); }
829 #endif // wxUSE_PALETTE
833 void SetLogicalFunction(wxRasterOperationMode function
)
834 { m_pimpl
->SetLogicalFunction(function
); }
835 wxRasterOperationMode
GetLogicalFunction() const
836 { return m_pimpl
->GetLogicalFunction(); }
840 wxCoord
GetCharHeight() const
841 { return m_pimpl
->GetCharHeight(); }
842 wxCoord
GetCharWidth() const
843 { return m_pimpl
->GetCharWidth(); }
845 void GetTextExtent(const wxString
& string
,
846 wxCoord
*x
, wxCoord
*y
,
847 wxCoord
*descent
= NULL
,
848 wxCoord
*externalLeading
= NULL
,
849 const wxFont
*theFont
= NULL
) const
850 { m_pimpl
->DoGetTextExtent(string
, x
, y
, descent
, externalLeading
, theFont
); }
852 wxSize
GetTextExtent(const wxString
& string
) const
855 m_pimpl
->DoGetTextExtent(string
, &w
, &h
);
859 void GetMultiLineTextExtent(const wxString
& string
,
862 wxCoord
*heightLine
= NULL
,
863 const wxFont
*font
= NULL
) const
864 { m_pimpl
->GetMultiLineTextExtent( string
, width
, height
, heightLine
, font
); }
866 wxSize
GetMultiLineTextExtent(const wxString
& string
) const
869 m_pimpl
->GetMultiLineTextExtent(string
, &w
, &h
);
873 bool GetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const
874 { return m_pimpl
->DoGetPartialTextExtents(text
, widths
); }
879 { m_pimpl
->Clear(); }
883 void SetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
884 { m_pimpl
->DoSetClippingRegion(x
, y
, width
, height
); }
885 void SetClippingRegion(const wxPoint
& pt
, const wxSize
& sz
)
886 { m_pimpl
->DoSetClippingRegion(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
887 void SetClippingRegion(const wxRect
& rect
)
888 { m_pimpl
->DoSetClippingRegion(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
890 // unlike the functions above, the coordinates of the region used in this
891 // one are in device coordinates, not the logical ones
892 void SetDeviceClippingRegion(const wxRegion
& region
)
893 { m_pimpl
->DoSetDeviceClippingRegion(region
); }
895 // this function is deprecated because its name is confusing: you may
896 // expect it to work with logical coordinates but, in fact, it does exactly
897 // the same thing as SetDeviceClippingRegion()
899 // please review the code using it and either replace it with calls to
900 // SetDeviceClippingRegion() or correct it if it was [wrongly] passing
901 // logical coordinates to this function
902 wxDEPRECATED_INLINE(void SetClippingRegion(const wxRegion
& region
),
903 SetDeviceClippingRegion(region
); )
905 void DestroyClippingRegion()
906 { m_pimpl
->DestroyClippingRegion(); }
908 void GetClippingBox(wxCoord
*x
, wxCoord
*y
, wxCoord
*w
, wxCoord
*h
) const
909 { m_pimpl
->DoGetClippingBox(x
, y
, w
, h
); }
910 void GetClippingBox(wxRect
& rect
) const
911 { m_pimpl
->DoGetClippingBox(&rect
.x
, &rect
.y
, &rect
.width
, &rect
.height
); }
913 // coordinates conversions and transforms
915 wxCoord
DeviceToLogicalX(wxCoord x
) const
916 { return m_pimpl
->DeviceToLogicalX(x
); }
917 wxCoord
DeviceToLogicalY(wxCoord y
) const
918 { return m_pimpl
->DeviceToLogicalY(y
); }
919 wxCoord
DeviceToLogicalXRel(wxCoord x
) const
920 { return m_pimpl
->DeviceToLogicalXRel(x
); }
921 wxCoord
DeviceToLogicalYRel(wxCoord y
) const
922 { return m_pimpl
->DeviceToLogicalYRel(y
); }
923 wxCoord
LogicalToDeviceX(wxCoord x
) const
924 { return m_pimpl
->LogicalToDeviceX(x
); }
925 wxCoord
LogicalToDeviceY(wxCoord y
) const
926 { return m_pimpl
->LogicalToDeviceY(y
); }
927 wxCoord
LogicalToDeviceXRel(wxCoord x
) const
928 { return m_pimpl
->LogicalToDeviceXRel(x
); }
929 wxCoord
LogicalToDeviceYRel(wxCoord y
) const
930 { return m_pimpl
->LogicalToDeviceYRel(y
); }
932 void SetMapMode(wxMappingMode mode
)
933 { m_pimpl
->SetMapMode(mode
); }
934 wxMappingMode
GetMapMode() const
935 { return m_pimpl
->GetMapMode(); }
937 void SetUserScale(double x
, double y
)
938 { m_pimpl
->SetUserScale(x
,y
); }
939 void GetUserScale(double *x
, double *y
) const
940 { m_pimpl
->GetUserScale( x
, y
); }
942 void SetLogicalScale(double x
, double y
)
943 { m_pimpl
->SetLogicalScale( x
, y
); }
944 void GetLogicalScale(double *x
, double *y
)
945 { m_pimpl
->GetLogicalScale( x
, y
); }
947 void SetLogicalOrigin(wxCoord x
, wxCoord y
)
948 { m_pimpl
->SetLogicalOrigin(x
,y
); }
949 void GetLogicalOrigin(wxCoord
*x
, wxCoord
*y
) const
950 { m_pimpl
->DoGetLogicalOrigin(x
, y
); }
951 wxPoint
GetLogicalOrigin() const
952 { wxCoord x
, y
; m_pimpl
->DoGetLogicalOrigin(&x
, &y
); return wxPoint(x
, y
); }
954 void SetDeviceOrigin(wxCoord x
, wxCoord y
)
955 { m_pimpl
->SetDeviceOrigin( x
, y
); }
956 void GetDeviceOrigin(wxCoord
*x
, wxCoord
*y
) const
957 { m_pimpl
->DoGetDeviceOrigin(x
, y
); }
958 wxPoint
GetDeviceOrigin() const
959 { wxCoord x
, y
; m_pimpl
->DoGetDeviceOrigin(&x
, &y
); return wxPoint(x
, y
); }
961 void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
962 { m_pimpl
->SetAxisOrientation(xLeftRight
, yBottomUp
); }
965 void SetDeviceLocalOrigin( wxCoord x
, wxCoord y
)
966 { m_pimpl
->SetDeviceLocalOrigin( x
, y
); }
969 // -----------------------------------------------
970 // the actual drawing API
972 bool FloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
973 wxFloodFillStyle style
= wxFLOOD_SURFACE
)
974 { return m_pimpl
->DoFloodFill(x
, y
, col
, style
); }
975 bool FloodFill(const wxPoint
& pt
, const wxColour
& col
,
976 wxFloodFillStyle style
= wxFLOOD_SURFACE
)
977 { return m_pimpl
->DoFloodFill(pt
.x
, pt
.y
, col
, style
); }
979 // fill the area specified by rect with a radial gradient, starting from
980 // initialColour in the centre of the cercle and fading to destColour.
981 void GradientFillConcentric(const wxRect
& rect
,
982 const wxColour
& initialColour
,
983 const wxColour
& destColour
)
984 { m_pimpl
->DoGradientFillConcentric( rect
, initialColour
, destColour
,
985 wxPoint(rect
.GetWidth() / 2,
986 rect
.GetHeight() / 2)); }
988 void GradientFillConcentric(const wxRect
& rect
,
989 const wxColour
& initialColour
,
990 const wxColour
& destColour
,
991 const wxPoint
& circleCenter
)
992 { m_pimpl
->DoGradientFillConcentric(rect
, initialColour
, destColour
, circleCenter
); }
994 // fill the area specified by rect with a linear gradient
995 void GradientFillLinear(const wxRect
& rect
,
996 const wxColour
& initialColour
,
997 const wxColour
& destColour
,
998 wxDirection nDirection
= wxEAST
)
999 { m_pimpl
->DoGradientFillLinear(rect
, initialColour
, destColour
, nDirection
); }
1001 bool GetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
1002 { return m_pimpl
->DoGetPixel(x
, y
, col
); }
1003 bool GetPixel(const wxPoint
& pt
, wxColour
*col
) const
1004 { return m_pimpl
->DoGetPixel(pt
.x
, pt
.y
, col
); }
1006 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
1007 { m_pimpl
->DoDrawLine(x1
, y1
, x2
, y2
); }
1008 void DrawLine(const wxPoint
& pt1
, const wxPoint
& pt2
)
1009 { m_pimpl
->DoDrawLine(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
); }
1011 void CrossHair(wxCoord x
, wxCoord y
)
1012 { m_pimpl
->DoCrossHair(x
, y
); }
1013 void CrossHair(const wxPoint
& pt
)
1014 { m_pimpl
->DoCrossHair(pt
.x
, pt
.y
); }
1016 void DrawArc(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
,
1017 wxCoord xc
, wxCoord yc
)
1018 { m_pimpl
->DoDrawArc(x1
, y1
, x2
, y2
, xc
, yc
); }
1019 void DrawArc(const wxPoint
& pt1
, const wxPoint
& pt2
, const wxPoint
& centre
)
1020 { m_pimpl
->DoDrawArc(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
, centre
.x
, centre
.y
); }
1022 void DrawCheckMark(wxCoord x
, wxCoord y
,
1023 wxCoord width
, wxCoord height
)
1024 { m_pimpl
->DoDrawCheckMark(x
, y
, width
, height
); }
1025 void DrawCheckMark(const wxRect
& rect
)
1026 { m_pimpl
->DoDrawCheckMark(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
1028 void DrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
1029 double sa
, double ea
)
1030 { m_pimpl
->DoDrawEllipticArc(x
, y
, w
, h
, sa
, ea
); }
1031 void DrawEllipticArc(const wxPoint
& pt
, const wxSize
& sz
,
1032 double sa
, double ea
)
1033 { m_pimpl
->DoDrawEllipticArc(pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
); }
1035 void DrawPoint(wxCoord x
, wxCoord y
)
1036 { m_pimpl
->DoDrawPoint(x
, y
); }
1037 void DrawPoint(const wxPoint
& pt
)
1038 { m_pimpl
->DoDrawPoint(pt
.x
, pt
.y
); }
1040 void DrawLines(int n
, wxPoint points
[],
1041 wxCoord xoffset
= 0, wxCoord yoffset
= 0)
1042 { m_pimpl
->DoDrawLines(n
, points
, xoffset
, yoffset
); }
1043 void DrawLines(const wxPointList
*list
,
1044 wxCoord xoffset
= 0, wxCoord yoffset
= 0)
1045 { m_pimpl
->DrawLines( list
, xoffset
, yoffset
); }
1046 #if WXWIN_COMPATIBILITY_2_8
1047 wxDEPRECATED( void DrawLines(const wxList
*list
,
1048 wxCoord xoffset
= 0, wxCoord yoffset
= 0) );
1049 #endif // WXWIN_COMPATIBILITY_2_8
1051 void DrawPolygon(int n
, wxPoint points
[],
1052 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
1053 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
)
1054 { m_pimpl
->DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
); }
1055 void DrawPolygon(const wxPointList
*list
,
1056 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
1057 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
)
1058 { m_pimpl
->DrawPolygon( list
, xoffset
, yoffset
, fillStyle
); }
1059 void DrawPolyPolygon(int n
, int count
[], wxPoint points
[],
1060 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
1061 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
)
1062 { m_pimpl
->DoDrawPolyPolygon(n
, count
, points
, xoffset
, yoffset
, fillStyle
); }
1063 #if WXWIN_COMPATIBILITY_2_8
1064 wxDEPRECATED( void DrawPolygon(const wxList
*list
,
1065 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
1066 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
) );
1067 #endif // WXWIN_COMPATIBILITY_2_8
1069 void DrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
1070 { m_pimpl
->DoDrawRectangle(x
, y
, width
, height
); }
1071 void DrawRectangle(const wxPoint
& pt
, const wxSize
& sz
)
1072 { m_pimpl
->DoDrawRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
1073 void DrawRectangle(const wxRect
& rect
)
1074 { m_pimpl
->DoDrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
1076 void DrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
,
1078 { m_pimpl
->DoDrawRoundedRectangle(x
, y
, width
, height
, radius
); }
1079 void DrawRoundedRectangle(const wxPoint
& pt
, const wxSize
& sz
,
1081 { m_pimpl
->DoDrawRoundedRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
, radius
); }
1082 void DrawRoundedRectangle(const wxRect
& r
, double radius
)
1083 { m_pimpl
->DoDrawRoundedRectangle(r
.x
, r
.y
, r
.width
, r
.height
, radius
); }
1085 void DrawCircle(wxCoord x
, wxCoord y
, wxCoord radius
)
1086 { m_pimpl
->DoDrawEllipse(x
- radius
, y
- radius
, 2*radius
, 2*radius
); }
1087 void DrawCircle(const wxPoint
& pt
, wxCoord radius
)
1088 { m_pimpl
->DoDrawEllipse(pt
.x
- radius
, pt
.y
- radius
, 2*radius
, 2*radius
); }
1090 void DrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
1091 { m_pimpl
->DoDrawEllipse(x
, y
, width
, height
); }
1092 void DrawEllipse(const wxPoint
& pt
, const wxSize
& sz
)
1093 { m_pimpl
->DoDrawEllipse(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
1094 void DrawEllipse(const wxRect
& rect
)
1095 { m_pimpl
->DoDrawEllipse(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
1097 void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
1098 { m_pimpl
->DoDrawIcon(icon
, x
, y
); }
1099 void DrawIcon(const wxIcon
& icon
, const wxPoint
& pt
)
1100 { m_pimpl
->DoDrawIcon(icon
, pt
.x
, pt
.y
); }
1102 void DrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
1103 bool useMask
= false)
1104 { m_pimpl
->DoDrawBitmap(bmp
, x
, y
, useMask
); }
1105 void DrawBitmap(const wxBitmap
&bmp
, const wxPoint
& pt
,
1106 bool useMask
= false)
1107 { m_pimpl
->DoDrawBitmap(bmp
, pt
.x
, pt
.y
, useMask
); }
1109 void DrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
1110 { m_pimpl
->DoDrawText(text
, x
, y
); }
1111 void DrawText(const wxString
& text
, const wxPoint
& pt
)
1112 { m_pimpl
->DoDrawText(text
, pt
.x
, pt
.y
); }
1114 void DrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
)
1115 { m_pimpl
->DoDrawRotatedText(text
, x
, y
, angle
); }
1116 void DrawRotatedText(const wxString
& text
, const wxPoint
& pt
, double angle
)
1117 { m_pimpl
->DoDrawRotatedText(text
, pt
.x
, pt
.y
, angle
); }
1119 // this version puts both optional bitmap and the text into the given
1120 // rectangle and aligns is as specified by alignment parameter; it also
1121 // will emphasize the character with the given index if it is != -1 and
1122 // return the bounding rectangle if required
1123 void DrawLabel(const wxString
& text
,
1124 const wxBitmap
& image
,
1126 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
1127 int indexAccel
= -1,
1128 wxRect
*rectBounding
= NULL
);
1130 void DrawLabel(const wxString
& text
, const wxRect
& rect
,
1131 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
1132 int indexAccel
= -1)
1133 { DrawLabel(text
, wxNullBitmap
, rect
, alignment
, indexAccel
); }
1135 bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
1136 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
1137 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false,
1138 wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
)
1140 return m_pimpl
->DoBlit(xdest
, ydest
, width
, height
,
1141 source
, xsrc
, ysrc
, rop
, useMask
, xsrcMask
, ysrcMask
);
1143 bool Blit(const wxPoint
& destPt
, const wxSize
& sz
,
1144 wxDC
*source
, const wxPoint
& srcPt
,
1145 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false,
1146 const wxPoint
& srcPtMask
= wxDefaultPosition
)
1148 return m_pimpl
->DoBlit(destPt
.x
, destPt
.y
, sz
.x
, sz
.y
,
1149 source
, srcPt
.x
, srcPt
.y
, rop
, useMask
, srcPtMask
.x
, srcPtMask
.y
);
1152 bool StretchBlit(wxCoord dstX
, wxCoord dstY
,
1153 wxCoord dstWidth
, wxCoord dstHeight
,
1155 wxCoord srcX
, wxCoord srcY
,
1156 wxCoord srcWidth
, wxCoord srcHeight
,
1157 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false,
1158 wxCoord srcMaskX
= wxDefaultCoord
, wxCoord srcMaskY
= wxDefaultCoord
)
1160 return m_pimpl
->DoStretchBlit(dstX
, dstY
, dstWidth
, dstHeight
,
1161 source
, srcX
, srcY
, srcWidth
, srcHeight
, rop
, useMask
, srcMaskX
, srcMaskY
);
1163 bool StretchBlit(const wxPoint
& dstPt
, const wxSize
& dstSize
,
1164 wxDC
*source
, const wxPoint
& srcPt
, const wxSize
& srcSize
,
1165 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false,
1166 const wxPoint
& srcMaskPt
= wxDefaultPosition
)
1168 return m_pimpl
->DoStretchBlit(dstPt
.x
, dstPt
.y
, dstSize
.x
, dstSize
.y
,
1169 source
, srcPt
.x
, srcPt
.y
, srcSize
.x
, srcSize
.y
, rop
, useMask
, srcMaskPt
.x
, srcMaskPt
.y
);
1172 wxBitmap
GetAsBitmap(const wxRect
*subrect
= (const wxRect
*) NULL
) const
1174 return m_pimpl
->DoGetAsBitmap(subrect
);
1178 void DrawSpline(wxCoord x1
, wxCoord y1
,
1179 wxCoord x2
, wxCoord y2
,
1180 wxCoord x3
, wxCoord y3
)
1181 { m_pimpl
->DrawSpline(x1
,y1
,x2
,y2
,x3
,y3
); }
1182 void DrawSpline(int n
, wxPoint points
[])
1183 { m_pimpl
->DrawSpline(n
,points
); }
1184 void DrawSpline(const wxPointList
*points
)
1185 { m_pimpl
->DrawSpline(points
); }
1186 #endif // wxUSE_SPLINES
1189 #if WXWIN_COMPATIBILITY_2_8
1190 // for compatibility with the old code when wxCoord was long everywhere
1191 wxDEPRECATED( void GetTextExtent(const wxString
& string
,
1193 long *descent
= NULL
,
1194 long *externalLeading
= NULL
,
1195 const wxFont
*theFont
= NULL
) const );
1196 wxDEPRECATED( void GetLogicalOrigin(long *x
, long *y
) const );
1197 wxDEPRECATED( void GetDeviceOrigin(long *x
, long *y
) const );
1198 wxDEPRECATED( void GetClippingBox(long *x
, long *y
, long *w
, long *h
) const );
1200 wxDEPRECATED( void DrawObject(wxDrawObject
* drawobject
) );
1201 #endif // WXWIN_COMPATIBILITY_2_8
1204 WXHDC
GetHDC() const;
1208 // ctor takes ownership of the pointer
1209 wxDC(wxDCImpl
*pimpl
) : m_pimpl(pimpl
) { }
1211 wxDCImpl
* const m_pimpl
;
1214 DECLARE_ABSTRACT_CLASS(wxDC
)
1215 wxDECLARE_NO_COPY_CLASS(wxDC
);
1218 // ----------------------------------------------------------------------------
1219 // helper class: you can use it to temporarily change the DC text colour and
1220 // restore it automatically when the object goes out of scope
1221 // ----------------------------------------------------------------------------
1223 class WXDLLIMPEXP_CORE wxDCTextColourChanger
1226 wxDCTextColourChanger(wxDC
& dc
) : m_dc(dc
), m_colFgOld() { }
1228 wxDCTextColourChanger(wxDC
& dc
, const wxColour
& col
) : m_dc(dc
)
1233 ~wxDCTextColourChanger()
1235 if ( m_colFgOld
.Ok() )
1236 m_dc
.SetTextForeground(m_colFgOld
);
1239 void Set(const wxColour
& col
)
1241 if ( !m_colFgOld
.Ok() )
1242 m_colFgOld
= m_dc
.GetTextForeground();
1243 m_dc
.SetTextForeground(col
);
1249 wxColour m_colFgOld
;
1251 wxDECLARE_NO_COPY_CLASS(wxDCTextColourChanger
);
1254 // ----------------------------------------------------------------------------
1255 // helper class: you can use it to temporarily change the DC pen and
1256 // restore it automatically when the object goes out of scope
1257 // ----------------------------------------------------------------------------
1259 class WXDLLIMPEXP_CORE wxDCPenChanger
1262 wxDCPenChanger(wxDC
& dc
, const wxPen
& pen
) : m_dc(dc
), m_penOld(dc
.GetPen())
1269 if ( m_penOld
.Ok() )
1270 m_dc
.SetPen(m_penOld
);
1278 wxDECLARE_NO_COPY_CLASS(wxDCPenChanger
);
1281 // ----------------------------------------------------------------------------
1282 // helper class: you can use it to temporarily change the DC brush and
1283 // restore it automatically when the object goes out of scope
1284 // ----------------------------------------------------------------------------
1286 class WXDLLIMPEXP_CORE wxDCBrushChanger
1289 wxDCBrushChanger(wxDC
& dc
, const wxBrush
& brush
) : m_dc(dc
), m_brushOld(dc
.GetBrush())
1291 m_dc
.SetBrush(brush
);
1296 if ( m_brushOld
.Ok() )
1297 m_dc
.SetBrush(m_brushOld
);
1305 wxDECLARE_NO_COPY_CLASS(wxDCBrushChanger
);
1308 // ----------------------------------------------------------------------------
1309 // another small helper class: sets the clipping region in its ctor and
1310 // destroys it in the dtor
1311 // ----------------------------------------------------------------------------
1313 class WXDLLIMPEXP_CORE wxDCClipper
1316 wxDCClipper(wxDC
& dc
, const wxRegion
& r
) : m_dc(dc
)
1317 { dc
.SetClippingRegion(r
.GetBox()); }
1318 wxDCClipper(wxDC
& dc
, const wxRect
& r
) : m_dc(dc
)
1319 { dc
.SetClippingRegion(r
.x
, r
.y
, r
.width
, r
.height
); }
1320 wxDCClipper(wxDC
& dc
, wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) : m_dc(dc
)
1321 { dc
.SetClippingRegion(x
, y
, w
, h
); }
1323 ~wxDCClipper() { m_dc
.DestroyClippingRegion(); }
1328 wxDECLARE_NO_COPY_CLASS(wxDCClipper
);
1331 // ----------------------------------------------------------------------------
1332 // helper class: you can use it to temporarily change the DC font and
1333 // restore it automatically when the object goes out of scope
1334 // ----------------------------------------------------------------------------
1336 class WXDLLIMPEXP_CORE wxDCFontChanger
1339 wxDCFontChanger(wxDC
& dc
, const wxFont
& font
) : m_dc(dc
), m_fontOld(dc
.GetFont())
1346 if ( m_fontOld
.Ok() )
1347 m_dc
.SetFont(m_fontOld
);
1355 wxDECLARE_NO_COPY_CLASS(wxDCFontChanger
);
1359 #endif // _WX_DC_H_BASE_