wx.SVGBitmapHandler¶
Abstract base class for handling bitmaps inside a wx.SVGFileDC.
To use it you need to derive a new class from it and override ProcessBitmap to generate a properly a formed SVG image element (see http://www.w3.org/TR/SVG/struct.html#ImageElement).
Two example bitmap handlers are provided in /dcsvg.h . The first (default) handler will create PNG files in the same folder as the SVG file and uses links to them in the SVG. The second handler ( wx.SVGBitmapEmbedHandler) will embed the PNG image in the SVG file using base 64 encoding.
The handler can be changed by calling wx.SVGFileDC.SetBitmapHandler .
Added in version 4.1/wxWidgets-3.1.0.
Class Hierarchy¶
Known Subclasses¶
wx.SVGBitmapEmbedHandler, wx.SVGBitmapFileHandler
Methods Summary¶
Writes the bitmap representation as |
Class API¶
- class wx.SVGBitmapHandler(object)¶
Abstract base class for handling bitmaps inside a SVGFileDC.
Methods¶
- ProcessBitmap(self, bitmap, x, y, stream)¶
Writes the bitmap representation as
SVGto the given stream.The
XMLgenerated by this function will be inserted into theSVGfile inline with theXMLgenerated by the main wx.SVGFileDC class so it is important that theXMLis properly formed.- Parameters:
bitmap (wx.Bitmap) – A valid bitmap to add to
SVG.x (int) – Horizontal position of the bitmap.
y (int) – Vertical position of the bitmap.
stream (wx.OutputStream) – The stream to write
SVGcontents to.
- Return type:
bool