Re: [lazarus] Patch for reading LRE encoded BMP files
Sorry to ask before searching on the code base but... is there code to ENCODE RLE BMP files? I am building a support aplication (something like VNC with some aditional things we need)... Thanks. Horacio Sebastian Günther escribió: Hi *, attached is a small patch which enables the LCL to read RLE encoded BMP files (successfully tested with some hundreds of small 8 bpp bitmaps, 4 bpp should work as well). Maybe somebody wants to commit this small patch :) Diff is against Lazarus 0.9.24 Regards, Sebastian __ Información de NOD32, revisión 2841 (20080131) __ Este mensaje ha sido analizado con NOD32 antivirus system http://www.nod32.com _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Patch for reading LRE encoded BMP files
On Fri, 1 Feb 2008, Sebastian Günther wrote: > Michael Van Canneyt schrieb: > > > > I think the reason is historical: TFPBMPReader allows to override some > > methods, and lazarus did this to improve on performance. Meanwhile the > > TFPBMPReader also improved, but lazarus never 'sees' the improvements, since > > the methods are overridden. > > Okay, so what is to be done now? Fixing the LCL to use the fpimage > implementation? It's up to the Lazarus people to decide this. Maybe some parts of the fpImage API can be improved. Michael.
Re: [lazarus] Patch for reading LRE encoded BMP files
Michael Van Canneyt schrieb: I think the reason is historical: TFPBMPReader allows to override some methods, and lazarus did this to improve on performance. Meanwhile the TFPBMPReader also improved, but lazarus never 'sees' the improvements, since the methods are overridden. Okay, so what is to be done now? Fixing the LCL to use the fpimage implementation? - Sebastian _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Patch for reading LRE encoded BMP files
On Fri, 1 Feb 2008, Sebastian Günther wrote: > Giuliano Colla schrieb: > > > Maybe there's some inconsistency hanging around: > > > > in intgraphics.pas - TLazReaderBMP.InternalReadBody, when attempting to read > > RLE Bitmap: > > > > raise FPImageException.Create('4 bit RLE Bitmaps not supported'); > > > > raise FPImageException.Create('8 bit RLE Bitmaps not supported'); > > Exactly this is the reason why I wrote this patch. I think the reason is historical: TFPBMPReader allows to override some methods, and lazarus did this to improve on performance. Meanwhile the TFPBMPReader also improved, but lazarus never 'sees' the improvements, since the methods are overridden. Michael.
Re: [lazarus] Patch for reading LRE encoded BMP files
Giuliano Colla schrieb: Maybe there's some inconsistency hanging around: in intgraphics.pas - TLazReaderBMP.InternalReadBody, when attempting to read RLE Bitmap: raise FPImageException.Create('4 bit RLE Bitmaps not supported'); raise FPImageException.Create('8 bit RLE Bitmaps not supported'); Exactly this is the reason why I wrote this patch. - Sebastian _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Patch for reading LRE encoded BMP files
Michael Van Canneyt ha scritto: On Fri, 1 Feb 2008, Sebastian Günther wrote: Hi *, attached is a small patch which enables the LCL to read RLE encoded BMP files (successfully tested with some hundreds of small 8 bpp bitmaps, 4 bpp should work as well). I don't understand why this is needed, RLE bitmaps have been supported in fpimage since years ? Maybe there's some inconsistency hanging around: in intgraphics.pas - TLazReaderBMP.InternalReadBody, when attempting to read RLE Bitmap: raise FPImageException.Create('4 bit RLE Bitmaps not supported'); raise FPImageException.Create('8 bit RLE Bitmaps not supported'); Giuliano -- Giuliano Colla Whenever people agree with me, I always feel I must be wrong (O. Wilde) _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Patch for reading LRE encoded BMP files
Michael Van Canneyt schrieb: On Fri, 1 Feb 2008, Sebastian Günther wrote: Hi *, attached is a small patch which enables the LCL to read RLE encoded BMP files (successfully tested with some hundreds of small 8 bpp bitmaps, 4 bpp should work as well). I don't understand why this is needed, RLE bitmaps have been supported in fpimage since years ? Yes. I must admit that I don't really understand the relation between fpimage and LCL; but if you just use TBitmap within a Lazarus application and try to load a BMP file which is LRE encoded, you will get an exception that RLE encodings are not supported. - Sebastian _ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Patch for reading LRE encoded BMP files
On Fri, 1 Feb 2008, Sebastian Günther wrote: > Hi *, > > attached is a small patch which enables the LCL to read RLE encoded BMP files > (successfully tested with some hundreds of small 8 bpp bitmaps, 4 bpp should > work as well). I don't understand why this is needed, RLE bitmaps have been supported in fpimage since years ? Michael.
[lazarus] Patch for reading LRE encoded BMP files
Hi *, attached is a small patch which enables the LCL to read RLE encoded BMP files (successfully tested with some hundreds of small 8 bpp bitmaps, 4 bpp should work as well). Maybe somebody wants to commit this small patch :) Diff is against Lazarus 0.9.24 Regards, Sebastian 426a427 > FIsRLE: Boolean; // Is data RLE compressed? 432c433 < procedure SetupRead(nPalette, nRowBits: Integer; ReadPalette: Boolean); virtual; --- > procedure SetupRead(nPalette, nRowBits: Integer; ReadPalette, AIsRLE: Boolean); virtual; 443a445 > property IsRLE: Boolean read FIsRLE; 4411c4413 < procedure TLazReaderBMP.SetupRead(nPalette, nRowBits: Integer; ReadPalette: Boolean); --- > procedure TLazReaderBMP.SetupRead(nPalette, nRowBits: Integer; ReadPalette, AIsRLE: Boolean); 4415a4418 > FIsRLE := AIsRLE; 4443a4447,4449 > var > d: array[0..1] of Byte; > Offset: Integer; 4450c4456,4484 < TheStream.Read(LineBuf[0], ReadSize); --- > if IsRLE then > begin > Offset := 0; > while True do > begin > TheStream.Read(d[0], 2); > if d[0] > 0 then > begin > while d[0] > 0 do > begin > LineBuf[Offset] := d[1]; > Inc(Offset); > Dec(d[0]); > end; > end else > case d[1] of > 0, 1: break; // End of scanline or end of bitmap > 2: raise FPImageException.Create('RLE code #2 is not supported'); > else >begin > TheStream.Read(LineBuf[Offset], d[1]); > Inc(Offset, d[1]); > if Odd(d[1]) then >TheStream.Read(d[1], 1); // Jump to even file position >end; > end; > end; > end else > TheStream.Read(LineBuf[0], ReadSize); 4623c4657 < SetupRead(2, TheImage.Width, true); --- > SetupRead(2, TheImage.Width, True, False); 4627,4629c4661,4662 < BI_RGB: SetupRead(16, TheImage.Width * 4, true); < BI_RLE4: < raise FPImageException.Create('4 bit RLE Bitmaps not supported'); --- > BI_RGB: SetupRead(16, TheImage.Width * 4, True, False); > BI_RLE4: SetupRead(16, TheImage.Width * 4, True, True); 4636,4638c4669,4670 < BI_RGB: SetupRead(256, TheImage.Width * 8, true); < BI_RLE8: < raise FPImageException.Create('8 bit RLE Bitmaps not supported'); --- > BI_RGB: SetupRead(256, TheImage.Width * 8, True, False); > BI_RLE8: SetupRead(256, TheImage.Width * 8, True, True); 4669c4701 < SetupRead(0, TheImage.Width * 16, True); --- > SetupRead(0, TheImage.Width * 16, True, False); 4689c4721 < SetupRead(0, TheImage.Width * 24, True); --- > SetupRead(0, TheImage.Width * 24, True, False); 4712c4744 < SetupRead(0, TheImage.Width * 32, True); --- > SetupRead(0, TheImage.Width * 32, True, False); 4816c4848 < SetupRead(2, Img.Width, False); --- > SetupRead(2, Img.Width, False, False);