unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
Spin, BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAVirtualScreen1: TBGRAVirtualScreen;
ColorButton1: TColorButton;
ColorButton2: TColorButton;
ComboBox1: TComboBox;
GroupBox1: TGroupBox;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
Timer1: TTimer;
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure ComboBox1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
public
end;
var
Form1: TForm1;
angle : single;
space,wdt,dmode : integer;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
space := 12;
wdt := 24;
dmode := 0; // draw mode !
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
angle := angle + PI/180;
space := SpinEdit1.Value;
wdt := SpinEdit2.Value;
BGRAVirtualScreen1.RedrawBitmap;
end;
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
var
i : integer;
drawMode: TDrawMode;
sinAngle, cosAngle, cosAngle2: single;
col1, col2: TColor;
begin
if dmode=0 then drawMode:= dmSet
else
drawMode := dmXor;
sinAngle := sin(angle * 0.6);
cosAngle := cos(-angle * 2);
cosAngle2 := cos(angle * 1.5);
col1 := TColor(ColorButton2.ButtonColor);
col2 := TColor(ColorButton1.ButtonColor);
for i:=0 to 34 do
begin
Bitmap.Ellipse(320+300*sinAngle,220+120*cosAngle,1+i*wdt, 1+i*wdt,col1,space ,drawMode);
end;
for i:=0 to 34 do
begin
Bitmap.Ellipse(560,220+140*cosAngle2,1+i*wdt, 1+i*wdt,col2,space ,drawMode);
end;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
dmode := ComboBox1.ItemIndex;
end;
end.