--- On Thu, 4/21/11, michael.vancann...@wisa.be <michael.vancann...@wisa.be> wrote:
> From: michael.vancann...@wisa.be <michael.vancann...@wisa.be> > Subject: Re: [fpc-pascal] FPImage and GetDataLineStart > To: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org> > Date: Thursday, April 21, 2011, 11:09 AM > > > On Thu, 21 Apr 2011, Leonardo M. Ramé wrote: > > > --- On Thu, 4/21/11, Marco van de Voort <mar...@stack.nl> > wrote: > > > >> From: Marco van de Voort <mar...@stack.nl> > >> Subject: Re: [fpc-pascal] FPImage and > GetDataLineStart > >> To: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org> > >> Date: Thursday, April 21, 2011, 6:41 AM > >> In our previous episode, Sven Barth > >> said: > >> > Am 20.04.2011 22:20, schrieb Leonardo M. > Ram?: > >> > > Hi, I need to write a function that > replaces > >> TLazIntfImage by using fpImage, and I can't find > an > >> alternative to GetDataLineStart. How can I replace > it?. > >> > > Maybe I get your intention wrong, but > TLazIntfImage is > >> already using > fpImage and it derives from a > TFPCustomImage itself. > >> > >> True, but TFPCustomImage is abstact wrt memory > layout and > >> doens't provide > >> row level access, only pixel level access. > >> > >> Only TFPMemoryImage adds the memory access, but > IIRC only > >> 64-bit pixels. > >> (16-bit RGBA) > >> > >> While these abstractions make it easy to make > fp/fcl-image > >> somewhat > >> complete, they are also very memory hungry and > slow. > >> > >> IIRC I accelerated loading/saving simple 8-bit BMP > images > >> 20 to 50 times in > >> my work code. > >> > > > > Do you care to share some insights about what you did > to accelerate it? > > It is really very easy to accelerate it: > > * Create a TFPCustomImage descendant that is limited to the > bit depth you need. > * Do not use palette. > * Implement GetPixel and SetPixel so they convert from > 64-bit from/to the depth you used > * Implement a GetScanLine/SetScanLine specific to your bit > depth. > > You can now load/save the image very fast using the > GetScanLine/SetScanLine, > and all other FPIMage operations will work equally well. > > Following prior discussions on the list, I have a sample > implementation > ready (simple RGB, no alpha), but it is not yet committed. > It's maybe 20 lines of code. > > I'll try and commit it tonight. > > Michael. > -----Inline Attachment Follows----- Thanks Michael and Marco, now I have a *more* clever idea of how to do it. Leonardo M. Ramé http://leonardorame.blogspot.com _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal