Browse Source

* fixed Bug in Lazarus PNG/JPEG export: swapped red and blue values when saving RGB* Formats

master
Bergmann89 11 years ago
parent
commit
d5c49ccbaf
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      glBitmap.pas

+ 8
- 4
glBitmap.pas View File

@@ -4920,7 +4920,7 @@ begin

rid.Width := Width;
rid.Height := Height;
rid.Depth := CountSetBits(FormatDesc.Range.r or FormatDesc.Range.g or FormatDesc.Range.b or FormatDesc.Range.a);
rid.Depth := CountSetBits(FormatDesc.RedMask or FormatDesc.GreenMask or FormatDesc.BlueMask or FormatDesc.AlphaMask);
rid.BitOrder := riboBitsInOrder;
rid.ByteOrder := riboLSBFirst;
rid.LineOrder := riloTopToBottom;
@@ -5977,13 +5977,15 @@ procedure TglBitmap.SavePNG(const aStream: TStream);
var
png: TPortableNetworkGraphic;
intf: TLazIntfImage;
raw: TRawImage;
begin
png := TPortableNetworkGraphic.Create;
intf := TLazIntfImage.Create(0, 0);
try
if not AssignToLazIntfImage(intf) then
raise EglBitmap.Create('unable to create LazIntfImage from glBitmap');
png.LoadFromIntfImage(intf);
intf.GetRawImage(raw);
png.LoadFromRawImage(raw, false);
png.SaveToStream(aStream);
finally
png.Free;
@@ -6513,13 +6515,15 @@ procedure TglBitmap.SaveJPEG(const aStream: TStream);
var
jpeg: TJPEGImage;
intf: TLazIntfImage;
raw: TRawImage;
begin
jpeg := TJPEGImage.Create;
intf := TLazIntfImage.Create(0, 0);
try
if not AssignToLazIntfImage(intf) then
raise EglBitmap.Create('unable to create LazIntfImage from glBitmap');
jpeg.LoadFromIntfImage(intf);
intf.GetRawImage(raw);
jpeg.LoadFromRawImage(raw, false);
jpeg.SaveToStream(aStream);
finally
intf.Free;
@@ -8559,4 +8563,4 @@ finalization
FreeAndNil(InitOpenGLCS);
{$ENDIF}

end.
end.

Loading…
Cancel
Save