unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes, BCTypes;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAVirtualScreen1: TBGRAVirtualScreen;
BGRAVirtualScreen2: TBGRAVirtualScreen;
Timer1: TTimer;
Timer2: TTimer;
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure BGRAVirtualScreen2Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
cpc_pic,mask : TBGRABitmap;
public
end;
var
Form1: TForm1;
y,i,j : integer;
loading_ : boolean;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Timer1Timer(Sender: TObject);
begin
BGRAVirtualScreen1.RedrawBitmap;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
BGRAVirtualScreen2.RedrawBitmap;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
cpc_pic := TBGRABitmap.Create('head2.png');
mask := TBGRABitmap.Create(320,200); // virtual bitmap
y:=0;i:=0;j:=0;
loading_ := true;
end;
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
begin
inc(i,8);
mask.PutImagePart( 0 , y, cpc_pic, Rect( 0, 0+y,i*2,1+y), dmSet);
if (loading_) then
begin
if i>=160 then
begin
i:=0;
y := y +8;
if (y>8*25) then
begin
inc(j);
y:= 0 + j;
if(j>7) then
begin
j:=7;
loading_ :=false;
end;
end;
end;
end;
bitmap.StretchPutImage(rect(0,0,640,400),mask,dmSet);
end;
// loading bars :
procedure TForm1.BGRAVirtualScreen2Redraw(Sender: TObject; Bitmap: TBGRABitmap);
var
y,b,h : integer;
begin
b:=2;
y:=0;
h:= BGRAVirtualScreen2.Height;
if (loading_) then begin
while y<h do
begin
b := 1+Random(16);
bitmap.FillRect(0, y+b, 754, 8+y+b, BGRA(0,0,250),dmSet);
y:=y+b;
end;
end;
end;
end.