Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   GIF image transparent - wie (https://www.delphipraxis.net/168644-gif-image-transparent-wie.html)

eholzer 1. Jun 2012 13:14

GIF image transparent - wie
 
Hallo,

ich versuche verzweifelt ein GIF Image transparent in einem TImage darzustellen:

Delphi-Quellcode:
Image1.Picture.LoadFromFile('D:\Downloads\blumen00047.gif');
  gif := (Image1.Picture.Graphic as TGifImage);
  gif.Animate := true;
  if gif.IsTransparent then
    gif.Transparent:= true;
Das funktioniert leider nicht, d.h. die Animation funktioniert, aber hintergrund ist immer schwarz.
Was mache ich falsch?

Danke für die Hilfe
Eric

himitsu 1. Jun 2012 13:28

AW: GIF image transparent - wie
 
TImage nimmt standardmäßig als transparente Farbe, die Farbe des Pixel oben links (oder war's unten links) im geladenen Bild, wenn man nur das Transparent auf True setzt.
Bin mir nicht ganz sicher, aber ich glaub man kann die transparente Farbe auch einstellen, wo du dann explizit dein "Schwarz" angeben müstest.

DeddyH 1. Jun 2012 13:41

AW: GIF image transparent - wie
 
Es war unten links. Aber der TE setzt ja nicht TImage, sondern TGIFImage auf transparent, TImage würde laut Hilfe auch nicht funktionieren.
Zitat:

Anmerkung: Transparent wirkt sich nur dann aus, wenn in der Eigenschaft Picture ein TBitmap-Object enthalten ist.

eholzer 1. Jun 2012 13:45

AW: GIF image transparent - wie
 
Was ich noch probiert habe:

Delphi-Quellcode:
var Ext: TGIFGraphicControlExtension;
  begin
    Image1.Picture.LoadFromFile('D:\Downloads\blumen00047.gif');
    gif := (Image1.Picture.Graphic as TGifImage);
    Ext := TGIFGraphicControlExtension.Create(gif.Images[0]);
    Ext.Transparent := True;

    Ext.TransparentColorIndex :=
        gif.Images[0].ActiveColorMap[gif.Images[0].Pixels[0,
        gif.Height-1]];
    gif.Images[0].Extensions.Add(Ext);
   
    gif.Animate := true;
    if gif.IsTransparent then
       gif.Transparent:= true;
  end
Geht auch nicht - nur die Animation funktioniert.

Danke
Eric


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:37 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz