1 unit Unit1;
2 
3 {$mode objfpc}{$H+}
4 
5 interface
6 
7 uses
8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
9   BGRAGraphicControl, BGRABitmap, BCTypes, BGRABitmapTypes;
10 
11 type
12 
13   { TForm1 }
14 
15   TForm1 = class(TForm)
16     BGRAGraphicControl1: TBGRAGraphicControl;
17     Timer1: TTimer;
18     procedure BGRAGraphicControl1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
19     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
20     procedure FormCreate(Sender: TObject);
21     procedure FormDestroy(Sender: TObject);
22     procedure Timer1Timer(Sender: TObject);
23   private
24     { private declarations }
25   public
26     { public declarations }
27     bkg: TBGRABitmap;
28   end;
29 
30 var
31   Form1: TForm1;
32 
33 implementation
34 
35 {$R *.lfm}
36 
37 { TForm1 }
38 
39 procedure TForm1.BGRAGraphicControl1Redraw(Sender: TObject; Bitmap: TBGRABitmap
40   );
41 var
42   i: integer;
43   bmp: TBGRABitmap;
44 begin
45   //Bitmap.Fill(BGRABlack);
46   Bitmap.FillTransparent;
47 
48   for i:= 0 to Bitmap.Width -1 do
49   begin
50     Bitmap.DrawVertLine(i,{Random(Bitmap.Height)}0,Random(Bitmap.Height),BGRA(255,255,255,Random(25)));
51     Bitmap.DrawVertLine(i,Random(Bitmap.Height),Random(Bitmap.Height),BGRA(255,255,255,Random(50)));
52   end;
53 
54   bmp := Bitmap.FilterBlurMotion(10,270,True) as TBGRABitmap;
55   BGRAReplace(bmp, bmp.FilterBlurRadial(1,rbFast));
56   Bitmap.BlendImageOver(0,0,bkg,boLinearBlend);
57   Bitmap.BlendImageOver(0,0,bmp,boLinearBlend);
58   bmp.Free;
59 end;
60 
61 procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
62 begin
63   Timer1.Enabled := False;
64 end;
65 
66 procedure TForm1.FormCreate(Sender: TObject);
67 begin
68   bkg := TBGRABitmap.Create('Lighthouse.jpg');
69 end;
70 
71 procedure TForm1.FormDestroy(Sender: TObject);
72 begin
73   bkg.Free;
74 end;
75 
76 procedure TForm1.Timer1Timer(Sender: TObject);
77 begin
78   BGRAGraphicControl1.DiscardBitmap;
79 end;
80 
81 end.
82 
83