Function TWPImageList.SVGMakeBitmap(svg:TStream; w:Integer; h:Integer) : TBitmap
Unit: WPUtil
Class: WPUtil.TWPImageList
Parameters
-
svg:TStream w:Integer h:Integer
Returns
The type of the result value is TBitmap.
Description
This function was added to convert SVG to a bitmap using embedded SVG interpreter.You have toprovide the size of the result bitmap which will be used as drawing surface. Use this method to check the render quality.
If certain elements are nort rendered as expected, we recomment to export thos elements as images. With Affinity Designer you just need to assign an effect, such as a Shadow, and the element will be rasterized while leaving the original data.
Complictaed text should be converted to curvers.
var img : TWPImageList;
bit : TBitmap;
mem : TMemoryStream;
begin
img := TWPImageList.Create(nil);
mem := TMemoryStream.Create;
bit := nil;
try
OpenDialog1.Filter := 'SVG Files (*.SVG)|*.SVG';
if OpenDialog1.Execute then
begin
mem.LoadFromFile(OpenDialog1.FileName);
mem.Position := 0;
bit := img.SVGMakeBitmap(mem, 800,800);
if bit<>nil then
WPRichText1.TextObjects.InsertCopy(bit);
end;
OpenDialog1.Filter := '*.*';
finally
bit.Free;
img.Free;
mem.Free;
end;
end;