From: Bergmann89 Date: Sun, 24 Nov 2013 00:59:55 +0000 (+0100) Subject: * fixed Bug in Lazarus PNG/JPEG export: swapped red and blue values when saving RGB... X-Git-Url: https://git.delphigl.com/?a=commitdiff_plain;h=d5c49ccbaf8da189f750c0577eee4ac2ac5a3abc;p=LazOpenGLCore.git * fixed Bug in Lazarus PNG/JPEG export: swapped red and blue values when saving RGB* Formats --- diff --git a/glBitmap.pas b/glBitmap.pas index 04297fa..7c6e840 100644 --- a/glBitmap.pas +++ b/glBitmap.pas @@ -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. \ No newline at end of file