Class TSVGContent
Unit
Declaration
type TSVGContent = class(TObject)
Description
Content for an SVG element.
It can be used to browse or add elements.
Example creating an SVG file:
uses BGRABitmapTypes, BGRASVG, BGRAUnits; var svg: TBGRASVG; begin //it is recommended to initialise the SVG with size and unit //otherwise, the size is kind of undefined svg := TBGRASVG.Create(10,6,cuCentimeter); svg.Content.AppendPath('M1,1 L9,1 9,5 1,5 z', cuCentimeter).fillColor := CSSGreen; svg.Content.AppendRect(2,2,6,2, cuCentimeter).fillColor:= BGRA(255,255,0,192); with svg.Content.AppendRect(0,0,svg.Units.ConvertWidth(1,cuCentimeter,cuPixel), svg.Units.ConvertHeight(1,cuCentimeter,cuPixel), cuPixel) do begin fillColor := CSSBlue; fillOpacity:= 0.2; end; svg.Content.AppendRoundRect(3,3,4,1, 0.3,0.3, cuCentimeter).fillColor := CSSOrange; with svg.Content.AppendLine(30,140,250,30, cuPoint) do begin strokeColor := BGRABlack; strokeOpacity:= 0.8; end; svg.Content.AppendLine(svg.ViewBox.min,svg.ViewBox.min+svg.ViewBox.size).strokeColor := CSSRed; with svg.Content.AppendCircle(5,3,2.8,cuCentimeter) do begin strokeColor := CSSRed; strokeWidth := FloatWithCSSUnit(2,cuPoint); fillNone; end; //SVG can be saved in a file that can be viewed in //a web browser or in InkScape for example svg.SaveToFile('content.svg'); svg.Free; end.
Hierarchy
- TObject
- TSVGContent
Overview
Fields
FDataLink: TSVGDataLink; |
|
FDoc: TDOMDocument; |
|
FDomElem: TDOMElement; |
|
FElements: TFPList; |
|
FUnits: TCSSUnitConverter; |
Methods
constructor Create(AElement: TDOMElement; AUnits: TCSSUnitConverter; ADataLink: TSVGDataLink); |
|
destructor Destroy; override; |
|
function AppendCircle(c: TPointF; r: single; AUnit: TCSSUnit = cuCustom): TSVGCircle; overload; |
|
function AppendCircle(cx,cy,r: single; AUnit: TCSSUnit = cuCustom): TSVGCircle; overload; |
|
function AppendDefine: TSVGDefine; |
|
function AppendDOMText(AText: string): TDOMText; |
|
function AppendElement(ASVGType: TSVGFactory): TSVGElement; overload; |
|
function AppendEllipse(c,r: TPointF; AUnit: TCSSUnit = cuCustom): TSVGEllipse; overload; |
|
function AppendEllipse(cx,cy,rx,ry: single; AUnit: TCSSUnit = cuCustom): TSVGEllipse; overload; |
|
function AppendGroup: TSVGGroup; |
|
function AppendImage(origin,size: TPointF; ABitmapStream: TStream; AMimeType: string; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
function AppendImage(x,y,width,height: single; ABitmap: TBGRACustomBitmap; ABitmapOwned: boolean; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
function AppendImage(origin,size: TPointF; ABitmap: TBGRACustomBitmap; ABitmapOwned: boolean; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
function AppendImage(x,y,width,height: single; ABitmapStream: TStream; AMimeType: string; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
function AppendLine(x1,y1,x2,y2: single; AUnit: TCSSUnit = cuCustom): TSVGLine; overload; |
|
function AppendLine(p1,p2: TPointF; AUnit: TCSSUnit = cuCustom): TSVGLine; overload; |
|
function AppendLinearGradient(x1,y1,x2,y2: single; AIsPercent: boolean): TSVGLinearGradient; overload; |
|
function AppendLinearGradient(x1,y1,x2,y2: single; AUnit: TCSSUnit): TSVGLinearGradient; overload; |
|
function AppendPath(path: TBGRAPath; AUnit: TCSSUnit = cuCustom): TSVGPath; overload; |
|
function AppendPath(data: string; AUnit: TCSSUnit = cuCustom): TSVGPath; overload; |
|
function AppendPolygon(const points: array of TPointF; AUnit: TCSSUnit = cuCustom): TSVGPolypoints; overload; |
|
function AppendPolygon(const points: array of single; AUnit: TCSSUnit = cuCustom): TSVGPolypoints; overload; |
|
function AppendRadialGradient(cx,cy,r,fx,fy,fr: single; AIsPercent: boolean): TSVGRadialGradient; overload; |
|
function AppendRadialGradient(cx,cy,r,fx,fy,fr: single; AUnit: TCSSUnit): TSVGRadialGradient; overload; |
|
function AppendRect(origin,size: TPointF; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
function AppendRect(x,y,width,height: single; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
function AppendRoundRect(x,y,width,height,rx,ry: single; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
function AppendRoundRect(origin,size,radius: TPointF; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
function AppendStop(AColor: TBGRAPixel; AOffset: single; AIsPercent: boolean): TSVGStopGradient; |
|
function AppendText(x,y: single; AText: string; AUnit: TCSSUnit = cuCustom): TSVGText; overload; |
|
function AppendText(origin: TPointF; AText: string; AUnit: TCSSUnit = cuCustom): TSVGText; overload; |
|
function AppendTextSpan(AText: string): TSVGTSpan; |
|
function IndexOfElement(AElement: TObject): integer; |
|
function ExtractElementAt(AIndex: integer): TObject; |
|
function GetDOMNode(AElement: TObject): TDOMNode; |
|
function GetElement(AIndex: integer): TSVGElement; |
|
function GetElementCount: integer; |
|
function GetElementDOMNode(AIndex: integer): TDOMNode; |
|
function GetElementObject(AIndex: integer): TObject; |
|
function GetIsSVGElement(AIndex: integer): boolean; |
|
function GetUnits: TCSSUnitConverter; |
|
function TryCreateElementFromNode(ANode: TDOMNode): TObject; virtual; |
|
procedure BringElement(AElement: TObject; AFromContent: TSVGContent); overload; |
|
procedure Clear; |
|
procedure ConvertToUnit(AUnit: TCSSUnit); |
|
procedure CopyElement(AElement: TObject); |
|
procedure CopyPathTo(ACanvas2d: TBGRACanvas2D; x,y: single; AUnit: TCSSUnit); overload; |
|
procedure CopyPathTo(ACanvas2d: TBGRACanvas2D; AUnit: TCSSUnit); overload; |
|
procedure Draw(ACanvas2d: TBGRACanvas2D; AUnit: TCSSUnit); overload; |
|
procedure Draw(ACanvas2d: TBGRACanvas2D; x,y: single; AUnit: TCSSUnit); overload; |
|
procedure IterateElements(ACallback: TIterateElementCallback; AData: pointer; ARecursive: boolean); |
|
procedure Recompute; |
|
procedure RemoveElement(AElement: TObject); |
|
procedure AppendElement(AElement: TObject); overload; |
|
procedure InsertElementBefore(AElement: TSVGElement; ASuccessor: TSVGElement); |
Properties
property Element[AIndex: integer]: TSVGElement read GetElement; |
|
property ElementCount: integer read GetElementCount; |
|
property ElementDOMNode[AIndex: integer]: TDOMNode read GetElementDOMNode; |
|
property ElementObject[AIndex: integer]: TObject read GetElementObject; |
|
property IsSVGElement[AIndex: integer]: boolean read GetIsSVGElement; |
|
property Units: TCSSUnitConverter read GetUnits; |
Description
Fields
FDataLink: TSVGDataLink; |
|
This item has no description. |
FDoc: TDOMDocument; |
|
This item has no description. |
FDomElem: TDOMElement; |
|
This item has no description. |
FElements: TFPList; |
|
This item has no description. |
FUnits: TCSSUnitConverter; |
|
This item has no description. |
Methods
constructor Create(AElement: TDOMElement; AUnits: TCSSUnitConverter; ADataLink: TSVGDataLink); |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
function AppendCircle(c: TPointF; r: single; AUnit: TCSSUnit = cuCustom): TSVGCircle; overload; |
|
This item has no description. |
function AppendCircle(cx,cy,r: single; AUnit: TCSSUnit = cuCustom): TSVGCircle; overload; |
|
This item has no description. |
function AppendDefine: TSVGDefine; |
|
This item has no description. |
function AppendDOMText(AText: string): TDOMText; |
|
This item has no description. |
function AppendElement(ASVGType: TSVGFactory): TSVGElement; overload; |
|
This item has no description. |
function AppendEllipse(c,r: TPointF; AUnit: TCSSUnit = cuCustom): TSVGEllipse; overload; |
|
This item has no description. |
function AppendEllipse(cx,cy,rx,ry: single; AUnit: TCSSUnit = cuCustom): TSVGEllipse; overload; |
|
This item has no description. |
function AppendGroup: TSVGGroup; |
|
This item has no description. |
function AppendImage(origin,size: TPointF; ABitmapStream: TStream; AMimeType: string; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
This item has no description. |
function AppendImage(x,y,width,height: single; ABitmap: TBGRACustomBitmap; ABitmapOwned: boolean; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
This item has no description. |
function AppendImage(origin,size: TPointF; ABitmap: TBGRACustomBitmap; ABitmapOwned: boolean; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
This item has no description. |
function AppendImage(x,y,width,height: single; ABitmapStream: TStream; AMimeType: string; AUnit: TCSSUnit = cuCustom): TSVGImage; overload; |
|
This item has no description. |
function AppendLine(x1,y1,x2,y2: single; AUnit: TCSSUnit = cuCustom): TSVGLine; overload; |
|
This item has no description. |
function AppendLine(p1,p2: TPointF; AUnit: TCSSUnit = cuCustom): TSVGLine; overload; |
|
This item has no description. |
function AppendLinearGradient(x1,y1,x2,y2: single; AIsPercent: boolean): TSVGLinearGradient; overload; |
|
This item has no description. |
function AppendLinearGradient(x1,y1,x2,y2: single; AUnit: TCSSUnit): TSVGLinearGradient; overload; |
|
This item has no description. |
function AppendPath(path: TBGRAPath; AUnit: TCSSUnit = cuCustom): TSVGPath; overload; |
|
This item has no description. |
function AppendPath(data: string; AUnit: TCSSUnit = cuCustom): TSVGPath; overload; |
|
This item has no description. |
function AppendPolygon(const points: array of TPointF; AUnit: TCSSUnit = cuCustom): TSVGPolypoints; overload; |
|
This item has no description. |
function AppendPolygon(const points: array of single; AUnit: TCSSUnit = cuCustom): TSVGPolypoints; overload; |
|
This item has no description. |
function AppendRadialGradient(cx,cy,r,fx,fy,fr: single; AIsPercent: boolean): TSVGRadialGradient; overload; |
|
This item has no description. |
function AppendRadialGradient(cx,cy,r,fx,fy,fr: single; AUnit: TCSSUnit): TSVGRadialGradient; overload; |
|
This item has no description. |
function AppendRect(origin,size: TPointF; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
This item has no description. |
function AppendRect(x,y,width,height: single; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
This item has no description. |
function AppendRoundRect(x,y,width,height,rx,ry: single; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
This item has no description. |
function AppendRoundRect(origin,size,radius: TPointF; AUnit: TCSSUnit = cuCustom): TSVGRectangle; overload; |
|
This item has no description. |
function AppendStop(AColor: TBGRAPixel; AOffset: single; AIsPercent: boolean): TSVGStopGradient; |
|
This item has no description. |
function AppendText(x,y: single; AText: string; AUnit: TCSSUnit = cuCustom): TSVGText; overload; |
|
This item has no description. |
function AppendText(origin: TPointF; AText: string; AUnit: TCSSUnit = cuCustom): TSVGText; overload; |
|
This item has no description. |
function AppendTextSpan(AText: string): TSVGTSpan; |
|
This item has no description. |
function IndexOfElement(AElement: TObject): integer; |
|
This item has no description. |
function ExtractElementAt(AIndex: integer): TObject; |
|
This item has no description. |
function GetDOMNode(AElement: TObject): TDOMNode; |
|
This item has no description. |
function GetElement(AIndex: integer): TSVGElement; |
|
This item has no description. |
function GetElementCount: integer; |
|
This item has no description. |
function GetElementDOMNode(AIndex: integer): TDOMNode; |
|
This item has no description. |
function GetElementObject(AIndex: integer): TObject; |
|
This item has no description. |
function GetIsSVGElement(AIndex: integer): boolean; |
|
This item has no description. |
function GetUnits: TCSSUnitConverter; |
|
This item has no description. |
function TryCreateElementFromNode(ANode: TDOMNode): TObject; virtual; |
|
This item has no description. |
procedure BringElement(AElement: TObject; AFromContent: TSVGContent); overload; |
|
This item has no description. |
procedure Clear; |
|
This item has no description. |
procedure ConvertToUnit(AUnit: TCSSUnit); |
|
This item has no description. |
procedure CopyElement(AElement: TObject); |
|
This item has no description. |
procedure CopyPathTo(ACanvas2d: TBGRACanvas2D; x,y: single; AUnit: TCSSUnit); overload; |
|
This item has no description. |
procedure CopyPathTo(ACanvas2d: TBGRACanvas2D; AUnit: TCSSUnit); overload; |
|
This item has no description. |
procedure Draw(ACanvas2d: TBGRACanvas2D; AUnit: TCSSUnit); overload; |
|
This item has no description. |
procedure Draw(ACanvas2d: TBGRACanvas2D; x,y: single; AUnit: TCSSUnit); overload; |
|
This item has no description. |
procedure IterateElements(ACallback: TIterateElementCallback; AData: pointer; ARecursive: boolean); |
|
This item has no description. |
procedure Recompute; |
|
This item has no description. |
procedure RemoveElement(AElement: TObject); |
|
This item has no description. |
procedure AppendElement(AElement: TObject); overload; |
|
This item has no description. |
procedure InsertElementBefore(AElement: TSVGElement; ASuccessor: TSVGElement); |
|
This item has no description. |
Properties
property Element[AIndex: integer]: TSVGElement read GetElement; |
|
This item has no description. |
property ElementCount: integer read GetElementCount; |
|
This item has no description. |
property ElementDOMNode[AIndex: integer]: TDOMNode read GetElementDOMNode; |
|
This item has no description. |
property ElementObject[AIndex: integer]: TObject read GetElementObject; |
|
This item has no description. |
property IsSVGElement[AIndex: integer]: boolean read GetIsSVGElement; |
|
This item has no description. |
property Units: TCSSUnitConverter read GetUnits; |
|
This item has no description. |