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