VCL 的 Canvas.Pen 对应FMX: Canvas.Stroke;
VCL到 Canvas.Brush 对应FMX: Canvas.Fill.

 TCircle 圆形控件

 

Inkscape 0.91

https://inkscape.org/en/download/windows/

点坐标的处理

PointF(150, 150) 

TPointF.Create(300, 340);

LLayout.TopLeft := TPointF.Zero;

 Position := Rect.TopLeft;

Position := Point(Rect.Right, Rect.Top);

  MakeColor(r,g,b)

 线条宽度

Canvas.Stroke.Thickness := 10;
Canvas.Stroke.Kind := TBrushKind.Solid;

直线

procedure TForm1.FormPaint(Sender: TObject; Canvas: TCanvas;
  const ARect: TRectF);
begin
  Canvas.Stroke.Color := TAlphaColorRec.Green;
  Self.Canvas.DrawLine(TPointF.Create(50, 1), TPointF.Create(50, 500), 5);
end;

 画圆

  Canvas.Fill.Color := TAlphaColorRec.Aqua;
  Canvas.FillEllipse(RectF(45, 50, 55, 65), 1);
  Canvas.FillEllipse(RectF(45, 100, 55, 115), 1);

 TRectF.Create();

TPointF.create

 

多边形

DrawPolygon

Polygon

 

procedure TForm1.DrawPolygonClick(Sender: TObject);
var
  p1, p2, p3, p4, p5, p6: TPointF;
  MyPolygon: TPolygon; //System.Math.Vectors unit needed.
begin
  // sets the points that define the polygon
  p1 := TPointF.Create(80, 200);
  p2 := TPointF.Create(225, 30);
  p3 := TPointF.Create(370, 200);
  p4 := TPointF.Create(300, 340);
  p5 := TPointF.Create(150, 340);
  p6 := TPointF.Create(80, 200);
  // creates the polygon
  SetLength(MyPolygon, 6);
  MyPolygon[0] := p1;
  MyPolygon[1] := p2;
  MyPolygon[2] := p3;
  MyPolygon[3] := p4;
  MyPolygon[4] := p5;
  MyPolygon[5] := p6;
  Image1.Bitmap.Canvas.BeginScene;
  // draws the polygon on the canvas
  Image1.Bitmap.Canvas.DrawPolygon(MyPolygon, 50);
  Image1.Bitmap.Canvas.EndScene;
end;

 TPointF

TPointF = record
    class function Create(const AX, AY: Single): TPointF; overload; static; inline;
    class function Create(const APoint: TPoint): TPointF; overload; static; inline;
    class operator Add(const APoint1, APoint2: TPointF): TPointF;
    class operator Subtract(const APoint1, APoint2: TPointF): TPointF;
    class operator Equal(const APoint1, APoint2: TPointF): Boolean;
    class operator NotEqual(const APoint1, APoint2: TPointF): Boolean;
    class operator Implicit(const APoint: TPoint): TPointF;
    class operator Negative(const APoint: TPointF): TPointF;
    class operator Multiply(const APoint1, APoint2: TPointF): TPointF;
    class operator Multiply(const APoint: TPointF; const AFactor: Single): TPointF;
    class operator Multiply(const AFactor: Single; const APoint: TPointF): TPointF;
    class operator Divide(const APoint: TPointF; const AFactor: Single): TPointF;
    class function PointInCircle(const Point, Center: TPointF; const Radius: Integer): Boolean; static; inline;
    class function Zero: TPointF; inline; static;
    function Distance(const APoint: TPointF): Single;
    function CrossProduct(const APoint: TPointF): Single;
    function DotProduct(const APoint: TPointF): Single; inline;
    procedure Offset(const APoint: TPointF); overload; inline;
    procedure Offset(const ADeltaX, ADeltaY: Single); overload; inline;
    procedure Offset(const APoint: TPoint); overload; inline;
    procedure SetLocation(const X, Y: Single); overload; deprecated 'Use ":=" assignment instead';
    procedure SetLocation(const P: TPointF); overload; deprecated 'Use ":=" assignment instead';
    procedure SetLocation(const P: TPoint); overload; deprecated 'Use ":=" assignment instead';
    function Subtract(const Point: TPointF): TPointF; overload; deprecated 'Use TPointF.Offset instead';
    function Subtract(const Point: TPoint): TPointF; overload; deprecated 'Use TPointF.Offset instead';
    function Add(const Point: TPointF): TPointF; overload; deprecated 'Use TPointF.Offset instead';
    function Add(const Point: TPoint): TPointF; overload; deprecated 'Use TPointF.Offset instead';
    function Scale(const AFactor: Single): TPointF; deprecated;
    function EqualsTo(const Point: TPointF; const Epsilon: Single = 0): Boolean;
    function IsZero: Boolean;
    function Ceiling: TPoint;
    function Truncate: TPoint;
    function Round: TPoint;
    function SnapToPixel(const AScale: Single; const APlaceBetweenPixels: Boolean = True): TPointF;
    function Normalize: TPointF;
    function Length: Single;
    function Rotate(const AAngle: Single): TPointF;
    function Reflect(const APoint: TPointF): TPointF; inline;
    function MidPoint(const APoint: TPointF): TPointF; inline;
    function AngleCosine(const APoint: TPointF): Single;
    function Angle(const APoint: TPointF): Single;
    case Integer of
      0: (V: TPointFType;);
      1: (X: Single;
          Y: Single;);
  end;

 

posted on 2016-03-15 15:15  lypzxy  阅读(435)  评论(0编辑  收藏  举报