Hi All
I have 3 different image objects with a resolution of 1920x1080, I can layer them and at the same time, I can display each image with a transparency value specific to the following code.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
bgrabitmap, BGRABitmapTypes,BGRALayers,
Classes, SysUtils, Forms, Controls, Graphics,
Dialogs, StdCtrls, ExtCtrls, Menus, Buttons, ComCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Render: TImage;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
TrackBar3: TTrackBar;
procedure BitBtn1Click(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
function blayers:Boolean;
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
function btobgra(bt:TBitmap):Tbgrabitmap;
var
br:Tbgrabitmap;
begin
result:=Tbgrabitmap.Create(bt,false);
end;
function TForm1.blayers:Boolean;
var
layer:TBGRALayeredBitmap;
begin
try
render.Picture:=nil;
render.canvas.Brush.Color:=clWhite;
render.canvas.FillRect(render.Canvas.ClipRect);
layer:=TBGRALayeredBitmap.Create(render.Width,render.Height);
layer.AddLayer(btobgra(Image1.Picture.Bitmap),TrackBar1.Position);
layer.AddLayer(btobgra(Image2.Picture.Bitmap),TrackBar2.Position);
layer.AddLayer(btobgra(Image3.Picture.Bitmap),TrackBar3.Position);
layer.Draw(Render.canvas,0,0);
layer.Free;
result:=true;
except
result:=false;
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var
cron:cardinal;
begin
cron:=GetTickCount64;
if blayers then TButton(sender).Caption:=floattostr((GetTickCount64-cron)/1000);
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
var
cron:cardinal;
begin
cron:=GetTickCount64;
if blayers then Form1.Caption:=floattostr((GetTickCount64-cron)/1000);
end;
end.
I am making possible changes within the trackbar onchange procedure.
In the meantime, there is a delay in imaging.
What's more, the white screen issue arises in continuous use.
Then I have to close the program.
I would gladly listen if there are any suggestions and suggestions to be able to do the above process without any problem simultaneously with the change of trackbar position.
Respects.