Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
Delphi 2005 Professional
|
Re: Gif bei verkleinerter Bildauflösung farblich stark verä
15. Sep 2005, 13:25
Das glaub ich Dir ja, nur schaff ich es irgendwie nich den Code so umzusetzen das mei Bildchen Transparent wird.
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);
procedure FormCreate(Sender: TObject);
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;
procedure TForm1.FormCreate(Sender: TObject);
begin
CromaKey(Image321.Bitmap, $00FF00FF);
end;
end.
|
|
Zitat
|