ImageEn, unit iexSVG

TIESVGParser

Properties · Methods · Demos · Examples

Declaration

TIESVGParser = class;


Description

A class for parsing the content of SVG files.

This class is used internally when:
Rendering an SVG to a bitmap
Importing an SVG as vector layers


Demo


Demo  Demos\InputOutput\SVGParsing\SVGParsing.dpr

Examples


// Add a description of all SVG tags to a TMemo
lbxSvgTags.Items.BeginUpdate();
svgParser := TIESVGParser.Create();
try
  svgParser.ParseSVG( Filename, nil, svgTags, svgTagCount );

  for i := 0 to Length( svgTags ) - 1 do
  begin
    s := svgTags[i].Content;
    if Length( s ) > MAX_LENGTH then
    begin
      SetLength( s, MAX_LENGTH );
      s := s + '...';
    end;
    lbxSvgTags.Lines.Add( s );
  end;

finally
  lbxSvgTags.Items.EndUpdate();
  svgParser.Free();
end;


// Manually render an SVG
svgParser := TIESVGParser.Create();
try
  // Note: This will be the same as ImageEnView3.IO.ImportFromFileSVG() if Skia or ImageMagick is not being used
  svgParser.ParseSVG( mySvgContent, ImageEnView1.IEBitmap, -1, -1, True );
  ImageEnView1.Fit( False );
  ImageEnView1.Update();

finally
  svgParser.Free();
end;

Methods and Properties


General
Public Method  Create
Public Method  Destroy
Public Method  ParseSVG
Event  OnProgress

SVG Properties
Public Property  SvgX: Double
Public Property  SvgY: Double
Public Property  SvgWidth: Double
Public Property  SvgHeight: Double
Public Property  SvgTagCount: Integer
Public Property  SvgTitle: string
Public Property  SvgViewBox: TRect
Public Property  SvgBackground: TColor
Public Property  SvgRawContent: string