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

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu May 26 12:24:44 CEST 2016


Hi,

The internal FData field variable of TFPMemoryImage is of type
FPFItegerArray and is defined as follows:

  TFPIntegerArray = array [0..(maxint-1) div sizeof(integer)-1] of integer;
  PFPIntegerArray = ^TFPIntegerArray;

Unfortunately the FPImage unit is not documented at all. So I have the
following questions regarding that field variable:

1) I'm assuming FData is the raw image buffer of TFPMemoryImage where
   all the image pixel data is stored?

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? eg: a small 5x5 image and
   4000x4000 image uses the same amount of memory for example. It is
   obviously possible that I'm misunderstanding TFPMemoryImage
   completely. ;-)

3) The FData image buffer (assuming (1) is correct) uses Integer instead
   of Byte as it's element size. So I'm assuming a singe Integer hold
   all the colour information for a single pixel?
   But then again, I have noticed that TFPColor uses Word size data
   elements, thus the whole RGBA information per pixel will be 8 bytes
   of data, and Integer is only 4 bytes large.

4) What is the order in which the colour channel information is stored
   in memory? RGB, BGR, RGBA, BGRA, ARGB, ABGR etc?

5) Is the Alpha channel actually stored? I assume it is, because the
   Integer type is large enough to hold that information.


The reason for all these questions. I've got a image loaded in a
TFPMemoryImage instance. I need to pass the the raw pixel data buffer to
a 3rd party library for further processing. But I need to tell that
3rd party library a bit about the data I'm giving it (colour channel
size, colour channel order etc).

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



More information about the fpc-pascal mailing list