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"
20 class WXDLLEXPORT wxGraphicsContext
;
21 class WXDLLEXPORT wxWindowDC
;
28 class WXDLLEXPORT wxGCDC
:
35 DECLARE_DYNAMIC_CLASS(wxGCDC
)
36 DECLARE_NO_COPY_CLASS(wxGCDC
)
39 wxGCDC(const wxWindowDC
& dc
);
46 // implement base class pure virtuals
47 // ----------------------------------
51 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return true; }
52 virtual void EndDoc(void) {}
54 virtual void StartPage(void) {}
55 virtual void EndPage(void) {}
57 virtual void SetFont(const wxFont
& font
);
58 virtual void SetPen(const wxPen
& pen
);
59 virtual void SetBrush(const wxBrush
& brush
);
60 virtual void SetBackground(const wxBrush
& brush
);
61 virtual void SetBackgroundMode(int mode
);
62 virtual void SetPalette(const wxPalette
& palette
);
64 virtual void DestroyClippingRegion();
66 virtual wxCoord
GetCharHeight() const;
67 virtual wxCoord
GetCharWidth() const;
69 virtual bool CanDrawBitmap() const;
70 virtual bool CanGetTextExtent() const;
71 virtual int GetDepth() const;
72 virtual wxSize
GetPPI() const;
74 virtual void SetMapMode(int mode
);
75 virtual void SetUserScale(double x
, double y
);
77 virtual void SetLogicalScale(double x
, double y
);
78 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
79 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
80 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
81 virtual void SetLogicalFunction(int function
);
83 virtual void SetTextForeground(const wxColour
& colour
);
84 virtual void SetTextBackground(const wxColour
& colour
);
86 virtual void ComputeScaleAndOrigin();
88 wxGraphicsContext
* GetGraphicContext() { return m_graphicContext
; }
89 virtual void SetGraphicsContext( wxGraphicsContext
* ctx
)
90 { delete m_graphicContext
; m_graphicContext
= ctx
; }
92 // the true implementations
93 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
94 int style
= wxFLOOD_SURFACE
);
96 virtual void DoGradientFillLinear(const wxRect
& rect
,
97 const wxColour
& initialColour
,
98 const wxColour
& destColour
,
99 wxDirection nDirection
= wxEAST
);
101 virtual void DoGradientFillConcentric(const wxRect
& rect
,
102 const wxColour
& initialColour
,
103 const wxColour
& destColour
,
104 const wxPoint
& circleCenter
);
106 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const;
108 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
111 virtual void DoDrawSpline(wxList
*points
);
114 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
116 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
117 wxCoord x2
, wxCoord y2
,
118 wxCoord xc
, wxCoord yc
);
120 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
,
121 wxCoord width
, wxCoord height
);
123 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
124 double sa
, double ea
);
126 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
127 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
128 wxCoord width
, wxCoord height
,
130 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
132 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
134 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
135 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
136 bool useMask
= false);
138 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
139 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
142 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
143 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
144 int rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
146 virtual void DoGetSize(int *,int *) const;
147 virtual void DoGetSizeMM(int* width
, int* height
) const;
149 virtual void DoDrawLines(int n
, wxPoint points
[],
150 wxCoord xoffset
, wxCoord yoffset
);
151 virtual void DoDrawPolygon(int n
, wxPoint points
[],
152 wxCoord xoffset
, wxCoord yoffset
,
153 int fillStyle
= wxODDEVEN_RULE
);
154 virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[],
155 wxCoord xoffset
, wxCoord yoffset
,
158 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
159 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
160 wxCoord width
, wxCoord height
);
162 virtual void DoGetTextExtent(const wxString
& string
,
163 wxCoord
*x
, wxCoord
*y
,
164 wxCoord
*descent
= NULL
,
165 wxCoord
*externalLeading
= NULL
,
166 wxFont
*theFont
= NULL
) const;
168 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
172 double m_mm_to_pix_x
, m_mm_to_pix_y
;
174 double m_formerScaleX
, m_formerScaleY
;
176 wxGraphicsContext
* m_graphicContext
;
181 #endif // _WX_GRAPHICS_DC_H_