]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/dcsvg.h
3 #include <wx/wfstream.h>
6 #define wxSVGVersion wxT("v0100")
12 //-----------------------------------------------------------------------------
14 //-----------------------------------------------------------------------------
16 #define mm2inches 0.0393700787402
17 #define inches2mm 25.4
18 #define mm2twips 56.6929133859
19 #define twips2mm 0.0176388888889
20 #define mm2pt 2.83464566929
21 #define pt2mm 0.352777777778
23 class wxSVGFileDC
: public wxDC
27 wxFileOutputStream
* m_outfile
;
29 //holds number of png format images we have
31 bool m_OK
, m_graphics_changed
;
32 int m_width
, m_height
;
48 m_needComputeScaleY
; // not yet used
51 bool DoGetPixel(wxCoord
, wxCoord
, class wxColour
*) const
52 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return TRUE
; };
54 virtual bool DoBlit(wxCoord
, wxCoord
, wxCoord
, wxCoord
, class wxDC
*,
55 wxCoord
, wxCoord
, int = wxCOPY
, bool = 0, int = -1, int = -1) ;
57 void DoCrossHair(wxCoord
, wxCoord
)
58 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
60 void DoDrawArc(wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
);
62 void DoDrawBitmap(const class wxBitmap
&, wxCoord
, wxCoord
, bool = 0) ;
64 void DoDrawCheckMark(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) ;
66 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) ;
68 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
) ;
70 void DoDrawIcon(const class wxIcon
&, wxCoord
, wxCoord
) ;
72 void DoDrawLine (wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) ;
74 void DoDrawPoint(wxCoord
, wxCoord
) ;
76 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int fillStyle
) ;
78 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) ;
80 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
) ;
82 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20) ;
84 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
86 bool DoFloodFill(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
), const wxColour
& WXUNUSED(col
),
87 int WXUNUSED(style
) = wxFLOOD_SURFACE
)
88 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); return FALSE
; };
90 void DoGetSize(int * x
, int *y
) const { *x
= m_width
; *y
= m_height
; return ; } ;
92 void DoGetTextExtent(const wxString
& string
, wxCoord
*w
, wxCoord
*h
, wxCoord
*descent
= NULL
, wxCoord
*externalLeading
= NULL
, wxFont
*font
= NULL
) const ;
94 void DoSetClippingRegionAsRegion(const class wxRegion
&)
95 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
97 void Init (wxString f
, int Width
, int Height
, float dpi
);
104 wxCoord
XDEV2LOG(wxCoord x
) const
106 wxCoord new_x
= x
- m_deviceOriginX
;
108 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
110 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
115 wxCoord
XDEV2LOGREL(wxCoord x
) const
118 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
120 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
125 wxCoord
YDEV2LOG(wxCoord y
) const
127 wxCoord new_y
= y
- m_deviceOriginY
;
129 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
131 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
136 wxCoord
YDEV2LOGREL(wxCoord y
) const
139 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
141 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
146 wxCoord
XLOG2DEV(wxCoord x
) const
148 wxCoord new_x
= x
- m_logicalOriginX
;
150 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
152 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
157 wxCoord
XLOG2DEVREL(wxCoord x
) const
160 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
162 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
167 wxCoord
YLOG2DEV(wxCoord y
) const
169 wxCoord new_y
= y
- m_logicalOriginY
;
171 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
173 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
178 wxCoord
YLOG2DEVREL(wxCoord y
) const
181 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
183 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
189 wxSVGFileDC (wxString f
);
190 wxSVGFileDC (wxString f
, int Width
, int Height
);
191 wxSVGFileDC (wxString f
, int Width
, int Height
, float dpi
);
195 bool CanDrawBitmap() const { return TRUE
; };
197 bool CanGetTextExtent() const { return TRUE
; };
200 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
202 void BeginDrawing() { return;};
204 bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
, wxDC
* source
, wxCoord xsrc
, wxCoord ysrc
, int logicalFunc
= wxCOPY
, bool useMask
= FALSE
)
205 { return DoBlit(xdest
, ydest
, width
, height
, source
, xsrc
, ysrc
, logicalFunc
, useMask
); };
208 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); return ; };
210 void CrossHair(wxCoord x
, wxCoord y
)
211 { DoCrossHair (x
,y
); return; };
213 void ComputeScaleAndOrigin() ;
215 void DestroyClippingRegion()
216 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::void Call not yet implemented")); return ; };
218 wxCoord
DeviceToLogicalX(wxCoord x
) const ;
220 wxCoord
DeviceToLogicalXRel(wxCoord x
) const ;
222 wxCoord
DeviceToLogicalY(wxCoord y
) const ;
224 wxCoord
DeviceToLogicalYRel(wxCoord y
) const ;
226 void DrawBitmap(const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool transparent
)
227 { DoDrawBitmap ( bitmap
, x
, y
, transparent
) ; return ;};
230 void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
231 {DoDrawIcon(icon
, x
, y
) ; return ; };
233 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0) ;
244 void FloodFill(wxCoord x
, wxCoord y
, wxColour
*colour
, int style
=wxFLOOD_SURFACE
)
245 { DoFloodFill (x
, y
, *colour
, style
); return ;} ;
247 wxCoord
GetCharHeight() const;
249 wxCoord
GetCharWidth() const;
251 void GetClippingBox(wxCoord
*WXUNUSED(x
), wxCoord
*WXUNUSED(y
), wxCoord
* WXUNUSED(width
), wxCoord
* WXUNUSED(height
))
252 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::GetClippingBox Call not yet implemented")); return ; };
254 int GetLogicalFunction()
255 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::GetLogicalFunction() Call not implemented")); return wxCOPY
; };
259 bool GetOptimization()
260 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE
; };
262 bool GetPixel(wxCoord x
, wxCoord y
, wxColour
*colour
)
263 { return DoGetPixel (x
, y
, colour
) ; } ;
265 void GetUserScale(double *x
, double *y
) const ;
267 wxCoord
LogicalToDeviceX(wxCoord x
) const ;
269 wxCoord
LogicalToDeviceXRel(wxCoord x
) const ;
271 wxCoord
LogicalToDeviceY(wxCoord y
) const ;
273 wxCoord
LogicalToDeviceYRel(wxCoord y
) const ;
275 bool Ok() const {return m_OK
;};
277 void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
) ;
279 void SetClippingRegion(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
), wxCoord
WXUNUSED(width
), wxCoord
WXUNUSED(height
))
280 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::SetClippingRegion Call not yet implemented")); return ; };
282 void SetPalette(const wxPalette
& WXUNUSED(palette
))
283 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::SetPalette Call not yet implemented")); return ; };
285 void SetBackground( const wxBrush
&brush
) ;
287 void SetBackgroundMode( int mode
) ;
289 void SetBrush(const wxBrush
& brush
) ;
291 void SetFont(const wxFont
& font
) ;
293 void SetLogicalFunction(int WXUNUSED(function
))
294 { wxASSERT_MSG (FALSE
, wxT("wxSVGFILEDC::SetLogicalFunction Call implemented")); return ; };
296 void SetLogicalScale( double x
, double y
) ;
298 void SetLogicalOrigin( wxCoord x
, wxCoord y
) ;
300 void SetDeviceOrigin( wxCoord x
, wxCoord y
) ;
302 void SetMapMode(int anint
) ;
304 void SetOptimization(bool WXUNUSED(optimize
)) { return ; };
306 void SetPen(const wxPen
& pen
) ;
308 void SetUserScale(double xScale
, double yScale
) ;
310 bool StartDoc(const wxString
& WXUNUSED(message
))