]> git.saurik.com Git - wxWidgets.git/blob - include/wx/private/graphics.h
Update vc10 build file versions to 3.0.0.
[wxWidgets.git] / include / wx / private / graphics.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/graphics.h
3 // Purpose: private graphics context header
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created:
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GRAPHICS_PRIVATE_H_
12 #define _WX_GRAPHICS_PRIVATE_H_
13
14 #if wxUSE_GRAPHICS_CONTEXT
15
16 #include "wx/graphics.h"
17
18 class WXDLLIMPEXP_CORE wxGraphicsObjectRefData : public wxObjectRefData
19 {
20 public :
21 wxGraphicsObjectRefData( wxGraphicsRenderer* renderer );
22 wxGraphicsObjectRefData( const wxGraphicsObjectRefData* data );
23 wxGraphicsRenderer* GetRenderer() const ;
24 virtual wxGraphicsObjectRefData* Clone() const ;
25
26 protected :
27 wxGraphicsRenderer* m_renderer;
28 } ;
29
30 class WXDLLIMPEXP_CORE wxGraphicsBitmapData : public wxGraphicsObjectRefData
31 {
32 public :
33 wxGraphicsBitmapData( wxGraphicsRenderer* renderer) :
34 wxGraphicsObjectRefData(renderer) {}
35
36 virtual ~wxGraphicsBitmapData() {}
37
38 // returns the native representation
39 virtual void * GetNativeBitmap() const = 0;
40 } ;
41
42 class WXDLLIMPEXP_CORE wxGraphicsMatrixData : public wxGraphicsObjectRefData
43 {
44 public :
45 wxGraphicsMatrixData( wxGraphicsRenderer* renderer) :
46 wxGraphicsObjectRefData(renderer) {}
47
48 virtual ~wxGraphicsMatrixData() {}
49
50 // concatenates the matrix
51 virtual void Concat( const wxGraphicsMatrixData *t ) = 0;
52
53 // sets the matrix to the respective values
54 virtual void Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
55 wxDouble tx=0.0, wxDouble ty=0.0) = 0;
56
57 // gets the component valuess of the matrix
58 virtual void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL,
59 wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const = 0;
60
61 // makes this the inverse matrix
62 virtual void Invert() = 0;
63
64 // returns true if the elements of the transformation matrix are equal ?
65 virtual bool IsEqual( const wxGraphicsMatrixData* t) const = 0;
66
67 // return true if this is the identity matrix
68 virtual bool IsIdentity() const = 0;
69
70 //
71 // transformation
72 //
73
74 // add the translation to this matrix
75 virtual void Translate( wxDouble dx , wxDouble dy ) = 0;
76
77 // add the scale to this matrix
78 virtual void Scale( wxDouble xScale , wxDouble yScale ) = 0;
79
80 // add the rotation to this matrix (radians)
81 virtual void Rotate( wxDouble angle ) = 0;
82
83 //
84 // apply the transforms
85 //
86
87 // applies that matrix to the point
88 virtual void TransformPoint( wxDouble *x, wxDouble *y ) const = 0;
89
90 // applies the matrix except for translations
91 virtual void TransformDistance( wxDouble *dx, wxDouble *dy ) const =0;
92
93 // returns the native representation
94 virtual void * GetNativeMatrix() const = 0;
95 } ;
96
97 class WXDLLIMPEXP_CORE wxGraphicsPathData : public wxGraphicsObjectRefData
98 {
99 public :
100 wxGraphicsPathData(wxGraphicsRenderer* renderer) : wxGraphicsObjectRefData(renderer) {}
101 virtual ~wxGraphicsPathData() {}
102
103 //
104 // These are the path primitives from which everything else can be constructed
105 //
106
107 // begins a new subpath at (x,y)
108 virtual void MoveToPoint( wxDouble x, wxDouble y ) = 0;
109
110 // adds a straight line from the current point to (x,y)
111 virtual void AddLineToPoint( wxDouble x, wxDouble y ) = 0;
112
113 // adds a cubic Bezier curve from the current point, using two control points and an end point
114 virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1, wxDouble cx2, wxDouble cy2, wxDouble x, wxDouble y ) = 0;
115
116 // adds another path
117 virtual void AddPath( const wxGraphicsPathData* path ) =0;
118
119 // closes the current sub-path
120 virtual void CloseSubpath() = 0;
121
122 // gets the last point of the current path, (0,0) if not yet set
123 virtual void GetCurrentPoint( wxDouble* x, wxDouble* y) const = 0;
124
125 // adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle
126 virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise ) = 0;
127
128 //
129 // These are convenience functions which - if not available natively will be assembled
130 // using the primitives from above
131 //
132
133 // adds a quadratic Bezier curve from the current point, using a control point and an end point
134 virtual void AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y );
135
136 // appends a rectangle as a new closed subpath
137 virtual void AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h );
138
139 // appends an ellipsis as a new closed subpath fitting the passed rectangle
140 virtual void AddCircle( wxDouble x, wxDouble y, wxDouble r );
141
142 // appends a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
143 virtual void AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ;
144
145 // appends an ellipse
146 virtual void AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
147
148 // appends a rounded rectangle
149 virtual void AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius);
150
151 // returns the native path
152 virtual void * GetNativePath() const = 0;
153
154 // give the native path returned by GetNativePath() back (there might be some deallocations necessary)
155 virtual void UnGetNativePath(void *p) const= 0;
156
157 // transforms each point of this path by the matrix
158 virtual void Transform( const wxGraphicsMatrixData* matrix ) =0;
159
160 // gets the bounding box enclosing all points (possibly including control points)
161 virtual void GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wxDouble *h) const=0;
162
163 virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const=0;
164 };
165
166 #endif
167
168 #endif // _WX_GRAPHICS_PRIVATE_H_