Skip to main content

SVG

The ControlSVG plugin is a visual user interface control derived from ControlBase that enables integration and interaction with scalable vector graphics in the interface system. It allows loading SVG content from files, streams, or Xml, and provides access to individual SVG shapes as CanvasShape elements. Developers can query named shapes, customize their rendering, and control the display area through a configurable SVG rectangle.

info

ControlButtonBase and ControlSliderBase plugins are designed to interact with ControlSVG plugin.

#include <interface/svg/include/TellusimControlSVG.h>

Example

// load background SVG
ControlSVG svg_0(&root);
if(!svg_0.loadSVG("data/background.svg")) return false;
svg_0.setAlign(Control::AlignExpand | Control::AlignCenter | Control::AlignOverlap | Control::AlignAspect);

// load tiger SVG
ControlSVG svg_1(&grid, 0.1f);
svg_1.setSize(128.0f, 128.0f);
if(!svg_1.loadSVG("data/tiger.svg")) return false;

// load Tellusim SVG
ControlSVG svg_2(&grid);
svg_2.setSize(128.0f, 128.0f);
if(!svg_2.loadSVG("data/tellusim.svg")) return false;