[fpc-pascal] FPImage and GetDataLineStart

Luiz Americo Pereira Camara luizmed at oi.com.br
Thu Apr 21 13:46:45 CEST 2011


On 21/4/2011 06:41, Marco van de Voort wrote:
> 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.

Besides that there's not a uniform correlation between 16bit and 8bit. 
See thread 
http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg16506.html

the Lazarus implementation does the following to convert TColor (each 
color channel with 8bit) to TFPColor (16bit channels):

8bit  to 16bit : set low and high memory of each 16bit channel to the 
8bit counterpart
if 8bit Red channel is $0F the 16bit Red will be $0F0F

16bit  to 8bit: get the high memory of each 16bit channel
16 16bit Red is $001F the 8bit red will be $00

IMO is just wasting memory at least in the current implementation that 
takes no advantage of the wider color range.

Luiz

> IIRC I accelerated loading/saving simple 8-bit BMP images 20 to 50 times in
> my work code.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>




More information about the fpc-pascal mailing list