The main cost will be the extra file size for the affected QGS/QML/QPT files, but this feature is entirely optional - so users can continue using file paths or remote urls as SVG symbol sources without change. None - QgsSvgCache caches svg renders, so there will be no significant performance cost associated with decoding base64 embedded images. Selecting this option allows users to save the current embedded file out to a standard SVG file in a location of their choosing. ![]() From URL (opens a simple text input dialog asking user for a URL - while it's possible to directly enter a http URL into the symbol path, this functionality is not widely known and explicitly exposing it as an option in the GUI will increase its discoverability)Īdditionally, if the current SVG source is an embedded SVG, an "Extract Embedded File" action will be shown.Embed File (opens a file picker, and when a file is selected it will be base64 encoded into the svg path).In order to expose this functionality, the current button which is used for selecting an SVG file for the SVG marker/fill and generic SVG selector will be morphed into a QToolButton, with a new drop down menu accessible via an arrow on the side of the button:Ĭlicking this button will show a menu with the options: The bulk of changes here will be modification of the QgsSvgCache::getImageData method, with the addition of the code: QgsSvgCache, which is the common class used for rendering all SVG images within QGIS (used across the application, including symbology, labeling, layouts, etc), will be extended to allow paths which begin with a base64: prefix. Additionally, the Qt QByteArray class already has full support for encoding/decoding base64, making implementation within QGIS simple. These properties make it an ideal candidate for embedding image files directly inside QGIS symbol definitions/projects, and the widespread use of base64 mean there is a multitude of tools available for converting files to/from base64 representation. ![]() ![]() Base64 encoding is notably used heavily within CSS for embedding PNG and SVG icons directly inside CSS text. This would allow SVG symbols to be embedded within QGIS projects, symbol libraries, QML files and QPT print templates.īase64 encoding is a standard method for safely encoding binary data (such as PNG and SVG files) within an ascii string. This proposal covers extending QGIS' support for SVG file handling (which currently supports file paths and http remote urls) to allow SVG files embedded within symbol definitions via base 64 encoding. This increases the file size and load time of resources. QGIS Enhancement: Allow embedded SVG symbols via base 64 encodingĪuthor Nyall Dawson ( QGIS 3.4 Summary Answer: One obvious negative performance impact of inlining images is that the data required to represent each image is embedded into the HTML or CSS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |