@Dizzy Danke, das hat mich schon 1, 2 schritte dem Ziele näher gebracht.
Wie wende ich diese Procedure auf TImage32 an?
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, GR32_Image,GR32;
type
TForm1 =
class(TForm)
Image321: TImage32;
procedure CromaKey(ABitmap: TBitmap32; TrColor: TColor32);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CromaKey(ABitmap: TBitmap32; TrColor: TColor32);
var
P: PColor32;
C: TColor32;
I: Integer;
begin
TrColor := TrColor
and $00FFFFFF;
// erase alpha, (just in case it has some)
with ABitmap
do
begin
P := PixelPtr[0, 0];
for I := 0
to Width * Height - 1
do
begin
C := P^
and $00FFFFFF;
// get RGB without alpha
if C = TrColor
then // is this pixel "transparent"?
P^ := C;
// write RGB with "transparent" alpha back into the SrcBitmap
Inc(P);
// proceed to the next pixel
end;
end;
end;
end.