Delphi 图形32:从GR32_PolygonsOld转换

Delphi 图形32:从GR32_PolygonsOld转换,delphi,graphics32,Delphi,Graphics32,我已经使用GR32库好几年了,保留着一个不再维护的旧兼容单元GR32_PolygonsOld。在某种程度上,他们对多边形单元进行了大量修改,一些东西不再存在,如TAntialiasMode和TPolygon32,但从来没有任何文档说明如何将旧代码迁移到新的过程和类中 如何将我的旧代码转换为2.0.0 Alpha以后版本的新方法 旧代码:(新代码不应使用单元GR32_PolygonsOld,它不再是其存储库的一部分,而是GR32_Polygons) GR32官方图书馆: 旧单位: unit Un

我已经使用GR32库好几年了,保留着一个不再维护的旧兼容单元GR32_PolygonsOld。在某种程度上,他们对多边形单元进行了大量修改,一些东西不再存在,如TAntialiasMode和TPolygon32,但从来没有任何文档说明如何将旧代码迁移到新的过程和类中

如何将我的旧代码转换为2.0.0 Alpha以后版本的新方法

旧代码:(新代码不应使用单元GR32_PolygonsOld,它不再是其存储库的一部分,而是GR32_Polygons)

GR32官方图书馆:
旧单位:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls,

  GR32, GR32_PolygonsOld;

type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure b32DoRectangle(bitmap: TBitmap32; Coords: TRect; Color: TColor32; AA: Boolean; AAMode: TAntiAliasMode);
begin
  With TPolygon32.Create do begin
    Antialiased := AA;
    if AA then AntialiasMode := AAMode;
    Add(GR32.FixedPoint(Coords.Left,Coords.Top));
    Add(GR32.FixedPoint(Coords.Right,Coords.Top));
    Add(GR32.FixedPoint(Coords.Right,Coords.Bottom));
    Add(GR32.FixedPoint(Coords.Left,Coords.Bottom));
    DrawFill(bitmap,Color);
    Free;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
Var b32: TBitmap32;
begin
  b32 := TBitmap32.Create;
  b32.Width  := 200;
  b32.Height := 200;
  b32.Clear(clWhite32);

  b32DoRectangle(b32, Rect(20,20,70,70), SetAlpha(clRed32, 20), True, am8times);

  b32.DrawTo(Image1.Canvas.Handle, 0,0);
  b32.Free;
end;

end.

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 397
  ClientWidth = 838
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Image1: TImage
    Left = 32
    Top = 32
    Width = 305
    Height = 209
  end
end