Reference for the Mosaic class Resources::SVG

Resources::SVG
CalcSize()
Core::Resource

SEE ALSO

Project member to define constant, localized SVG (scalable vector graphic) resource data.

The class Resources::SVG provides functionality to store Scalable Vector Graphics (SVG), an XML-based vector image format for defining two-dimensional graphics. This content can thereupon be displayed by Views::SVG view or it can be rasterized inside an off-screen bitmap Graphics::SVGBitmap.

Since the content of SVG is scalable, this class provides a method CalcSize() to estimate the resulting size of the SVG image to fit inside a given area. This calculation involves 'width', 'height' and 'viewBox' attributes found inside the SVG content and it respects the aspect ratio of the SVG content.

Usually SVG contents are treated as immutable data, so-called resources. You can add resources to your project at the design time. At the runtime the resources can't change. If your application case requires to display dynamically created or received SVG images, use the class Graphics::SVG.

method point CalcSize
(
arg point aViewSize
);

The method CalcSize() provides a convenient way to estimate the appropriate size of an SVG image depending on the area available to display this image. The returned value is just a recomendation. If desired the view displaying the SVG can adjust the size of the image accordingly.

Althought SVG images are scalable, the 'width', 'height' and 'viewBox' attributes in the SVG content may determine the aspect ratio of the image and limit its size. The method CalcSize() evaluates the corresponding attributes and based on this evaluation and the value provided in the parameter aViewSize calculates the resulting size of the image.