unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
BGRAVirtualScreen, BGRABitmap,BGRABitmapTypes;
const
raster_data :Array[0..639] of String =('#110000','#120000','#150000','#1A0000','#200000','#250000','#290000','#2C0000','#300000','#330000','#370000','#3B0000',
'#3F0000','#430000','#460000','#4A0000','#4E0000','#520000','#560000','#590000','#5D0000','#610000','#650000','#690000','#6C0000','#700000','#750000','#780000',
'#7B0000','#7F0000','#840000','#880000','#8B0000','#8F0000','#930000','#970000','#9B0000','#9E0000','#A20000','#A60000','#AA0000','#AD0000','#B10000','#B50000',
'#BA0000','#BD0000','#C00000','#C40000','#C90000','#CD0000','#D00000','#D30000','#D80000','#DC0000','#DF0000','#E20000','#E60000','#EB0000','#EF0000','#F40000',
'#F80000','#FD0000','#FF0000','#FE0000','#FA0000','#F50000','#F10000','#EC0000','#E70000','#E30000','#E00000','#DD0000','#D90000','#D40000','#D00000','#CD0000',
'#CA0000','#C50000','#C10000','#BE0000','#BB0000','#B60000','#B20000','#AE0000','#AB0000','#A70000','#A30000','#9F0000','#9B0000','#980000','#940000','#900000',
'#8C0000','#890000','#850000','#810000','#7C0000','#790000','#760000','#720000','#6D0000','#690000','#660000','#630000','#5E0000','#5A0000','#570000','#530000',
'#4F0000','#4B0000','#470000','#440000','#400000','#3C0000','#380000','#340000','#310000','#2D0000','#290000','#250000','#210000','#1E0000','#1A0000','#160000',
'#120000','#0E0002','#090005','#050009','#01000E','#000012','#000016','#00001A','#00001E','#000022','#000025','#000029','#00002D','#000031','#000034','#000038',
'#00003C','#000040','#000044','#000047','#00004B','#00004F','#000054','#000057','#00005A','#00005E','#000063','#000066','#00006A','#00006D','#000072','#000076',
'#000079','#00007D','#000081','#000085','#000089','#00008C','#000090','#000094','#000098','#00009B','#00009F','#0000A3','#0000A8','#0000AB','#0000AE','#0000B2',
'#0000B7','#0000BB','#0000BE','#0000C1','#0000C6','#0000CA','#0000CD','#0000D1','#0000D5','#0000D9','#0000DD','#0000E0','#0000E3','#0000E7','#0000EC','#0000F1',
'#0000F5','#0000FA','#0000FE','#0000FF','#0000FD','#0000F8','#0000F4','#0000EF','#0000EA','#0000E5','#0000E2','#0000DF','#0000DC','#0000D7','#0000D3','#0000CF',
'#0000CC','#0000C9','#0000C4','#0000C0','#0000BD','#0000B9','#0000B5','#0000B1','#0000AD','#0000AA','#0000A6','#0000A2','#00009E','#00009A','#000097','#000093',
'#00008E','#00008B','#000088','#000084','#00007F','#00007B','#000078','#000075','#000070','#00006C','#000068','#000065','#000061','#00005D','#000059','#000056',
'#000052','#00004E','#00004A','#000046','#000043','#00003F','#00003B','#000037','#000033','#000030','#00002B','#000127','#000024','#000020','#00001D','#000019',
'#000015','#000011','#00030C','#000608','#000B04','#000F01','#001300','#001700','#001B00','#001F00','#002300','#002601','#002A00','#002E00','#003200','#003500',
'#003900','#003D00','#004200','#004500','#004800','#004C00','#005100','#005500','#005800','#005C00','#006000','#006400','#006700','#006B00','#006F00','#007300',
'#007700','#007A00','#007E00','#008200','#008600','#008A00','#008D00','#009100','#009600','#009900','#009C00','#00A000','#00A500','#00A900','#00AC00','#00AF00',
'#00B400','#00B800','#00BC00','#00BF00','#00C300','#00C700','#00CB00','#00CE00','#00D200','#00D600','#00DB00','#00DE00','#00E100','#00E400','#00E900','#00EE00',
'#00F200','#00F700','#00FB00','#00FF00','#00FF00','#00FB00','#00F700','#00F200','#00EE00','#00E900','#00E400','#00E100','#00DE00','#00DB00','#00D600','#00D200',
'#00CE00','#00CB00','#00C700','#00C300','#00BF00','#00BC00','#00B800','#00B400','#00AF00','#00AC00','#00A900','#00A500','#00A000','#009C00','#009900','#009600',
'#009100','#008D00','#008A00','#008600','#008200','#007E00','#007A00','#007700','#007300','#006F00','#006B00','#006700','#006400','#006000','#005C00','#005800',
'#005500','#005100','#004C00','#004800','#004500','#004200','#003D00','#003900','#003500','#003200','#002F00','#002B00','#012700','#002300','#001F00','#001A00',
'#001600','#001300','#011000','#040E00','#080E00','#0C0F00','#111100','#151400','#191700','#1D1B00','#202000','#242400','#272800','#2B2C00','#303000','#333300',
'#373700','#3B3B00','#3F3F00','#434300','#464600','#4A4A00','#4E4E00','#525200','#565600','#595900','#5D5D00','#616100','#656500','#686800','#6C6C00','#707000',
'#757500','#787800','#7B7B00','#7F7F00','#848400','#888800','#8B8B00','#8E8E00','#939300','#979700','#9A9A00','#9E9E00','#A2A200','#A6A600','#AAAA00','#ADAD00',
'#B1B100','#B5B500','#B9B900','#BDBD00','#C0C000','#C4C400','#C9C900','#CCCC00','#CFCF00','#D3D300','#D7D700','#DCDC00','#DFDF00','#E2E200','#E5E500','#EAEA00',
'#EFEF00','#F4F400','#F8F800','#FDFD00','#FFFF00','#FEFE00','#FAFA00','#F5F500','#F1F100','#ECEC00','#E7E700','#E3E300','#E0E000','#DDDD00','#D9D900','#D5D500',
'#D1D100','#CDCD00','#CACA00','#C6C600','#C1C100','#BEBE00','#BBBB00','#B7B700','#B2B200','#AEAE00','#ABAB00','#A8A800','#A3A300','#9F9F00','#9B9B00','#989800',
'#949400','#909000','#8C8C00','#898900','#858500','#818100','#7D7D00','#797900','#767600','#727200','#6D6D00','#6A6A00','#666600','#636300','#5E5E00','#5A5A00',
'#575700','#545400','#4F4F00','#4B4B00','#474700','#444400','#404000','#3C3C00','#383800','#343400','#313100','#2D2D00','#292900','#252500','#212100','#1D1D00',
'#191900','#151500','#121200','#101001','#0E0E05','#0E0E09','#0F0F0E','#121212','#151516','#18181A','#1D1D1E','#212121','#252525','#292929','#2D2D2D','#313131',
'#343434','#383838','#3C3C3C','#404040','#444444','#474747','#4B4B4B','#4F4F4F','#535353','#575757','#5A5A5A','#5E5E5E','#636363','#666666','#696969','#6D6D6D',
'#727272','#767676','#797979','#7C7C7C','#818181','#858585','#898989','#8C8C8C','#909090','#949494','#989898','#9B9B9B','#9F9F9F','#A3A3A3','#A7A7A7','#ABABAB',
'#AEAEAE','#B2B2B2','#B6B6B6','#BBBBBB','#BEBEBE','#C1C1C1','#C5C5C5','#CACACA','#CDCDCD','#D0D0D0','#D4D4D4','#D9D9D9','#DDDDDD','#E0E0E0','#E3E3E3','#E7E7E7',
'#ECECEC','#F1F1F1','#F5F5F5','#FAFAFA','#FEFEFE','#FFFFFF','#FDFDFD','#F8F8F8','#F4F4F4','#EFEFEF','#EBEBEB','#E6E6E6','#E2E2E2','#DFDFDF','#DCDCDC','#D8D8D8',
'#D3D3D3','#D0D0D0','#CDCDCD','#C9C9C9','#C4C4C4','#C0C0C0','#BDBDBD','#BABABA','#B5B5B5','#B1B1B1','#ADADAD','#AAAAAA','#A6A6A6','#A2A2A2','#9E9E9E','#9B9B9B',
'#979797','#939393','#8F8F8F','#8B8B8B','#888888','#848484','#7F7F7F','#7B7B7B','#787878','#757575','#707070','#6C6C6C','#696969','#656565','#616161','#5D5D5D',
'#595959','#565656','#525252','#4E4E4E','#4A4A4A','#464646','#434343','#3F3F3F','#3B3B3B','#373737','#333333','#303030','#2C2C2C','#282828','#242424','#202020',
'#1C1C1C','#171717','#141414','#111111');
var
hexColor: string;
red, green, blue: Byte;
j : integer;
logo : TBGRABitmap;
type
{ TForm1 }
TForm1 = class(TForm)
BGRAVirtualScreen1: TBGRAVirtualScreen;
Timer1: TTimer;
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure HexToRGB(hex: string; var r, g, b: Byte); // hexstring color conversion '#ff0000' red 255, green 0 , blue 0
begin
r := StrToInt('$' + Copy(hex, 2, 2));
g := StrToInt('$' + Copy(hex, 4, 2));
b := StrToInt('$' + Copy(hex, 6, 2));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
j := 0; // raster color index
logo := TBGRABitmap.Create('gtr1.png'); // 640 * 100 pixel
end;
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
var
i : integer;
begin
// raster bars cycle colors slow down with sleep
for i := 0 to 639 do
begin
hexColor := raster_data[j];
HexToRGB(hexColor, red, green, blue);
Bitmap.FillRect(i*8,0,i*8+8,100,RGBToColor(red,green,blue));
j:=j+3;
if(j>=639) then j:=0;
end;
Bitmap.StretchPutImage(rect(0,0,640,100),logo,dmDrawWithTransparency,255);
sleep(25); // sleep a bit please
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
BGRAVirtualScreen1.RedrawBitmap;
end;
end.