Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Betriebssysteme (https://www.delphipraxis.net/27-betriebssysteme/)
-   -   PNG im IE(7) nicht darstellbar (https://www.delphipraxis.net/130639-png-im-ie-7-nicht-darstellbar.html)

Bernhard Geyer 11. Mär 2009 17:00


PNG im IE(7) nicht darstellbar
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ich erzeuge PNG's (PNG-Lib von LMD - Basiert auf PNGImage von Gustavo), welche jedoch im IE nicht dargestellt werden können.

Mein Code ist zur Erstellung der Transparenz ist:

Delphi-Quellcode:
    PngObj.RemoveTransparency;
    PngObj.CreateAlpha;

    RValue := GetRValue(TransColor);
    GValue := GetGValue(TransColor);
    BValue := GetBValue(TransColor);

    for y := 0 to PngObj.Height-1 do
    begin
      ScanLine     := PngObj.Scanline[y];
      ScanlineAlpha := PngObj.AlphaScanline[y];

      if Assigned(ScanlineAlpha) then
      begin
        for x := 0 to PngObj.Width-1 do
        begin
          //RGB-Wert des Pixels stimmt mit Transparenzfarbe überein
          if (ScanLine^.rgbtRed = RValue) and (ScanLine^.rgbtGreen = GValue) and (ScanLine^.rgbtBlue = BValue) then
          begin
            ScanlineAlpha^[x] := 0;
          end;

          Inc(Scanline);
        end;
      end;
    end;
Hat jemand eine Ahnung was dem PNG für den IE fehlt?

Bernhard Geyer 13. Mär 2009 15:17

Re: PNG im IE(7) nicht darstellbar
 
Gelöst. Fehler im Quellcode der Methode .RemoveTransparency

Fix:
Delphi-Quellcode:
...
    case ColorType of
      {Palette uses the TLMDPNGChunktRNS to store alpha}
      COLOR_PALETTE, COLOR_RGB, COLOR_GRAYSCALE:
      begin
       TRNS := Chunks.ItemFromClass(TLMDPNGChunkTRNS) as TLMDPNGChunkTRNS;
       if TRNS <> nil then Chunks.RemoveChunk(TRNS)
      end;
...


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:06 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