SVG creation

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

SVG creation

Library contains helper class for creating SVG paths from code (htcanvas unit):

 

  THtSVGWriter = class(TFastString)
    class function StrokeStyle(AColor: cardinal; const AWidth: single; 

      AStyle: THtPenStyle; const DashArray: TSingleArray = nil): string;
    class function StrokeStyleCSS(AColor: cardinal; const AWidth: single; 

      AStyle: THtPenStyle; const DashArray: TSingleArray = nil): string;
    // Add command

    function Com(ACommand: hchar): THtSVGWriter;
    // Path Move to point
    function Move(const X, Y: single): THtSVGWriter;
    // Path Move to relative point
    function MoveRel(const dx, dy: single): THtSVGWriter;
    // Path Arc with radius rx, ry from Angle to Angle + sweep
    function Arc(const Rx, Ry, Angle: single; large, sweep: integer;
      const X, Y: single): THtSVGWriter;
    // Path Line to point 
    function LineTo(const X, Y: single): THtSVGWriter;
    // Path Line relatively from current position
    function LineRel(const dx, dy: single): THtSVGWriter;
    // Draw line
    function Line(const x1, y1, x2, y2: single; Stroke: Cardinal;
      const StrokeWidth: single = 0): THtSVGWriter;
    function F(const Value: single): THtSVGWriter;
    // Path vertical line 
    function V(const Value: single): THtSVGWriter;
    // Path relative vertical line
    function VRel(const Delta: single): THtSVGWriter;
    // Path horizontal line
    function h(const Value: single): THtSVGWriter;
    // Path relative horizontal line
    function HRel(const Delta: single): THtSVGWriter;
    function FS(const Value: single): THtSVGWriter; 
    // Add string
    function s(const Value: string): THtSVGWriter;
    // Add color
    function Color(AColor: Cardinal): THtSVGWriter;
    function Stroke(const APen: THtPen): THtSVGWriter;
    function Stroke(AColor: Cardinal; const AWidth: single = 1)
      : THtSVGWriter; 
    // Draw path 
    function Path(const APath: string; Fill, Stroke: Cardinal;
      const StrokeWidth: single = 0): THtSVGWriter;
    // Begin path 
    function BeginPath(Fill, Stroke: Cardinal; const StrokeWidth: single = 0;
      const Style: string = ''; CrispEdges: boolean = false;
      const Attr: string = ''): THtSVGWriter;
    // End path
    function EndPath: THtSVGWriter;
    // Path Z command (close figure) 
    function Z: THtSVGWriter;
    // Draw text 
    function Text(const X, Y: single; const Anchor, Value: hstring;
      const Style: string = ''; const Transform: string = '';
      const Attrs: string = ''): THtSVGWriter;
    // Draw circle 
    function Circle(const CX, CY, R: single; Fill, Stroke: Cardinal;
      const StrokeWidth: single = 0): THtSVGWriter;
    function Ellipse(const CX, CY, RX, RY: single; Fill, Stroke: Cardinal;
      const StrokeWidth: single = 0): THtSVGWriter;
    // Draw rectangle 
    function Rect(const X, Y, W, H: single; Fill, Stroke: Cardinal;
      const StrokeWidth: single = 0; const Style: string = '';
      const RX: single = 0; const RY: single = 0): THtSVGWriter;
    function StrokePath(const Path: THtPath; const Pen: THtPen): THtSVGWriter;
    property Empty: boolean read GetEmpty;
  end;