1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSVGFileDC
4 // Author: Chris Elliott
7 // Copyright: (c) Chris Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/string.h"
20 #define wxSVGVersion wxT("v0100")
27 class WXDLLIMPEXP_FWD_BASE wxFileOutputStream
;
32 class WXDLLIMPEXP_FWD_BASE wxSVGFileDC
;
34 class WXDLLIMPEXP_CORE wxSVGFileImplDC
: public wxImplDC
36 #define wxSVGFileImplDC wxSVGFileDC
37 class WXDLLIMPEXP_CORE wxSVGFileDC
: public wxDC
43 wxSVGFileImplDC( wxSVGFileDC
*owner
, const wxString
&filename
,
44 int width
=320, int height
=240, double dpi
=72.0 );
46 wxSVGFileDC( const wxString
&filename
,
47 int width
=320, int height
=240, double dpi
=72.0 );
50 virtual ~wxSVGFileImplDC();
52 bool IsOk() const { return m_OK
; }
54 virtual bool CanDrawBitmap() const { return true; }
55 virtual bool CanGetTextExtent() const { return true; }
57 virtual int GetDepth() const
59 wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
65 wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
68 virtual void DestroyClippingRegion()
70 wxFAIL_MSG(wxT("wxSVGFILEDC::void Call not yet implemented"));
73 virtual wxCoord
GetCharHeight() const;
74 virtual wxCoord
GetCharWidth() const;
76 virtual void SetClippingRegion(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
77 wxCoord
WXUNUSED(w
), wxCoord
WXUNUSED(h
))
79 wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
82 virtual void SetPalette(const wxPalette
& WXUNUSED(palette
))
84 wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
87 virtual void GetClippingBox(wxCoord
*WXUNUSED(x
), wxCoord
*WXUNUSED(y
),
88 wxCoord
*WXUNUSED(w
), wxCoord
*WXUNUSED(h
))
90 wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
93 virtual void SetLogicalFunction(int WXUNUSED(function
))
95 wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
98 virtual int GetLogicalFunction() const
100 wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
104 virtual void SetBackground( const wxBrush
&brush
);
105 virtual void SetBackgroundMode( int mode
);
106 virtual void SetBrush(const wxBrush
& brush
);
107 virtual void SetFont(const wxFont
& font
);
108 virtual void SetPen(const wxPen
& pen
);
112 virtual void SetMapMode( int mode
);
113 virtual void SetUserScale( double x
, double y
);
114 virtual void SetLogicalScale( double x
, double y
);
115 virtual void SetLogicalOrigin( wxCoord x
, wxCoord y
);
116 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
117 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
121 virtual bool DoGetPixel(wxCoord
, wxCoord
, wxColour
*) const
123 wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
127 virtual bool DoBlit(wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxDC
*,
128 wxCoord
, wxCoord
, int = wxCOPY
,
129 bool = 0, int = -1, int = -1);
131 virtual void DoCrossHair(wxCoord
, wxCoord
)
133 wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
136 virtual void DoDrawArc(wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
);
138 virtual void DoDrawBitmap(const wxBitmap
&, wxCoord
, wxCoord
, bool = 0);
140 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
142 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
144 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
145 double sa
, double ea
);
147 virtual void DoDrawIcon(const wxIcon
&, wxCoord
, wxCoord
);
149 virtual void DoDrawLine (wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
151 virtual void DoDrawLines(int n
, wxPoint points
[],
152 wxCoord xoffset
= 0, wxCoord yoffset
= 0);
154 virtual void DoDrawPoint(wxCoord
, wxCoord
);
156 virtual void DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int fillStyle
);
158 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
160 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
163 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
164 wxCoord w
, wxCoord h
,
165 double radius
= 20) ;
167 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
169 virtual bool DoFloodFill(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
170 const wxColour
& WXUNUSED(col
),
171 int WXUNUSED(style
) = wxFLOOD_SURFACE
)
173 wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented"));
177 virtual void DoGetSize(int * x
, int *y
) const
185 virtual void DoGetTextExtent(const wxString
& string
, wxCoord
*w
, wxCoord
*h
,
186 wxCoord
*descent
= NULL
,
187 wxCoord
*externalLeading
= NULL
,
188 const wxFont
*font
= NULL
) const;
190 virtual void DoSetClippingRegionAsRegion(const wxRegion
& WXUNUSED(region
))
192 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion not yet implemented"));
195 virtual void DoSetClippingRegion( int WXUNUSED(x
), int WXUNUSED(y
), int WXUNUSED(width
), int WXUNUSED(height
) )
197 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegion not yet implemented"));
200 virtual void DoGetSizeMM( int *width
, int *height
) const;
202 virtual wxSize
GetPPI() const;
204 void Init (const wxString
&filename
, int width
, int height
, double dpi
);
208 void write( const wxString
&s
);
211 wxFileOutputStream
*m_outfile
;
213 int m_sub_images
; // number of png format images we have
215 bool m_graphics_changed
;
216 int m_width
, m_height
;
220 DECLARE_ABSTRACT_CLASS(wxSVGFileImplDC
)
225 class WXDLLIMPEXP_CORE wxSVGFileDC
: public wxDC
228 wxSVGFileDC( const wxString
&filename
,
229 int width
=320, int height
=240, double dpi
=72.0 )
231 m_pimpl
= new wxSVGFileImplDC( this, filename
, width
, height
, dpi
);
239 #endif // _WX_DCSVG_H_