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