Reference for the Mosaic class Graphics::SVGBitmap

Graphics::SVGBitmap
CurrentColor
DefaultFillColor
DefaultStrokeColor
OnUpdate
SVG
ViewSize
Resources::Bitmap
FrameDelay
FrameSize
NoOfFrames
Core::Resource

SEE ALSO

Using the SVG Bitmap object to rasterize SVG (scalable vector graphics) as bitmap.

The class Graphics::SVGBitmap provides a kind of graphic object specialized to render Scalable Vector Graphics (SVGs) inside an off-screen bitmap. This bitmap can thereupon be used as source for other Image views or widgets.

The content to render is determined by the property SVG. The property ViewSize determines the desired size of the resulting bitmap. This value, however, may be overriden depending on the content of the SVG resulting in a smaller or larger bitmap.

If the SVG content uses the value 'currentColor' to fill or stroke the SVG shapes, the corresponding color value can be specified in the property CurrentColor. By using the properties DefaultFillColor and DefaultStrokeColor color values for the fill and stroke painting can be specified. These are used if the SVG content does not determine any fill or stroke attributes.

When the content of the bitmap changes, a signal is sent to a slot method assigned to the property OnUpdate.

property color CurrentColor = #FFFFFFFF;

The property 'CurrentColor' specifies a color value to be used in the resulting SVG image wherever an SVG element uses 'currentColor' to fill or stroke its shape. In this manner the color of the SVG image can be adapted or modified dynamically at the runtime of the application.

property color DefaultFillColor = #000000FF;

The property 'DefaultFillColor' specifies a color value to be used if there is no explicit 'fill' attribute specified in the SVG content. In this manner the color of the SVG image can be adapted or modified dynamically at the runtime of the application.

property color DefaultStrokeColor = #00000000;

The property 'DefaultStrokeColor' specifies a color value to be used if there is no explicit 'stroke' attribute specified in the SVG content. In this manner the color of the SVG image can be adapted or modified dynamically at the runtime of the application.

property slot OnUpdate = null;

The property 'OnUpdate' can refer to a slot method which will receive a signal when the content of the SVG bitmap has changed.

property Resources::SVG SVG = null;

The property 'SVG' refers to the SVG object describing the SVG image to rasterize in this off-screen bitmap object. At the runtime, when the content of the associated SVG object changes, the bitmap object is updated automatically.

property point ViewSize = <0,0>;

The property 'ViewSize' determines the default size of the rasterized SVG image expressed in pixel. When rasterizing an SVG image, its content is scalled to fill this area as good as possible.

The original size and the aspect-ratio of an SVG image is controlled by SVG document attributes 'width', 'height' and 'viewBox'. Consequently, the resulting size of the SVG bitmap may differ from the value specified in the property 'ViewSize' if the mentioned attributes enforce particular image size. To check the real size of the resulting bitmap read the property FrameSize.