]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/dc.h
no 68k macs more to support...
[wxWidgets.git] / include / wx / dfb / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/dc.h
3 // Purpose: wxDC class
4 // Author: Vaclav Slavik
5 // Created: 2006-08-07
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DFB_DC_H_
12 #define _WX_DFB_DC_H_
13
14 #include "wx/defs.h"
15 #include "wx/region.h"
16 #include "wx/dfb/dfbptr.h"
17
18 wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
19
20 //-----------------------------------------------------------------------------
21 // wxDC
22 //-----------------------------------------------------------------------------
23
24 class WXDLLIMPEXP_CORE wxDC : public wxDCBase
25 {
26 public:
27 wxDC();
28
29 // Ctor.
30 wxDC(const wxIDirectFBSurfacePtr& surface);
31
32 public:
33 // implement base class pure virtuals
34 // ----------------------------------
35
36 virtual void Clear();
37
38 virtual bool StartDoc(const wxString& message);
39 virtual void EndDoc();
40
41 virtual void StartPage();
42 virtual void EndPage();
43
44 virtual void SetFont(const wxFont& font);
45 virtual void SetPen(const wxPen& pen);
46 virtual void SetBrush(const wxBrush& brush);
47 virtual void SetBackground(const wxBrush& brush);
48 virtual void SetBackgroundMode(int mode);
49 #if wxUSE_PALETTE
50 virtual void SetPalette(const wxPalette& palette);
51 #endif
52
53 virtual void SetLogicalFunction(int function);
54
55 virtual void DestroyClippingRegion();
56
57 virtual wxCoord GetCharHeight() const;
58 virtual wxCoord GetCharWidth() const;
59 virtual void DoGetTextExtent(const wxString& string,
60 wxCoord *x, wxCoord *y,
61 wxCoord *descent = NULL,
62 wxCoord *externalLeading = NULL,
63 const wxFont *theFont = NULL) const;
64
65 virtual bool CanDrawBitmap() const { return true; }
66 virtual bool CanGetTextExtent() const { return true; }
67 virtual int GetDepth() const;
68 virtual wxSize GetPPI() const;
69
70 // Returns the surface (and increases its ref count)
71 wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; }
72
73 protected:
74 // implementation
75 wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); }
76 wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); }
77 wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); }
78 wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); }
79 wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); }
80 wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); }
81 wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); }
82 wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
83
84 // initializes the DC from a surface, must be called if default ctor
85 // was used
86 void DFBInit(const wxIDirectFBSurfacePtr& surface);
87
88 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
89 int style = wxFLOOD_SURFACE);
90
91 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
92
93 virtual void DoDrawPoint(wxCoord x, wxCoord y);
94 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
95
96 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
97 wxCoord x2, wxCoord y2,
98 wxCoord xc, wxCoord yc);
99 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
100 double sa, double ea);
101
102 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
103 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
104 wxCoord width, wxCoord height,
105 double radius);
106 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
107
108 virtual void DoCrossHair(wxCoord x, wxCoord y);
109
110 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
111 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
112 bool useMask = false);
113
114 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
115 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
116 double angle);
117
118 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
119 wxDC *source, wxCoord xsrc, wxCoord ysrc,
120 int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
121
122 // this is gnarly - we can't even call this function DoSetClippingRegion()
123 // because of virtual function hiding
124 virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
125 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
126 wxCoord width, wxCoord height);
127
128 virtual void DoGetSize(int *width, int *height) const;
129 virtual void DoGetSizeMM(int* width, int* height) const;
130
131 virtual void DoDrawLines(int n, wxPoint points[],
132 wxCoord xoffset, wxCoord yoffset);
133 virtual void DoDrawPolygon(int n, wxPoint points[],
134 wxCoord xoffset, wxCoord yoffset,
135 int fillStyle = wxODDEVEN_RULE);
136
137 // implementation from now on:
138 protected:
139 wxIDirectFBFontPtr GetCurrentFont() const;
140
141 private:
142 // Unified implementation of DrawIcon, DrawBitmap and Blit:
143 void DoDrawSubBitmap(const wxBitmap &bmp,
144 wxCoord x, wxCoord y, wxCoord w, wxCoord h,
145 wxCoord destx, wxCoord desty, int rop, bool useMask);
146 bool DoBlitFromSurface(const wxIDirectFBSurfacePtr& src,
147 wxCoord srcx, wxCoord srcy,
148 wxCoord w, wxCoord h,
149 wxCoord dstx, wxCoord dsty);
150
151 // selects colour into surface's state
152 void SelectColour(const wxColour& clr);
153
154 protected:
155 wxIDirectFBSurfacePtr m_surface;
156
157 double m_mm_to_pix_x, m_mm_to_pix_y;
158
159 friend class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; // for Init
160
161 DECLARE_DYNAMIC_CLASS(wxDC)
162 };
163
164 #endif // _WX_DFB_DC_H_