]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/svg/dcsvg.h
wxPalette unified. Source cleaning.
[wxWidgets.git] / contrib / include / wx / svg / dcsvg.h
CommitLineData
e104adcd
CE
1#ifndef __DCSVG_H
2#define __DCSVG_H
3#include <wx/wfstream.h>
4#include <wx/string.h>
5
0ca4ab85
VS
6#ifdef WXMAKINGDLL_SVG
7 #define WXDLLIMPEXP_SVG WXEXPORT
8#elif defined(WXUSINGDLL)
9 #define WXDLLIMPEXP_SVG WXIMPORT
10#else // not making nor using DLL
11 #define WXDLLIMPEXP_SVG
12#endif
13
e104adcd
CE
14#define wxSVGVersion wxT("v0100")
15#ifdef __BORLANDC__
16#pragma warn -rch
17#pragma warn -ccc
18#endif
19
0ca4ab85 20class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
e104adcd
CE
21{
22
23 private:
24 wxFileOutputStream * m_outfile ;
25 wxString m_filename ;
26 //holds number of png format images we have
27 int m_sub_images ;
28 bool m_OK, m_graphics_changed ;
29 int m_width, m_height ;
ea76a6a5
WS
30
31 double
e104adcd
CE
32 m_logicalScaleX,
33 m_logicalScaleY,
34 m_userScaleX,
35 m_userScaleY,
36 m_scaleX,
37 m_scaleY,
ea76a6a5 38 m_OriginX,
e104adcd
CE
39 m_OriginY,
40 m_mm_to_pix_x,
41 m_mm_to_pix_y;
42
ea76a6a5
WS
43 bool
44 m_needComputeScaleX,
e104adcd 45 m_needComputeScaleY; // not yet used
e104adcd 46
ea76a6a5
WS
47
48 bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
b1263dcf 49 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; };
e104adcd
CE
50
51 virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *,
52 wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ;
53
ea76a6a5 54 void DoCrossHair(wxCoord, wxCoord)
b1263dcf 55 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
e104adcd
CE
56
57 void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
58
59 void DoDrawBitmap(const class wxBitmap &, wxCoord, wxCoord, bool = 0) ;
60
61 void DoDrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height) ;
62
63 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) ;
64
65 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) ;
66
67 void DoDrawIcon(const class wxIcon &, wxCoord, wxCoord) ;
68
69 void DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) ;
70
71 void DoDrawPoint(wxCoord, wxCoord) ;
72
73 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) ;
74
75 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) ;
76
77 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) ;
78
79 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20) ;
80
81 void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
82
9c11ecdb
CE
83 bool DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour& WXUNUSED(col),
84 int WXUNUSED(style) = wxFLOOD_SURFACE)
b1263dcf 85 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); return false ; };
e104adcd
CE
86
87 void DoGetSize(int * x, int *y) const { *x = m_width; *y = m_height ; return ; } ;
88
89 void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, wxFont *font = NULL) const ;
90
ea76a6a5 91 void DoSetClippingRegionAsRegion(const class wxRegion &)
b1263dcf 92 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
e104adcd
CE
93
94 void Init (wxString f, int Width, int Height, float dpi);
95
96 void NewGraphics () ;
97
98#ifdef XDEV2LOG
99#undef XDEV2LOG
100#endif
101 wxCoord XDEV2LOG(wxCoord x) const
102 {
103 wxCoord new_x = x - m_deviceOriginX;
104 if (new_x > 0)
105 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
106 else
107 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
108 }
109#ifdef XDEV2LOGREL
110#undef XDEV2LOGREL
111#endif
112 wxCoord XDEV2LOGREL(wxCoord x) const
113 {
114 if (x > 0)
115 return (wxCoord)((double)(x) / m_scaleX + 0.5);
116 else
117 return (wxCoord)((double)(x) / m_scaleX - 0.5);
118 }
119#ifdef YDEV2LOG
120#undef YDEV2LOG
121#endif
122 wxCoord YDEV2LOG(wxCoord y) const
123 {
124 wxCoord new_y = y - m_deviceOriginY;
125 if (new_y > 0)
126 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
127 else
128 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
129 }
130#ifdef YDEV2LOGREL
131#undef YDEV2LOGREL
132#endif
133 wxCoord YDEV2LOGREL(wxCoord y) const
134 {
135 if (y > 0)
136 return (wxCoord)((double)(y) / m_scaleY + 0.5);
137 else
138 return (wxCoord)((double)(y) / m_scaleY - 0.5);
139 }
140#ifdef XLOG2DEV
141#undef XLOG2DEV
142#endif
143 wxCoord XLOG2DEV(wxCoord x) const
144 {
145 wxCoord new_x = x - m_logicalOriginX;
146 if (new_x > 0)
147 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
148 else
149 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
150 }
151#ifdef XLOG2DEVREL
152#undef XLOG2DEVREL
153#endif
154 wxCoord XLOG2DEVREL(wxCoord x) const
155 {
156 if (x > 0)
157 return (wxCoord)((double)(x) * m_scaleX + 0.5);
158 else
159 return (wxCoord)((double)(x) * m_scaleX - 0.5);
160 }
161#ifdef YLOG2DEV
162#undef YLOG2DEV
163#endif
164 wxCoord YLOG2DEV(wxCoord y) const
165 {
166 wxCoord new_y = y - m_logicalOriginY;
167 if (new_y > 0)
168 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
169 else
170 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
171 }
172#ifdef YLOG2DEVREL
173#undef YLOG2DEVREL
174#endif
175 wxCoord YLOG2DEVREL(wxCoord y) const
176 {
177 if (y > 0)
178 return (wxCoord)((double)(y) * m_scaleY + 0.5);
179 else
180 return (wxCoord)((double)(y) * m_scaleY - 0.5);
181 }
182
ea76a6a5 183 void write(const wxString &s);
e104adcd
CE
184
185 public:
186
187 wxSVGFileDC (wxString f);
188 wxSVGFileDC (wxString f, int Width, int Height);
189 wxSVGFileDC (wxString f, int Width, int Height, float dpi);
190 ~wxSVGFileDC();
191
192
ea76a6a5 193 bool CanDrawBitmap() const { return true; };
e104adcd 194
ea76a6a5 195 bool CanGetTextExtent() const { return true; };
e104adcd
CE
196
197 int GetDepth() const
b1263dcf 198 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
ea76a6a5 199
e104adcd
CE
200 void BeginDrawing() { return;};
201
b1263dcf 202 bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = false)
e104adcd
CE
203 { return DoBlit(xdest, ydest, width, height, source, xsrc, ysrc, logicalFunc, useMask); };
204
205 void Clear()
b1263dcf 206 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); return ; };
e104adcd
CE
207
208 void CrossHair(wxCoord x, wxCoord y)
209 { DoCrossHair (x,y); return; };
210
b1263dcf 211 virtual void ComputeScaleAndOrigin();
e104adcd
CE
212
213 void DestroyClippingRegion()
b1263dcf 214 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::void Call not yet implemented")); return ; };
e104adcd
CE
215
216 wxCoord DeviceToLogicalX(wxCoord x) const ;
217
218 wxCoord DeviceToLogicalXRel(wxCoord x) const ;
219
220 wxCoord DeviceToLogicalY(wxCoord y) const ;
221
222 wxCoord DeviceToLogicalYRel(wxCoord y) const ;
223
224 void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
225 { DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;};
226
e104adcd
CE
227 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
228 {DoDrawIcon(icon, x, y) ; return ; };
229
230 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) ;
231
232 void EndDoc()
233 { return ; };
234
235 void EndDrawing()
236 { return ; };
237
238 void EndPage()
239 { return ; };
240
241 void FloodFill(wxCoord x, wxCoord y, wxColour *colour, int style=wxFLOOD_SURFACE)
242 { DoFloodFill (x, y, *colour, style); return ;} ;
243
244 wxCoord GetCharHeight() const;
245
246 wxCoord GetCharWidth() const;
247
9c11ecdb 248 void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), wxCoord * WXUNUSED(width), wxCoord * WXUNUSED(height))
b1263dcf 249 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox Call not yet implemented")); return ; };
e104adcd
CE
250
251 int GetLogicalFunction()
b1263dcf 252 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction() Call not implemented")); return wxCOPY ; };
e104adcd
CE
253
254 int GetMapMode() ;
255
e104adcd
CE
256 bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
257 { return DoGetPixel (x, y, colour) ; } ;
258
259 void GetUserScale(double *x, double *y) const ;
260
261 wxCoord LogicalToDeviceX(wxCoord x) const ;
262
263 wxCoord LogicalToDeviceXRel(wxCoord x) const ;
264
265 wxCoord LogicalToDeviceY(wxCoord y) const ;
266
267 wxCoord LogicalToDeviceYRel(wxCoord y) const ;
268
269 bool Ok() const {return m_OK;};
270
271 void SetAxisOrientation( bool xLeftRight, bool yBottomUp ) ;
272
9c11ecdb 273 void SetClippingRegion(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxCoord WXUNUSED(width), wxCoord WXUNUSED(height))
b1263dcf 274 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion Call not yet implemented")); return ; };
e104adcd 275
9c11ecdb 276 void SetPalette(const wxPalette& WXUNUSED(palette))
b1263dcf 277 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette Call not yet implemented")); return ; };
e104adcd
CE
278
279 void SetBackground( const wxBrush &brush ) ;
280
281 void SetBackgroundMode( int mode ) ;
282
283 void SetBrush(const wxBrush& brush) ;
284
285 void SetFont(const wxFont& font) ;
286
9c11ecdb 287 void SetLogicalFunction(int WXUNUSED(function))
b1263dcf 288 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call implemented")); return ; };
e104adcd
CE
289
290 void SetLogicalScale( double x, double y ) ;
291
292 void SetLogicalOrigin( wxCoord x, wxCoord y ) ;
293
294 void SetDeviceOrigin( wxCoord x, wxCoord y ) ;
295
296 void SetMapMode(int anint) ;
297
e104adcd
CE
298 void SetPen(const wxPen& pen) ;
299
300 void SetUserScale(double xScale, double yScale) ;
301
9c11ecdb 302 bool StartDoc(const wxString& WXUNUSED(message))
b1263dcf 303 { return false; };
e104adcd
CE
304
305 void StartPage()
306 { return ; };
307
308
309};
310
311#ifdef __BORLANDC__
312#pragma warn .rch
313#pragma warn .ccc
314#endif
315#endif