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

Examples

You can start by downloading the provided demos.

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 SVG animation position of 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

Download

SVGMagic Precompiled demo SVGMagic Demo source code SVGMagic Delphi/C++ Builder package

Make sure to read installation instructions.

Install the SVGMagic demo

To fully experience the component capabilities, test it now. Follow the steps to install the SVGMagic library

  1. Download SVGMagic RadStudio package>
  2. Unpack the downloaded 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 SVGMagic Demo source code
  5. Unpack downloaded demo project
  6. Open demo project in RadStudio IDE and compile it

Common issues:

Compatibility

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

Pricing

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

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

Support

If you have any question, suggestion or you need help, please don’t hesitate to email us at hello@svgmagic.io.

SVGMagic supports a wide array of SVG attributes, however the SVG standard contains a very large amount of properties, and it is possible that one is not supported yet. Please don’t hesitate to contact us and we will be happy to add the missing feature to the library.

Change log

SVG Magic - v1.003 (Released on 03/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 - v1.002 (Released on 02/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 - v1.001 (Released on 02/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 - v1.000 (Released on 02/06/2019)
-> First 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.