Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-06

Usage of TFPCustomImage

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

The class TFPCustomImage and its usage has apparently changed in FPC 3.0.2 (and trunk) compared to FPC 3.0.

This issue:
https://bugs.freepascal.org/view.php?id=32005
is marked for TLazIntfImage (in LCL) but actually the problematic procedure LoadFromStream is in TFPCustomImage.
Please read my note in the issue.

Question: how should TFPCustomImage be used now?
I guess TLazIntfImage must be changed accordingly.

Juha

Michael Van Canneyt
to Juha Manninen
Juha Manninen wrote 11 lines
The class TFPCustomImage and its usage has apparently changed in FPC 3.0.2 (and trunk) compared to FPC 3.0. This issue: https://bugs.freepascal.org/view.php?id=32005 is marked for TLazIntfImage (in LCL) but actually the problematic procedure LoadFromStream is in TFPCustomImage. Please read my note in the issue. Question: how should TFPCustomImage be used now? I guess TLazIntfImage must be changed accordingly.

As far as I know, nothing has changed in this regard in TFPCustomImage.

However, this method of loading an image depends on the order of the uses statements: each registered reader is asked in turn whether it recognizes the stream.

The first to answer 'yes' will be used to read the stream. If PNM 'falsely' recognizes a PNG stream as PNM, there is nothing you can do except tell the reader which format to use...

Michael.

Juha Manninen
to Michael Van Canneyt
Michael Van Canneyt wrote
However, this method of loading an image depends on the order of the uses statements: each registered reader is asked in turn whether it recognizes the stream.

The unit IntfGraphics in LCL does not have unit FPReadPNM in its uses clause. It has: FPReadBMP, FPReadPNG, FPReadTiff

The first to answer 'yes' will be used to read the stream. If PNM 'falsely' recognizes a PNG stream as PNM, there is nothing you can do except tell the reader which format to use...

Ok, I don't know how to do that. I don't even know how TFPCustomImage should be used without LCL + TLazIntfImage.
"Custom" in its name hints that a derived class should be used. Somebody else can study what happens in the code.

Juha