TImageEnIO.ImportFromFileSVG
Declaration
function ImportFromFileSVG(const FileName: WideString; Width: Integer = -1; Height: Integer = -1; MaintainAR: Boolean = False): Boolean;
Description
Loads a rasterized image from an SVG file.
FileName is the file name and must include a .SVG extension.
Width and
Height specify the image size (the rectangle where the SVG image will be drawn).
To maintain the image aspect ratio set only one size, assigning -1 to the other, e.g. ImportFromFileSVG( 'axi.svg', -1, 500 ); or set both values and enable
MaintainAR.
Result will be false if the file is not SVG format (and
Aborting will be true). Loading errors due to a file not being available will raise an exception.
Note:
◼ LoadFromStreamSVG requires Delphi 12 or newer. You must add Vcl.Skia to the uses clause (of any of your project units) to support SVG
◼ For improved SVG load support, use
ImageMagick◼ This method loads the image as a bitmap (rasterized). It will not be in vector format
◼ You can abort loading by setting
Aborting to true
Examples
uses
Vcl.Skia;
// Import SVG image 'alfa.wmf', resizing to 500xHHH (HHH is auto-calculated)
ImageEnView1.IO.ImportFromFileSVG( 'C:\alfa.svg', 500, -1, true, clWhite );
// Import at default size
ImageEnView1.IO.ImportFromFileSVG( 'C:\input.svg' );
// Import at size of display control, but maintaing aspect ratio
ImageEnView1.IO.ImportFromFileSVG( 'C:\input.svg', ImageEnView1.ClientWidth, ImageEnView1.ClientHeight, True );