Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
Delphi 2005 Professional
|
Re: Gif bei verkleinerter Bildauflösung farblich stark verä
13. Sep 2005, 23:01
Irgendwie versag ich hier schon beim einfachsten, TBitmap32, undefinierter begriff.
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, GR32_Image;
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 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.
|
|
Zitat
|