Implement clipping in wxSVGFileDC.
[wxWidgets.git] / interface / wx / dcsvg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcsvg.h
3 // Purpose: interface of wxSVGFileDC
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxSVGFileDC
11
12 A wxSVGFileDC is a device context onto which graphics and text can be
13 drawn, and the output produced as a vector file, in SVG format.
14
15 This format can be read by a range of programs, including a Netscape plugin
16 (Adobe) and the open source Inkscape program (http://inkscape.org/). Full
17 details are given in the W3C SVG recommendation (http://www.w3.org/TR/SVG/).
18
19 The intention behind wxSVGFileDC is that it can be used to produce a file
20 corresponding to the screen display context, wxSVGFileDC, by passing the
21 wxSVGFileDC as a parameter instead of a wxDC. Thus the wxSVGFileDC
22 is a write-only class.
23
24 As the wxSVGFileDC is a vector format, raster operations like GetPixel()
25 are unlikely to be supported. However, the SVG specification allows for PNG
26 format raster files to be embedded in the SVG, and so bitmaps, icons and
27 blit operations in wxSVGFileDC are supported.
28
29 A more substantial SVG library (for reading and writing) is available at
30 the wxArt2D website <http://wxart2d.sourceforge.net/>.
31
32 @library{wxcore}
33 @category{dc}
34 */
35 class wxSVGFileDC : public wxDC
36 {
37 public:
38 /**
39 Initializes a wxSVGFileDC with the given @a f filename with the given
40 @a Width and @a Height at @a dpi resolution.
41 */
42 wxSVGFileDC(const wxString& filename, int width = 320, int height = 240, double dpi = 72);
43
44 /**
45 Destructor.
46 */
47 virtual ~wxSVGFileDC();
48
49 /**
50 Does nothing.
51 */
52 void EndDoc();
53
54 /**
55 Does nothing.
56 */
57 void EndPage();
58
59 /**
60 This makes no sense in wxSVGFileDC and does nothing.
61 */
62 void Clear();
63
64 /**
65 Does the same as wxDC::SetLogicalFunction(), except that only wxCOPY is
66 available. Trying to set one of the other values will fail.
67 */
68 void SetLogicalFunction(wxRasterOperationMode function);
69
70 /**
71 Sets the clipping region for this device context to the intersection of
72 the given region described by the parameters of this method and the previously
73 set clipping region.
74 Clipping is implemented in the SVG output using SVG group elements (<g>), with
75 nested group elements being used to represent clipping region intersections when
76 two or more calls are made to SetClippingRegion().
77 */
78 void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width,
79 wxCoord height);
80
81 /**
82 This is an overloaded member function, provided for convenience. It differs from the
83 above function only in what argument(s) it accepts.
84 */
85 void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
86
87 /**
88 This is an overloaded member function, provided for convenience. It differs from the
89 above function only in what argument(s) it accepts.
90 */
91 void SetClippingRegion(const wxRect& rect);
92
93 /**
94 This function is not implemented in this DC class.
95 It could be implemented in future if a GetPoints() function were made available on wxRegion.
96 */
97 void SetClippingRegion(const wxRegion& region);
98
99 /**
100 Destroys the current clipping region so that none of the DC is clipped.
101 Since intersections arising from sequential calls to SetClippingRegion are represented
102 with nested SVG group elements (<g>), all such groups are closed when
103 DestroyClippingRegion is called.
104 */
105 void DestroyClippingRegion();
106
107 //@{
108 /**
109 Functions not implemented in this DC class.
110 */
111 void CrossHair(wxCoord x, wxCoord y);
112 bool FloodFill(wxCoord x, wxCoord y, const wxColour& colour,
113 wxFloodFillStyle style = wxFLOOD_SURFACE);
114 void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *width, wxCoord *height) const;
115 bool GetPixel(wxCoord x, wxCoord y, wxColour* colour) const;
116 void SetPalette(const wxPalette& palette);
117 bool StartDoc(const wxString& message);
118 //@}
119 };
120