[fpc-pascal] Questions regarding FPImage's TFPMemoryImage.FData variable
Michael Van Canneyt
michael at freepascal.org
Thu May 26 15:06:14 CEST 2016
On Thu, 26 May 2016, Graeme Geldenhuys wrote:
> On 2016-05-26 13:22, Michael Van Canneyt wrote:
>> Yes it does, but this is very slow.
>
> Probably due to Colors array usage. ;-)
>
>
>> Yes. But sometimes it is all you've got; e.g. when drawing on an image.
>
> Just so that others know, the 3rd party image library I’m using is
> AggPas. AggPas (like most other image libraries I would guess) uses
> ScanLine or pointers to bytes to speed up the manipulation of pixel data.
>
> With FPImage’s Colors array the pixel offsets in FData need to be
> calculated with every pixel accessed. That is a huge speed penalty.
The same is true for every array access ?
When drawing e.g. a red circle circle with given center and radius
on an image canvas, you have no choice but to calculate X,Y and
from there position in a scanline, which is an array etc.
I suppose aggpas does the same.
When moving data in bulk, then the colors array is slow,
but for all other access, I doubt it makes a huge difference.
>> For completeness, in fpImage: when doing 16 bit image, then
>> (16-bit color value)=(8-bit color value) shl 8 + (8-bit color value)
>
> Ah, so it duplicates the 8-bit value to fill the 16-bit Word. That also
> explains the rendered output I see - why my current code is partially
> working with AggPas.
>
> ps:
> Is anybody working, on or started at least, documenting FPImage yet?
Not to my knowledge.
Michael.
More information about the fpc-pascal
mailing list