Have tried to merge several images but the result shown is
always only the last merged image.
Understand that I'm using BGRABitmap in some wrong way, but
can't figure what I'm doing wrong.
Have tried to follow
Add a painting handler in tutorial 5, but apperently
not understood it.
In my program I have a TImage showing a map from which I want to extract
colors by clicking in the image. For every pixel clicked, I create
a BGRABitmap containing only current selected color, that then is inserted into a dynamic array of TBGRABitmap.
At the same time the current color is drawn in a DrawGrid.
Associated with the DrawGrid is a CheckListBox.
When colors are selected by checking the CheckListBox, colors should
be merged together and the result be displayed in another TImage.
My code is as follows:
procedure TfrmExtractElevationCurves.chklbxColorsClickCheck(Sender: TObject);
var
n : integer;
bitmap, bmap : TBGRABitmap;
begin
Image1.Picture.Bitmap.Canvas.Brush.Color := clWhite;
Image1.Picture.Bitmap.Canvas.FillRect(0, 0, Image1.Width, Image1.Height);
bmap := TBGRABitmap.Create(Image1.Width, Image1.Height);
try
n := 0;
while n < chklbxColors.Count do
begin
if chklbxColors.Checked[n] then
begin
bitmap := FLayers[n];
bmap.PutImage(0, 0, bitmap, dmDrawWithTransparency);
end;
Inc(n);
end;
bmap.Draw(Image1.Picture.Bitmap.Canvas, 0, 0);
finally
FreeAndNil(bmap);
end;
end;
Any help about what I have done wrong appreciated!