SVG support for Delphi and C++ builder VCL

SVGMagic adds support for SVG and animated SVG graphics files to Embarcadero® RAD Studio Delphi® and C++ builder® Visual Component Library (VCL).

Why use SVGMagic?

Components

Downloads

SVGMagic demo application SVGMagic demo source code SVGMagic Delphi/C++ Builder package

Install SVGMagic

To fully experience the library's capabilities, test it now. Follow the quick guide to install the SVGMagic library.

  1. Download the SVGMagic RAD Studio package
  2. Unzip the archive in your Embarcadero RAD Studio common directory: C:\Users\Public\Documents\Embarcadero\Studio\
  3. Open your Embarcadero RAD Studio IDE, then from menu “Component” -> “Install Packages”, click “Add…” button, and browse to c:\Users\Public\Documents\Embarcadero\Studio\[Product Version]\Bpl\WSVGD.bpl file, then confirm twice with “OK”.

    [Product Version] for your IDE version is:
    “9.0” = XE2
    “15.0” = XE7
    “16.0” = XE8
    “17.0” = 10.0 Seattle
    “18.0” = 10.1 Berlin
    “19.0” = 10.2 Tokyo
    “20.0” = 10.3 Rio

  4. Download the SVGMagic demo source code
  5. Unzip the demo project
  6. Open the demo in RAD Studio and build it

Common issues:

Compatibility

SVGMagic works on Windows 10, 8, 7 and is available for RAD Studio XE2, XE3, XE4, XE5, XE6, XE7, XE8, 10 Seattle, 10.1 Berlin, 10.2 Tokyo, 10.3 Rio.

Buy SVGMagic

All licenses come with 2 years of free updates and support.

For other licensing options, please email us at hello@svgmagic.io.

Support

All purchases come with 2 years of free updates and support.

For all requests email us at hello@svgmagic.io.

Examples

There are two ways to use the SVG graphic component. You can either use it natively, through the VCL TImage component. In this case, simply put a TImage on your form, then open the Picture property to load a file, and select the SVG file to open as any other image.

Or you can use it in your code exactly the same way as any TGraphic descendents, like a TPngImage or a TJpgImage. For example, here is a sample code that illustrates how to paint a SVG onto a canvas:

Delphi
pSVG := TWSVGGraphic.Create;
pSVG.LoadFromFile('MyFile.svg');
pSVG.Width  := ClientWidth;
pSVG.Height := ClientHeight;
Canvas.Draw(0, 0, pSVG);
C++
TWSVGGraphic* pSVG = new TWSVGGraphic();
pSVG->LoadFromFile(L"MyFile.svg");
pSVG->Width  = ClientWidth;
pSVG->Height = ClientHeight;
Canvas->Draw(0, 0, pSVG);

How to manually change the SVG animation position of the SVG loaded in TImage?

Delphi
pSVG                   := pPicture.Graphic as TWSVGGraphic;
pSVG.AnimationPosition := 0.5;  // in percent, between 0.0 and 1.0
C++
pSVG                    = dynamic_cast<TWSVGGraphic*>(pPicture.Graphic);
pSVG->AnimationPosition = 0.5;  // in percent, between 0.0 and 1.0

How to manually change the animation position of the TWSVGImage?

Delphi
pImage.Animation.Position := 50; // in percent, between 0 and 100
C++
pImage->Animation->Position = 50; // in percent, between 0 and 100

Releases

SVG Magic - 1.005 Sep 21, 2019

improved: unified all the animation properties to share the same engine fixed: an issue in checkbox and radio button styles could cause the target content to be drawn incorrectly on high dpi fixed: the animation could run too quickly in TWSVGGraphic because the interpolation was applied twice fixed: in XE2, the component icons didn't appear on the designer fixed: in XE2, a stream corruption could break several images, which appeared with a fuchsia halo around them

SVG Magic - 1.004 Jun 29, 2019

improved: high dpi support fixed: issue with graphical cache, which prevented several brushes to be cached correctly fixed: several SVG images could be lost in design time the first time the project was reopened (since XE8)

SVG Magic - 1.003 Mar 25, 2019

fixed: library raised an exception while opening SVG files if decimal separator was not configured to "." in computer locale fixed: high DPI issues with component styles fixed: trial library could not be tested in 64 bit due to a memory error fixed: c++ demo project could not be compiled under 64 bit fixed: several configuration issues in 10.2.3 Tokyo and 10.3 Rio demo projects added: RAD Studio XE2, XE8, 10.0 Seattle and 10.1 Berlin support

SVG Magic - 1.002 Feb 27, 2019

fixed: incorrect BkColor default value in TWSVGImageList fixed: users no longer have to link the Uniscribe library (usp10.dll) explicitly added: new property (DPIScale) to allow image list content to be auto-scaled on DPI changes added: drag&drop support in TWSVGImageList design time editor changed: now TWSCGImageList design time editor is shown as a grid instead of a list

SVG Magic - 1.001 Feb 13, 2019

added: library version number property is now exposed in components fixed: now TWSVGImageList no longer clears its content when the size is changed fixed: Delphi demos for 10.2 Tokyo and 10.3 Rio contained several graphical glitches and path to DCU was missing for 64 bit compilation

SVG Magic - 1.000 Feb 6, 2019

First public release

The story behind SVGMagic

SVGMagic was designed for our own project needs. With around 50’000 line of Delphi code, and after more than 2 years of intensive work, SVGMagic significantly shortens our development time and allows our applications to provide a cleaner user experience. It’s the reason why applications like the CopyTrans are using it.

What is SVG?

According to Wikipedia:

Scalable Vector Graphics (SVG) is an XML-based vector image format for two-dimensional graphics with support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium (W3C) since 1999.

SVG is a graphic standard based on vectorial rendering, that allows to draw images without loss of quality, regardless of the size and resolution, and with considerably smaller image file size. The format is widely used for graphics on the internet and all recent browsers support it. In addition SVGs natively support animations.