myamanda
在窗体中添加一个button和一个image,选择一幅大约100x100的bitmap。
unit drawunit;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;
type
  TForm1 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    rotateimage:timage;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
const
  rotation = 2/3*pi;
var
  x,y : integer;
  newx,newy : integer;
  radius,a : real;
begin
  form1.WindowState:=wsMaximized;
  image1.Visible:=false;
  button1.Visible:=false;
  rotateimage:=timage.Create(self);
  rotateimage.parent:=self;
  rotateimage.Left:=0;
  rotateimage.Top:=0;
  rotateimage.width:=740;
  rotateimage.Height:=540;
  for x:=1 to image1.Picture.Width do
  begin
    for y:=1 to image1.Height do
    begin
      radius:=Sqrt(Sqr(X)+Sqr(Y));
      a:=Arctan(Y/X);
      newx:=round(Radius*Cos(A+Rotation)+300);
      newy:=round(Radius*Sin(A+Rotation)+300);
      rotateimage.Canvas.Pixels[newx,newy]:=image1.Canvas.Pixels[x,y];
    end;
  end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  rotateimage.free;
end;
end.

分类:

技术点:

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-02-25
  • 2021-10-11
  • 2022-02-08
  • 2021-12-05
猜你喜欢
  • 2022-01-07
  • 1970-01-01
  • 2022-01-11
  • 2022-01-07
  • 2021-06-07
相关资源
相似解决方案