zoukankan      html  css  js  c++  java
  • FireMoneky 画图 Point 赋值

    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;
  • 相关阅读:
    python描述符(descriptor)、属性(property)、函数(类)装饰器(decorator )原理实例详解
    JVM内存模型、指令重排、内存屏障概念解析
    图解JVM的Class文件格式(详细版)
    图解JVM执行引擎之方法调用
    为何JAVA虚函数(虚方法)会造成父类可以"访问"子类的假象?
    小乖上学第一天
    FLEX RIA快速添加图标
    1,2,3,5,7,8,10,11,12,13,14,15,16,21,22 》1~3,5,7~8,10~16,21~22
    ABAP 函数编写
    ABAP子进程(字符串分割定位)
  • 原文地址:https://www.cnblogs.com/cb168/p/5279651.html
Copyright © 2011-2022 走看看