1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: graphics context device bridge header
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GRAPHICS_DC_H_
13 #define _WX_GRAPHICS_DC_H_
15 #if wxUSE_GRAPHICS_CONTEXT
17 #include "wx/geometry.h"
18 #include "wx/dynarray.h"
19 #include "wx/graphics.h"
21 class WXDLLEXPORT wxWindowDC
;
27 class WXDLLEXPORT wxGCDC
:
34 DECLARE_DYNAMIC_CLASS(wxGCDC
)
35 DECLARE_NO_COPY_CLASS(wxGCDC
)
38 wxGCDC(const wxWindowDC
& dc
);
45 // implement base class pure virtuals
46 // ----------------------------------
50 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return true; }
51 virtual void EndDoc(void) {}
53 virtual void StartPage(void) {}
54 virtual void EndPage(void) {}
56 virtual void SetFont(const wxFont
& font
);
57 virtual void SetPen(const wxPen
& pen
);
58 virtual void SetBrush(const wxBrush
& brush
);
59 virtual void SetBackground(const wxBrush
& brush
);
60 virtual void SetBackgroundMode(int mode
);
61 virtual void SetPalette(const wxPalette
& palette
);
63 virtual void DestroyClippingRegion();
65 virtual wxCoord
GetCharHeight() const;
66 virtual wxCoord
GetCharWidth() const;
68 virtual bool CanDrawBitmap() const;
69 virtual bool CanGetTextExtent() const;
70 virtual int GetDepth() const;
71 virtual wxSize
GetPPI() const;
73 virtual void SetMapMode(int mode
);
74 virtual void SetUserScale(double x
, double y
);
76 virtual void SetLogicalScale(double x
, double y
);
77 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
78 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
79 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
80 virtual void SetLogicalFunction(int function
);
82 virtual void SetTextForeground(const wxColour
& colour
);
83 virtual void SetTextBackground(const wxColour
& colour
);
85 virtual void ComputeScaleAndOrigin();
87 wxGraphicsContext
* GetGraphicsContext() { return m_graphicContext
; }
88 virtual void SetGraphicsContext( wxGraphicsContext
* ctx
);
91 // the true implementations
92 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
93 int style
= wxFLOOD_SURFACE
);
95 virtual void DoGradientFillLinear(const wxRect
& rect
,
96 const wxColour
& initialColour
,
97 const wxColour
& destColour
,
98 wxDirection nDirection
= wxEAST
);
100 virtual void DoGradientFillConcentric(const wxRect
& rect
,
101 const wxColour
& initialColour
,
102 const wxColour
& destColour
,
103 const wxPoint
& circleCenter
);
105 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const;
107 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
110 virtual void DoDrawSpline(wxList
*points
);
113 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
115 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
116 wxCoord x2
, wxCoord y2
,
117 wxCoord xc
, wxCoord yc
);
119 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
,
120 wxCoord width
, wxCoord height
);
122 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
123 double sa
, double ea
);
125 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
126 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
127 wxCoord width
, wxCoord height
,
129 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
131 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
133 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
134 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
135 bool useMask
= false);
137 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
138 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
141 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
142 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
143 int rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
145 virtual void DoGetSize(int *,int *) const;
146 virtual void DoGetSizeMM(int* width
, int* height
) const;
148 virtual void DoDrawLines(int n
, wxPoint points
[],
149 wxCoord xoffset
, wxCoord yoffset
);
150 virtual void DoDrawPolygon(int n
, wxPoint points
[],
151 wxCoord xoffset
, wxCoord yoffset
,
152 int fillStyle
= wxODDEVEN_RULE
);
153 virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[],
154 wxCoord xoffset
, wxCoord yoffset
,
157 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
158 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
159 wxCoord width
, wxCoord height
);
161 virtual void DoGetTextExtent(const wxString
& string
,
162 wxCoord
*x
, wxCoord
*y
,
163 wxCoord
*descent
= NULL
,
164 wxCoord
*externalLeading
= NULL
,
165 wxFont
*theFont
= NULL
) const;
167 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
171 double m_mm_to_pix_x
, m_mm_to_pix_y
;
172 wxGraphicsMatrix m_matrixOriginal
;
173 wxGraphicsMatrix m_matrixCurrent
;
175 double m_formerScaleX
, m_formerScaleY
;
177 wxGraphicsContext
* m_graphicContext
;
182 #endif // _WX_GRAPHICS_DC_H_