Einzelnen Beitrag anzeigen

Benutzerbild von Khabarakh
Khabarakh

Registriert seit: 18. Aug 2004
Ort: Brackenheim VS08 Pro
2.876 Beiträge
 
#9

Re: Gif bei verkleinerter Bildauflösung farblich stark verä

  Alt 13. Sep 2005, 19:18
Falls das nicht klar ist: GR32 unterstützt keine Bittransparenz (ColorKey-Transparenz, z.B. bei Gifs und den 1st-Party Komponenten), sondern "echte" 8-Bit-Transparenz für jedes Pixel (+RGB = 32-Bit Farbformat, z.B. bei PNG).

Für das Umrechnen gibt es allerdings eine Funktion auf der GR32-Website:
Delphi-Quellcode:
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;
Sebastian
Moderator in der EE
  Mit Zitat antworten Zitat