Images

I found a solution for the imported images.

There are a lot of image types, which the FormBuilder can import into the FMX. To re-implement all readers, I have not enough time. So the best way is the ImageIO class of Java. There are a lot of plugins, which implement additional readers on GitHub. So it should be possible to enhance the application later. Currently the application can read BMP, JPEG, GIF, TIF, PICT, TARGA, PCT and PCX. The formats RAS, CALS and OIF cannot be read at the moment.

The binary content of the images are stored completely within the FMX. There is a reference to an image content list within the Canvas structure. The list contains a lot of pointers to the binary content of the images. But the length of the list doesn’t match to the number of imported images. So there are are more pointers as images. And I don’t see any length information of the content.

I have spent 4 nights to find a solution. Large images are split up into pieces of 0xFA00 bytes (64000 bytes). The last chunk is smaller. But the question is: how many chunks (and how many pointers to these chunks) belong to each image content?

A coincidence helped me a lot. I have found a pointer to an additional list in front of the image content reference list. The second list contains some numeric values. The number of values matches the number of imported images. The values match also to the image content length. So I found the image content length list.

I can now divide the length of each image by 0xFA00, which returns the number of chunks (if length mod 0xFA00 > 0, we will have one more chunk) of the image. The chunks of an image can now be copied into one byte array and read by the ImageIO class.

The images are ordered within the FMX file, so I can use an index between 1..n. These indices I have found within the Image description structure, which holds the coordinates and also the name of the image within the FMX.

The last step is the mapping between the image descriptors and its image content part by the image index.

Within the viewer I can display the image within the attribute table as thumbnail image.

Screenshot_Viewer

Leave a Reply