I've tried to convert SVG to PNG with this library without luck. What's wrong with this code?
The SVG file is in the EXE folder as well as sk4d.dll
On other pretty simple SVG files, LDOM is nil, probably TSKSVGDOM is too strict.
var
LDOM: ISKSVGDOM;
LSize: TSizeF;
LSVGStream: ISKStream;
LSurface: ISKSurface;
LImage: ISKImage;
begin
LSurface := TSKSurface.MakeRaster(256, 256);
LSVGStream := TSKFileStream.Create(ExtractFilePath(Application.ExeName) + 'porsche.svg');
LDOM := TSKSVGDOM.Make(LSVGStream);
(LDOM as TSkiaObject).DebugMessageProc := procedure(const AMessage: string)
begin
Caption := AMessage;
end;
LSize := LDOM.Root.GetIntrinsicSize(TSizeF.Create(0, 0)); // <== LSize is (0, 0) ?!
LDOM.Render(LSurface.Canvas); // DebugMessageProc called with "can''t render image: load image failed"
LImage := LSurface.MakeImageSnapshot;
LImage.EncodeToFile(ExtractFilePath(Application.ExeName) + 'output.png', TSKEncodedImageFormat.PNG);
end;