[fpc-pascal] Questions regarding FPImage's TFPMemoryImage.FData variable

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu May 26 13:14:36 CEST 2016


Playing around further I've managed to get something kinda working. See
attached image. Left is what I now render via my 3rd party image
library, right is what it is supposed to look like.

  Two points to note about the attached image:
    1. The colours are obviously wrong.
    2. The image seems stretched horizontally. I'm not sure if this
       is due to the TFPColor being Word size elements instead of
       Byte size elements.

On 2016-05-26 11:24, Graeme Geldenhuys wrote:
> 1) I'm assuming FData is the raw image buffer of TFPMemoryImage where
>    all the image pixel data is stored?

I seem to have answered this myself by simply trying it and casting
TFPMemoryImage to a "friend class" (hack) so I can access the protected
FData field variable.


> 2) Nowhere in TFPMemoryImage is the size of FData being set, it seem
>    it is always a hard-coded size, based on the type declaration
>    shown above. Isn't this inefficient?

Afterwards I found the TFPMemoryImage.SetSize() which reallocates memory
based on the image dimensions. So memory usage is not hard-coded as I
first thought.

My earlier questions 3, 4 and 5 I still don't have answers to.



Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled-1.png
Type: image/png
Size: 9587 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160526/0c27b1e5/attachment.png>


More information about the fpc-pascal mailing list