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?
- Integrates with native IDE components
Once installed, any SVG image can be displayed using the native IDE components just as with the bitmap-based formats (.bmp, png,
.jpg,…). All components using TGraphic support SVGs, among which: TImage, TPicture, TCanvas.
- Superior image quality
Always get the best image quality whatever the dimensions / resolution.
You don’t need to edit the image if it needs to be resized.
- High DPI aware
When an SVG is used to display an image, its quality does not change, even
when the image is stretched. This feature offers a certain advantage when the application has to support the
high dpi, because the resizing of the images naturally accompanies the interface.
SVGs fully support transparency. No more anti-aliasing issues experienced with bitmap based images.
The SVG standard natively supports complex animations and SVGMagic fully supports them.
- Smaller size
SVGs are incredibly smaller than bitmap based images, even when compressed.
Furthermore SVGs also support compression.
- Widely available
SVGs are widely used for internet graphics, and several well known and
powerful creation tools are available, like Inkscape or
Adobe® Illustrator. In addition, you don’t need to create all SVGs yourself as there are plenty of vector image
libraries available online.
SVGs can easily be expanded to other components such as buttons, checkboxes, radiobuttons, popupmenus and many more.
- Proven track record
SVGMagic is used on a daily base in commercial software like CopyTrans.
The SVG standard allows to obtain spectacular effects including animations, then to change them completely without modifying one line of code.
- TWSVGGraphic component adds native TPicture, TImage, TCanvas SVG support
- TWSVGImageList DPI aware SVG image list
- TWSVGCheckBoxStyle to style any check box
- TWSVGRadioButtonStyle to style any radio button
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:
pSVG := TWSVGGraphic.Create;
pSVG.Width := ClientWidth;
pSVG.Height := ClientHeight;
Canvas.Draw(0, 0, pSVG);
TWSVGGraphic* pSVG = new TWSVGGraphic();
pSVG->Width = ClientWidth;
pSVG->Height = ClientHeight;
Canvas->Draw(0, 0, pSVG);
How to manually change SVG animation position of SVG loaded in TImage?
pSVG := pPicture.Graphic as TWSVGGraphic;
pSVG.AnimationPosition := 0.5; // in percent, between 0.0 and 1.0
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?
pImage.Animation.Position := 50; // in percent, between 0 and 100
pImage->Animation->Position = 50; // in percent, between 0 and 100
Install the SVGMagic demo
To fully experience the component capabilities, test it now. Follow the steps to install the SVGMagic library
- Download SVGMagic RadStudio package
- Unpack the downloaded archive in your Embarcadero RAD Studio common directory:
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:
“15.0” = XE7
“19.0” = 10.2 Tokyo
“20.0” = 10.3 Rio
- Download SVGMagic Demo source code
- Unpack downloaded demo project
- Open demo project in RadStudio IDE and compile it
- In C++ Builder project, you may need to include #pragma comment(lib, “usp10”) in your main form .cpp
- In case of flickering, verify that DoubleBuffered property is set to true on the component
SVGMagic works on Windows 10, 8, 7, Vista and XP and is available for RAD Studio 2010, XE, XE2, XE3,
XE4, XE5, XE6, XE7, XE8, 10 Seattle, 10.1 Berlin, 10.2 Tokyo, 10.3 Rio.
All licenses come with 2 years of free updates and support.
For other licensing options, please email us at firstname.lastname@example.org.
If you have any question, suggestion or you need help, please don’t hesitate to email us at email@example.com.
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.
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.