unit paint;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,BGRABitmap,BGRABitmapTypes;
type
{ TForm1 }
TForm1 = class(TForm)
DrawTimer: TTimer;
procedure FormClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
procedure OnPaint(sender: TObject);
end;
var
Form1: TForm1;
TData: array [0..63]of Integer =(88,96,104,112,120,127,134,140,146,151,156,160,163,166,167,168,168,168,166,164,161,158,153,148,143,136,130,123,115,108,100,92,84,76,68,60,53,46,40,33,28,23,19,15,12,10,9,9,9,10,12,14,18,22,27,32,38,44,51,59,66,74,82,88);
Pos,Poss: Integer;
FirstTime: Byte = 1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Pos := 1;
Poss := 1;
Form1.Width:=1010;
Form1.Height:=210;
DrawTimer := TTimer.Create(Self);
DrawTimer.Enabled:= False;
DrawTimer.Interval:= 83;
DrawTimer.OnTimer:= @OnPaint;
end;
procedure TForm1.FormClick(Sender: TObject);
begin
DrawTimer.Enabled:= True;
end;
procedure TForm1.OnPaint(sender: TObject); inline;
var
tex,tex2,bmp: TBGRABitmap;
e: Byte = 0;
td: TDateTime;
h,m,s,ms: word;
begin
td := Now;
bmp := TBGRABitmap.Create(1000,200,BGRA(0,0,0,0));
tex := TBGRABitmap(bmp.CreateBrushTexture(bScross,BGRA(28,28,0),BGRA(0,0,0),6,6,1));
tex2 := TBGRABitmap(bmp.CreateBrushTexture(bScross,BGRA(84,84,100),BGRA(0,0,0,0),30,30,1));
if FirstTime = 1 then
begin
FirstTime := 0;
bmp.FillRoundRectAntialias(0,0,1000,200,30,30,tex,[rrDefault],false);
bmp.FillRoundRectAntialias(0,0,1000,200,30,30,tex2,[rrDefault]);
end;
for e := 0 to 4 do
begin
if Pos >= 63 then Pos := 1;
bmp.DrawLineAntialias(poss+10,TData[pos]+10,poss+11,TData[pos+1]+10,BGRA(0,255,0), 2);
Poss := Poss + 1;
Pos := Pos + 1;
end;
bmp.FillRect(15+Poss, 0, poss+22, 200, tex, dmSet);
bmp.FillRect(15+Poss, 0, poss+22, 200, tex2, dmSetExceptTransparent);
if 32+Poss >= 990 then
begin
Poss := 10;
bmp.FillRectAntialias(9, 0, 32, 200, tex);
bmp.FillRectAntialias(9, 0, 32, 200, tex2);
end;
bmp.Draw(Canvas,5,5, false);
bmp.Free;
tex.Free;
tex2.Free;
DecodeTime(Now - td, m,h,s,ms);
WriteLn(Format('draw took %.3d msec', [ ms]));
end;
end.