Draw the SVG to the specified canvas inside the specified rectangle. The matrix parameter specifies the cumulative transformations from the Parent element (and its Parents) to apply when drawing the element.
Namespace: FMX.RS.SVG
Delphi |
public |
Parameters
aMatrix
Type: System.Void
cumulative transformations from the Parent element (and its Parents) to apply when drawing the element.
Canvas
Type: System.Void
Canvas to draw on
aRect
Type: System.Void
Rectangle to draw within
The TSVGDocument can be drawn to any TCanvas (though with a printer in VCL, you need to draw to an offscreen bitmap/png and then draw that to the printer.canvas). The following code paints to a TPaintBox.Canvas (FMX): Delphi |
procedure TForm20.PaintBox1Paint(Sender: TObject; Canvas: TCanvas); |
The VCL code is only slightly more complicated:
Delphi
uses
RSSVGTypes, RSGraphics;
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
aCanvas: TSVGCanvas;
begin
aCanvas := TSVGCanvas.Create(PaintBox1.Canvas);
try
Doc.Draw(aCanvas, RectToRSRect(PaintBox1.ClientRect));
finally
aCanvas.Free;
end;
end;
Reference•FMX.RS.SVG.TSVGGraphicElement.Draw(TSVGCanvas,TSVGRect) •TSVGGraphicElement.Draw(TSVGMatrix,TCanvas,TRect) |