Img32.SVG.Reader

A huge amount of work is required to parse and render SVG files. It would really require a team of developers to create and maintain a reader that supports the full SVG 2.0 specification. Adding to that challenge, the SVG specification continues to evolve.

This is a roundabout way of saying that Img32's SVG reader is incomplete. Notable features that are missing include: animation; some less commonly used filters; and support for bi-directional languages (Arabic, Hebrew etc). Nevertheless, compared with other Delphi compiled SVG readers, Img32 does very well indeed (IMHO :)).

Fortunately for the library user, all this complexity happens behind the scene, so that loading and displaying SVG files can be just as it is for other image formats (by including the Img32.Fmt.SVG unit in your application's uses clause).

However, occasionally you may need direct access the TSvgReader class (eg. to change the background color or to modified a contained element before rendering).

Example:
var
  element: TSvgElement;
  dd: TDrawData;
begin
  //load and display an SVG file
  with TSvgReader.Create do
  try
    LoadFromFile(mySvgFilename);
    element := FindElement('rect101');
    if assigned(element) then
    begin
      dd := element.DrawData;
      dd.strokeColor := clMaroon32;
      element.DrawData := dd;
    end;
    ImagePanel.Image.SetSize(800,600);
    //draw the SVG proportionally scaled
    //to fit inside the 800 x 600 px image
    DrawImage(ImagePanel.Image, true);
  finally
    free;
  end;
            

Contents

Classes
TSvgReader

See Also

Img32.Fmt.SVG, TSvgReader