Vcl.Markdown.TMDCustomControl.OnUnknownImage64
Prototype
property OnUnknownImage64: TUnknownImage64Event read FOnUnknownImage write FOnUnknownImage;
Description
Occurs when an base64-encoded image cannot be loaded because the format is not supported by the Windows Imaging Component (WIC).
aSource contains the base64 encoded image. aSize, if not null, is the optimal image size for rendering. aColor is the desired color for the image, TAlphaColors.Null if not needed. Alerts, for example, pass the required color according to their type (note, caution, etc.). aImage is the object to fill with the resulting image. If OnUnknownImage64 returns an empty image and the control is associated with a TMDStyle, TMDStyle.OnUnknownImage is invoked.
SVG format is not supported by WIC yet. To embed SVG images into your document, add Vcl.Markdown.Skia to the uses clause of the unit and handle OnUnknownImage64 as follow:
uses Vcl.Graphics, System.UITypes, Vcl.Markdown.Image32 {or Vcl.Markdown.Skia};
TForm1.MDStyle1UnknownImage64(Sender: TObject; const aSource: string; aSize: TSize; aColor: TAlphaColor; const aImage: TWICImage);
begin
aImage.LoadFromBase64(aControl, aSource, aSize, aColor);
end;
Vcl.Markdown.Skia declares a TWICImage helper, which in turn uses SKIA for SVG image loading.
Notes
- SVG using Skia
- With Delphi XE8 up to 11 you will need to install the Skia4Delphi package first.
- You must distribute the sk4d.dll Skia library with your application regardless of the Delphi version.
- SVG using Image32
- you will need to download and extract the Image32 package. Then to add the Source and Source\Clipper2 folders to the EDI library path or to your project search path.