Prototype

procedure LoadFromSource(const aSource: string; aSize :TSize; aColor :TAlphaColor = TAlphaColors.Null);

Description

loads an image from a plain text SVG. This method can be used to generate and load an svg script on the fly.

aSource contains the plain text describing the svg image.

aSize contains the optimal size of the image to be rendered. aSize can be null, in which case the size defined in the image, multiplied by the display scale is used.

aColor allows you to adapt the color of a monochrome image according to certain criteria, for example a light or dark mode. Set the color to null to leave the image unchanged.

Example

Consider the following Markdown script:

![](data:image/fly;base64,Image#1)

The image obviously does not contain a valid base64 encoded image, nor is fly a valid image format. However, it is sufficient to fire the OnUnknownImage64 event with aSource filled with Image#1.

Then in the code:

procedure TForm1.MDLabel1UnknownImage64(Sender: TObject; const aSource: string; aSize: TSize; aColor: TAlphaColor; const aImage: TWICImage);
begin
  if SameText(aSource, 'Image#1') then
    aImage.LoadFromSource('<svg height="40" width="300">'
                         +'<text x="5" y="30" fill="none" stroke="red" font-size="35">I love Markdown!</text>'
                         +'</svg>', aSize);
end;

See also

TMDCustomControl.OnUnknownImage64

TMDStyle.OnUnknownImage64

Markdown syntax: Images