3 #include "wx/wfstream.h"
6 #define wxSVGVersion wxT("v0100")
12 class WXDLLIMPEXP_CORE wxSVGFileDC
: public wxDC
16 wxFileOutputStream
* m_outfile
;
18 //holds number of png format images we have
20 bool m_OK
, m_graphics_changed
;
21 int m_width
, m_height
;
37 m_needComputeScaleY
; // not yet used
40 bool DoGetPixel(wxCoord
, wxCoord
, class wxColour
*) const
41 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; };
43 virtual bool DoBlit(wxCoord
, wxCoord
, wxCoord
, wxCoord
, class wxDC
*,
44 wxCoord
, wxCoord
, int = wxCOPY
, bool = 0, int = -1, int = -1) ;
46 void DoCrossHair(wxCoord
, wxCoord
)
47 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
49 void DoDrawArc(wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
);
51 void DoDrawBitmap(const class wxBitmap
&, wxCoord
, wxCoord
, bool = 0) ;
53 void DoDrawCheckMark(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) ;
55 void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) ;
57 void DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
) ;
59 void DoDrawIcon(const class wxIcon
&, wxCoord
, wxCoord
) ;
61 void DoDrawLine (wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) ;
63 void DoDrawPoint(wxCoord
, wxCoord
) ;
65 void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int fillStyle
) ;
67 void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) ;
69 void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
) ;
71 void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20) ;
73 void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
75 bool DoFloodFill(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
), const wxColour
& WXUNUSED(col
),
76 int WXUNUSED(style
) = wxFLOOD_SURFACE
)
77 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoFloodFill Call not implemented")); return false ; };
79 void DoGetSize(int * x
, int *y
) const { *x
= m_width
; *y
= m_height
; return ; } ;
81 void DoGetTextExtent(const wxString
& string
, wxCoord
*w
, wxCoord
*h
, wxCoord
*descent
= NULL
, wxCoord
*externalLeading
= NULL
, wxFont
*font
= NULL
) const ;
83 void DoSetClippingRegionAsRegion(const class wxRegion
&)
84 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
86 void Init (wxString f
, int Width
, int Height
, float dpi
);
93 wxCoord
XDEV2LOG(wxCoord x
) const
95 wxCoord new_x
= x
- m_deviceOriginX
;
97 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
99 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
104 wxCoord
XDEV2LOGREL(wxCoord x
) const
107 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
109 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
114 wxCoord
YDEV2LOG(wxCoord y
) const
116 wxCoord new_y
= y
- m_deviceOriginY
;
118 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
120 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
125 wxCoord
YDEV2LOGREL(wxCoord y
) const
128 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
130 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
135 wxCoord
XLOG2DEV(wxCoord x
) const
137 wxCoord new_x
= x
- m_logicalOriginX
;
139 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
141 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
146 wxCoord
XLOG2DEVREL(wxCoord x
) const
149 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
151 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
156 wxCoord
YLOG2DEV(wxCoord y
) const
158 wxCoord new_y
= y
- m_logicalOriginY
;
160 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
162 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
167 wxCoord
YLOG2DEVREL(wxCoord y
) const
170 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
172 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
175 void write(const wxString
&s
);
179 wxSVGFileDC (wxString f
);
180 wxSVGFileDC (wxString f
, int Width
, int Height
);
181 wxSVGFileDC (wxString f
, int Width
, int Height
, float dpi
);
185 bool CanDrawBitmap() const { return true; };
187 bool CanGetTextExtent() const { return true; };
190 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
192 void BeginDrawing() { return;};
194 bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
, wxDC
* source
, wxCoord xsrc
, wxCoord ysrc
, int logicalFunc
= wxCOPY
, bool useMask
= false)
195 { return DoBlit(xdest
, ydest
, width
, height
, source
, xsrc
, ysrc
, logicalFunc
, useMask
); };
198 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?")); return ; };
200 void CrossHair(wxCoord x
, wxCoord y
)
201 { DoCrossHair (x
,y
); return; };
203 virtual void ComputeScaleAndOrigin();
205 void DestroyClippingRegion()
206 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::void Call not yet implemented")); return ; };
208 wxCoord
DeviceToLogicalX(wxCoord x
) const ;
210 wxCoord
DeviceToLogicalXRel(wxCoord x
) const ;
212 wxCoord
DeviceToLogicalY(wxCoord y
) const ;
214 wxCoord
DeviceToLogicalYRel(wxCoord y
) const ;
216 void DrawBitmap(const wxBitmap
& bitmap
, wxCoord x
, wxCoord y
, bool transparent
)
217 { DoDrawBitmap ( bitmap
, x
, y
, transparent
) ; return ;};
219 void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
220 {DoDrawIcon(icon
, x
, y
) ; return ; };
222 void DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
= 0, wxCoord yoffset
= 0) ;
233 void FloodFill(wxCoord x
, wxCoord y
, wxColour
*colour
, int style
=wxFLOOD_SURFACE
)
234 { DoFloodFill (x
, y
, *colour
, style
); return ;} ;
236 wxCoord
GetCharHeight() const;
238 wxCoord
GetCharWidth() const;
240 void GetClippingBox(wxCoord
*WXUNUSED(x
), wxCoord
*WXUNUSED(y
), wxCoord
* WXUNUSED(width
), wxCoord
* WXUNUSED(height
))
241 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox Call not yet implemented")); return ; };
243 int GetLogicalFunction()
244 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction() Call not implemented")); return wxCOPY
; };
248 bool GetPixel(wxCoord x
, wxCoord y
, wxColour
*colour
)
249 { return DoGetPixel (x
, y
, colour
) ; } ;
251 void GetUserScale(double *x
, double *y
) const ;
253 wxCoord
LogicalToDeviceX(wxCoord x
) const ;
255 wxCoord
LogicalToDeviceXRel(wxCoord x
) const ;
257 wxCoord
LogicalToDeviceY(wxCoord y
) const ;
259 wxCoord
LogicalToDeviceYRel(wxCoord y
) const ;
261 bool Ok() const {return m_OK
;};
263 void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
) ;
265 void SetClippingRegion(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
), wxCoord
WXUNUSED(width
), wxCoord
WXUNUSED(height
))
266 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion Call not yet implemented")); return ; };
268 void SetPalette(const wxPalette
& WXUNUSED(palette
))
269 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette Call not yet implemented")); return ; };
271 void SetBackground( const wxBrush
&brush
) ;
273 void SetBackgroundMode( int mode
) ;
275 void SetBrush(const wxBrush
& brush
) ;
277 void SetFont(const wxFont
& font
) ;
279 void SetLogicalFunction(int WXUNUSED(function
))
280 { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call implemented")); return ; };
282 void SetLogicalScale( double x
, double y
) ;
284 void SetLogicalOrigin( wxCoord x
, wxCoord y
) ;
286 void SetDeviceOrigin( wxCoord x
, wxCoord y
) ;
288 void SetMapMode(int anint
) ;
290 void SetPen(const wxPen
& pen
) ;
292 void SetUserScale(double xScale
, double yScale
) ;
294 bool StartDoc(const wxString
& WXUNUSED(message
))