Quote
> So, I found that drawing in a transparent layer is very much time consuming operation especially with large, color bitmaps.
Yes, it is. For such operations I prefer direct access via ScanLine
property, although depending on the graphics driver and card "normal"
operations might be as fast or even faster. It depends very much on what
exactly you do, and sometimes you have to try different ways to find out
what's the best. It is not too difficult to use the ScanLine property if
you use the same PixelFormat for both bitmaps you want to combine (and
the same format for a third bitmap, the resulting one). But this
technique has its limits, too, especially for such big graphics your
machine gets very busy. The broblem is, that even if the ScanLine method
is faster, you have to draw the resulting bitmap to the screen, what
takes additional time. But you really have to try it, to find out what's
the fastest way...
Here a scanline example for 8 bit images (all bitmaps have to be of same
size):
var
Ptr1,Ptr2,Ptr3: ^Byte;
x,y: Integer;
begin
for y := 0 to Bitmap3.Height-1 do begin
Ptr1 := Bitmap1.ScanLine[y];
Ptr2 := Bitmap1.ScanLine[y];
Ptr3 := Bitmap1.ScanLine[y];
for x := 0 to Bitmap3.Width-1 do begin
if Ptr2^ = InvisibleColor then Ptr3^ = Ptr1^
else Ptr3^ := Ptr2^;
inc (Ptr1);
inc (Ptr2);
inc (Ptr3);
end;
end;
end;
Jens