]>
git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/drawnp.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private header for wxDrawnShape
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _OGL_DRAWNP_H_
13 #define _OGL_DRAWNP_H_
16 #pragma interface "drawnp.h"
26 #define DRAWOP_SET_PEN 1
27 #define DRAWOP_SET_BRUSH 2
28 #define DRAWOP_SET_FONT 3
29 #define DRAWOP_SET_TEXT_COLOUR 4
30 #define DRAWOP_SET_BK_COLOUR 5
31 #define DRAWOP_SET_BK_MODE 6
32 #define DRAWOP_SET_CLIPPING_RECT 7
33 #define DRAWOP_DESTROY_CLIPPING_RECT 8
36 #define DRAWOP_CREATE_PEN 10
37 #define DRAWOP_CREATE_BRUSH 11
38 #define DRAWOP_CREATE_FONT 12
41 #define DRAWOP_DRAW_LINE 20
42 #define DRAWOP_DRAW_POLYLINE 21
43 #define DRAWOP_DRAW_POLYGON 22
44 #define DRAWOP_DRAW_RECT 23
45 #define DRAWOP_DRAW_ROUNDED_RECT 24
46 #define DRAWOP_DRAW_ELLIPSE 25
47 #define DRAWOP_DRAW_POINT 26
48 #define DRAWOP_DRAW_ARC 27
49 #define DRAWOP_DRAW_TEXT 28
50 #define DRAWOP_DRAW_SPLINE 29
51 #define DRAWOP_DRAW_ELLIPTIC_ARC 30
58 class wxDrawOp
: public wxObject
61 inline wxDrawOp(int theOp
) { m_op
= theOp
; }
63 inline virtual void Scale(double xScale
, double yScale
) {};
64 inline virtual void Translate(double x
, double y
) {};
65 inline virtual void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
) {};
66 virtual void Do(wxDC
& dc
, double xoffset
, double yoffset
) = 0;
67 virtual wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
) = 0;
68 virtual wxExpr
*WriteExpr(wxPseudoMetaFile
*image
) = 0;
69 virtual void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
) = 0;
71 inline int GetOp() const { return m_op
; }
73 // Draw an outline using the current operation. By default, return FALSE (not drawn)
74 virtual bool OnDrawOutline(wxDC
& dc
, double x
, double y
, double w
, double h
,
75 double oldW
, double oldH
) { return FALSE
; }
77 // Get the perimeter point using this data
78 virtual bool GetPerimeterPoint(double x1
, double y1
,
80 double *x3
, double *y3
,
81 double xOffset
, double yOffset
,
91 * Set font, brush, text colour
95 class wxOpSetGDI
: public wxDrawOp
98 wxOpSetGDI(int theOp
, wxPseudoMetaFile
*theImage
, int theGdiIndex
, int theMode
= 0);
99 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
100 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
101 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
102 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
107 wxPseudoMetaFile
* m_image
;
114 * Set/destroy clipping
118 class wxOpSetClipping
: public wxDrawOp
121 wxOpSetClipping(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
);
122 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
123 void Scale(double xScale
, double yScale
);
124 void Translate(double x
, double y
);
125 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
126 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
127 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
137 * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
141 class wxOpDraw
: public wxDrawOp
144 wxOpDraw(int theOp
, double theX1
, double theY1
, double theX2
, double theY2
,
145 double radius
= 0.0, char *s
= NULL
);
147 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
148 void Scale(double scaleX
, double scaleY
);
149 void Translate(double x
, double y
);
150 void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
);
151 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
152 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
153 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
168 * Draw polyline, spline, polygon
172 class wxOpPolyDraw
: public wxDrawOp
175 wxOpPolyDraw(int theOp
, int n
, wxRealPoint
*thePoints
);
177 void Do(wxDC
& dc
, double xoffset
, double yoffset
);
178 void Scale(double scaleX
, double scaleY
);
179 void Translate(double x
, double y
);
180 void Rotate(double x
, double y
, double theta
, double sinTheta
, double cosTheta
);
181 wxDrawOp
*Copy(wxPseudoMetaFile
*newImage
);
182 wxExpr
*WriteExpr(wxPseudoMetaFile
*image
);
183 void ReadExpr(wxPseudoMetaFile
*image
, wxExpr
*expr
);
185 // Draw an outline using the current operation.
186 virtual bool OnDrawOutline(wxDC
& dc
, double x
, double y
, double w
, double h
,
187 double oldW
, double oldH
);
189 // Get the perimeter point using this data
190 bool GetPerimeterPoint(double x1
, double y1
,
191 double x2
, double y2
,
192 double *x3
, double *y3
,
193 double xOffset
, double yOffset
,
194 bool attachmentMode
);
197 wxRealPoint
* m_points
;