SVG Control Package Version 2.3

SVG Control Package Version 2.3

This is a complete rewrite of the package partly to remove some limitations in the previous version but also to make it ready for future improvements and extensions.

Among the changes are:

  • Support for FPC Lazarus
  • Added interfaces for more graphic libraries
  • Improved text rendering
  • Faster integrated parser
  • New licensing terms

Support for FPC Lazarus

The package will now also compile for FPC Lazarus, Windows, MacOS and Linux.

You need at least FPC 3.0.4 and Lazarus 1.8.4. Also needed is the ” rtl-generics” package.

For Delphi you need at least XE2.

Added interfaces for more graphic libraries

For Windows next to the Direct2D “WIC” render context there is also a render context based on the DirectX 11 “Device Context”. This last one supports hardware accelerated effects. You can use theses render contexts with Delphi and FPC Lazarus.

All the header files needed to render with DirectX are translated and included in the package.

For Mac OS there is a dedicated render context based on “Quartz”, can be used with Delphi FMX and FPC Lazarus.

There is now also a render context based on the “Graphics32” library

For FPC Lazarus there is a render context based on “BGRA bitmap“.

See the “Technical design” page for an overview of the available render contexts.

Or take a look at the “Rendering examples” how these render contexts compare.

Improved text rendering

Similar to the “Render context” interface, an interface is added to the package that gives access to font and text formatting libraries, called a “text layout”.

For Windows there is a text layout based on “DirectWrite” and legacy “GDI fonts” with “Uniscribe”. Again all header files needed are included in the package.

For MacOS there is a text layout based on “Core text”.

These text formatting libraries support complex text formatting, for example bi-directionality and ligatures.

There is also a text layout based on “Freetype” but this one has only limited text formatting capabilities but is available for every operating system.

The text layout is independent from the render context, so you can for example choose “Graphics32” render context and “DirectWrite” as a text layout.

See the “Technical design” page for an overview of the available text layouts or the “Rendering examples” for comparison.

Faster integrated parser

The parser is integrated, this means that you can set attributes by text, for example to change the “style” attribute for an element you can simply code it like so:

Node.Attributes['style'] := 'font-family: "times"; font-size: 24; fill: red;';

You can also add fragments to create child elements, for example:

procedure TForm1.SVG2Image1Click(Sender: TObject);
var
  Element: ISVGElement;
begin
  Element := SVG2Image1.SVGRoot.Element['text'];
  if assigned(Element) then
  begin
    Element.ChildNodes.Clear;
    Element.AddFragment('<tspan fill="yellow">Button <tspan fill="red" font-weight="bold" text-decoration="underline">clicked!</tspan></tspan>');
    SVG2Image1.Repaint;
  end;
end;

The help file contains a number of examples how to create animations or interact with SVG graphics.

New licensing terms

The new license is based on a subscription. There is a one time fee to buy the source code and a yearly subscription fee for receiving fixes and updates.

If you have a v2.2 license you can upgrade to v2.3 for the amount of the subscription fee.

For details see the “Order page“.

Or check out the free demo package or the demo viewer apps here.

Leave a Comment