Allow embedding bitmaps in SVG files generated by wxSVGFileDC
|Reported by:||iwbnwif||Owned by:|
The current (3.0) implementation of wxSVGFileDC does not embed bitmaps but instead saves them to the same directory as the SVG file it creates and then creates links.
The attached patch provides the option of embedding bitmaps as well as retaining the default behaviour of linking them.
The change has been implemented by creating a 'pluggable' handler for bitmaps. The handler is implemented as simple class derived from a new abstract base class wxSVGFileDCBitmapHandler.
Implementations of the handler class have one method - ProcessBitmap - which includes a choice of linking bitmaps or embedding them.
Two new specialisations of wxSVGFileDC have been added:
1) SetBitmapHandler - deletes the old handler and installs a new one
2) SetEmbedBitmaps - sets a flag to instruct the class whether to embed bitmaps or not
A simple default handler (wxSVGFileDCDefaultHandler) is provided that either embeds PNG files or links them. Linked files currently have the hard coded filename image'n'.png where n is the next available filename in the SVG file's directory. This is a slight regression on the previous implementation where the image filename was prefixed by the SVG filename. The reason for this shortcoming is that (currently) the handler does not have knowledge of the SVG filename.
-- Note: please bear in mind that I am relatively new to wxWidgets!! --
Other things to consider / questions:
- Is it worth adding a getter to the m_embed_bmps flag?
- Is there anyway of getting the filename from the wxFileOutputStream object?
- Please review the way in which I have accessed the specialisations of wxSVGFileDCImpl from wxSVGFileDC
- Does the handler need to be exported?
Change History (16)
comment:1 Changed 20 months ago by vadz
- Component changed from base to GUI-all
- Keywords work-needed added
- Priority changed from normal to low
- Status changed from new to confirmed
- Summary changed from wxSVGFileDC does not embed bitmaps to Allow embedding bitmaps in SVG files generated by wxSVGFileDC
comment:11 Changed 20 months ago by VZ
- Resolution set to fixed
- Status changed from confirmed to closed