Delphi-Quellcode:
procedure BmpBlend(Source, Dest, New: TBitmap; const BlendFacktor: Byte = 50);
var
pat, paf, pan: PByteArray;
x, y: Integer;
begin
if Source.PixelFormat <> pf24bit then Source.PixelFormat := pf24bit;
if Dest.PixelFormat <> pf24bit then Dest.PixelFormat := pf24bit;
if New.PixelFormat <> pf24bit then New.PixelFormat := pf24bit;
for y := 0 to Dest.Height - 1 do
begin
pat := Dest.ScanLine[y];
paf := Source.ScanLine[y];
pan := New.ScanLine[y];
for x := 0 to (Dest.Width * 3) - 1 do
pan^[x]:= round(paf^[x] - ((paf^[x] - pat^[x]) / 100 * BlendFacktor));
end;
end;
Delphi-Quellcode:
procedure TFormX.ButtonXClick...
begin
BmpBlend(
Image1.Picture.Bitmap,
Image2.Picture.Bitmap,
Image1.Picture.Bitmap,
20);
Image1.Invalidate;
end;
Oder so, wenn es dir nur ums Blenden geht.