mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 04:20:39 +02:00
* add workaround for alpha channel on palette based PNG images for fpc2.4 (fixed in fpc r15926 #af088605bf). Fixes issue #0017267
git-svn-id: trunk@27242 -
This commit is contained in:
parent
115fb411b9
commit
32dbf71e3a
@ -5764,9 +5764,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazReaderPNG.HandleAlpha;
|
procedure TLazReaderPNG.HandleAlpha;
|
||||||
|
{$ifdef VER2_4}
|
||||||
|
var
|
||||||
|
n: Integer;
|
||||||
|
c: TFPColor;
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
inherited HandleAlpha;
|
inherited HandleAlpha;
|
||||||
FAlphaPalette := Header.ColorType = 3;
|
FAlphaPalette := Header.ColorType = 3;
|
||||||
|
|
||||||
|
// check for fpc 2.4, it expands the alpha channel wrong, so the MSByte isn't set
|
||||||
|
{$ifdef VER2_4}
|
||||||
|
if not FAlphaPalette then Exit;
|
||||||
|
for n := 0 to ThePalette.Count - 1 do
|
||||||
|
begin
|
||||||
|
c := ThePalette[n];
|
||||||
|
if c.Alpha and $FF00 <> 0 then Continue;
|
||||||
|
if c.Alpha = 0 then Continue;
|
||||||
|
c.Alpha := c.Alpha shl 8 or c.Alpha;
|
||||||
|
ThePalette[n] := c;
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazReaderPNG.InternalRead(Str: TStream; Img: TFPCustomImage);
|
procedure TLazReaderPNG.InternalRead(Str: TStream; Img: TFPCustomImage);
|
||||||
|
Loading…
Reference in New Issue
Block a user