dcsvg.h 4.2 KB

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