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
;
31 class WXDLLIMPEXP_FWD_CORE wxSVGFileDC
;
33 class WXDLLIMPEXP_CORE wxSVGFileDCImpl
: public wxDCImpl
36 wxSVGFileDCImpl( wxSVGFileDC
*owner
, const wxString
&filename
,
37 int width
=320, int height
=240, double dpi
=72.0 );
39 virtual ~wxSVGFileDCImpl();
41 bool IsOk() const { return m_OK
; }
43 virtual bool CanDrawBitmap() const { return true; }
44 virtual bool CanGetTextExtent() const { return true; }
46 virtual int GetDepth() const
48 wxFAIL_MSG(wxT("wxSVGFILEDC::GetDepth Call not implemented"));
54 wxFAIL_MSG(wxT("wxSVGFILEDC::Clear() Call not implemented \nNot sensible for an output file?"));
57 virtual void DestroyClippingRegion()
59 wxFAIL_MSG(wxT("wxSVGFILEDC::void Call not yet implemented"));
62 virtual wxCoord
GetCharHeight() const;
63 virtual wxCoord
GetCharWidth() const;
65 virtual void SetClippingRegion(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
66 wxCoord
WXUNUSED(w
), wxCoord
WXUNUSED(h
))
68 wxFAIL_MSG(wxT("wxSVGFILEDC::SetClippingRegion not implemented"));
71 virtual void SetPalette(const wxPalette
& WXUNUSED(palette
))
73 wxFAIL_MSG(wxT("wxSVGFILEDC::SetPalette not implemented"));
76 virtual void GetClippingBox(wxCoord
*WXUNUSED(x
), wxCoord
*WXUNUSED(y
),
77 wxCoord
*WXUNUSED(w
), wxCoord
*WXUNUSED(h
))
79 wxFAIL_MSG(wxT("wxSVGFILEDC::GetClippingBox not implemented"));
82 virtual void SetLogicalFunction(wxRasterOperationMode
WXUNUSED(function
))
84 wxFAIL_MSG(wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented"));
87 virtual wxRasterOperationMode
GetLogicalFunction() const
89 wxFAIL_MSG(wxT("wxSVGFILEDC::GetLogicalFunction() not implemented"));
93 virtual void SetBackground( const wxBrush
&brush
);
94 virtual void SetBackgroundMode( int mode
);
95 virtual void SetBrush(const wxBrush
& brush
);
96 virtual void SetFont(const wxFont
& font
);
97 virtual void SetPen(const wxPen
& pen
);
100 virtual bool DoGetPixel(wxCoord
, wxCoord
, wxColour
*) const
102 wxFAIL_MSG(wxT("wxSVGFILEDC::DoGetPixel Call not implemented"));
106 virtual bool DoBlit(wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxDC
*,
107 wxCoord
, wxCoord
, wxRasterOperationMode
= wxCOPY
,
108 bool = 0, int = -1, int = -1);
110 virtual void DoCrossHair(wxCoord
, wxCoord
)
112 wxFAIL_MSG(wxT("wxSVGFILEDC::CrossHair Call not implemented"));
115 virtual void DoDrawArc(wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
, wxCoord
);
117 virtual void DoDrawBitmap(const wxBitmap
&, wxCoord
, wxCoord
, bool = false);
119 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
121 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
123 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
124 double sa
, double ea
);
126 virtual void DoDrawIcon(const wxIcon
&, wxCoord
, wxCoord
);
128 virtual void DoDrawLine (wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
130 virtual void DoDrawLines(int n
, wxPoint points
[],
131 wxCoord xoffset
= 0, wxCoord yoffset
= 0);
133 virtual void DoDrawPoint(wxCoord
, wxCoord
);
135 virtual void DoDrawPolygon(int n
, wxPoint points
[],
136 wxCoord xoffset
, wxCoord yoffset
,
137 wxPolygonFillMode fillStyle
);
139 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
141 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
144 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
145 wxCoord w
, wxCoord h
,
146 double radius
= 20) ;
148 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
150 virtual bool DoFloodFill(wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
151 const wxColour
& WXUNUSED(col
),
152 wxFloodFillStyle
WXUNUSED(style
) = wxFLOOD_SURFACE
)
154 wxFAIL_MSG(wxT("wxSVGFILEDC::DoFloodFill Call not implemented"));
158 virtual void DoGetSize(int * x
, int *y
) const
166 virtual void DoGetTextExtent(const wxString
& string
, wxCoord
*w
, wxCoord
*h
,
167 wxCoord
*descent
= NULL
,
168 wxCoord
*externalLeading
= NULL
,
169 const wxFont
*font
= NULL
) const;
171 virtual void DoSetDeviceClippingRegion(const wxRegion
& WXUNUSED(region
))
173 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetDeviceClippingRegion not yet implemented"));
176 virtual void DoSetClippingRegion( int WXUNUSED(x
), int WXUNUSED(y
), int WXUNUSED(width
), int WXUNUSED(height
) )
178 wxFAIL_MSG(wxT("wxSVGFILEDC::DoSetClippingRegion not yet implemented"));
181 virtual void DoGetSizeMM( int *width
, int *height
) const;
183 virtual wxSize
GetPPI() const;
185 void Init (const wxString
&filename
, int width
, int height
, double dpi
);
189 void write( const wxString
&s
);
192 wxFileOutputStream
*m_outfile
;
194 int m_sub_images
; // number of png format images we have
196 bool m_graphics_changed
;
197 int m_width
, m_height
;
201 DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl
)
205 class WXDLLIMPEXP_CORE wxSVGFileDC
: public wxDC
208 wxSVGFileDC(const wxString
& filename
,
212 : wxDC(new wxSVGFileDCImpl(this, filename
, width
, height
, dpi
))
219 #endif // _WX_DCSVG_H_