[Lazarus] Strange issue with TImage and lazarus 2.2.2

Werner Pamler werner.pamler at freenet.de
Fri Jun 24 11:09:17 CEST 2022


Vampyre has its own file format registration system. There is a class 
TImageFileFormat, and there is a list ImageFileFormats which stores the 
parameters for all known file formats. Each file format has a 
reader/writer unit, and these units add the file format to the 
ImageFileFormatsList if such a unit exists in a uses clause.

FPC has a similar registration system, it registeres its own 
reader/writers in a similar list, ImageHandlers.

Vampyre does not take care of the FPC image type registration. But 
that's not the problem...

To make things worse, LCL has another registration system for the image 
types known to TPicture. There is a list TPicFileFormatsList which 
stores pointers to TPicFileFormat records. The instance of this list, 
PicFileFormats, is accessible only via a factory function 
GetPicFileformats which is not accessible from the outside. The formats 
known to the TPicture are added in the constructor of 
TPicFileFormatsList, again fully hidden inside the picture.inc. It is my 
impression there is no way to register a new format in any way without 
modifying the sources of TPicture.

This is bad... In my opinion, the TPicture file format registration 
should be moved into the interface part of the graphics unit so that the 
user can add his own image formats. Then Vampyre could call 
GetPicFileFormats.Add and provide the information for its own 
readers/writers; if there are duplicate formats the old ones should be 
removed in the Add call.

Werner



More information about the lazarus mailing list