After twenty years of read-only it's time to read after write on this forum. Mostly, if I have a question, someone else had it before, but a few problems I didn't see the question nor an answer, or I don't know the right formulation to search in forum or wiki.
(Using FPC3.2.2, Laz 3.6 (2024-09-29) X86_64...win32/win64, OS=Win11).
When working straight on the data of a rawimage, I got weird effects.
(Not important for now: first enountered when using a mask for a photo to create the elements of a jigsaw-puzzel. Floodfill had sometimes strange behaviour, but I solved that after the awareness of the changing bitorder.)
More often I experienced some unforseen and unexpected changes of (RawImage) BitOrder, Depth, and Transparency. These changes happens when (saving and) loading files and thereafter working on the canvas. Maybe in other situations as well.
Convince yourself with the example in the appendix. Each click on the save-load button (a TBitBtn colored! clLime) induces a double textout.
What happens: Immediately after loading the bitorder is INorder, but after using the canvas (line, text) this changes to REVersed.
For a Tbitmap (pf24bit), this is all. Not a problem, unless 1-bit graphics.
If using a 32-bit Bmp the Depth AND Bpp will degrade to 24 at reload.
Except if you have active alpha-use, the text becomes complete transparent.
For a TPortableNetworkGraphic (pf24bit), immediately after loading the bitorder is also INorder, but bbp=32. This changes back to reversed-24 after textusage.
Using a PNG (pf32bit) only bitorder changes, wether or not using Alpha.
Although it has color (and A-shift=24, A-Precision=8), it seems all Alpha=0.
TJPEGImage has no change of bitorder, but becomes 32bit after loading, and the text transparent. Depth=32, Bpp=32, quite a lot alpha bits are set. A second save-load yiels also these results, but with a subtle surprise.
If starting with a JPG 32 bit, active alpha use, it looses (of course) its transparency after save-load, but still the same effects.
Maybe there are more surprises.
I never knew the RawImageDescription would change on the fly nor that the change was different depending on wich derivate (bmp, png, jpg) is in use. I appreciate if all the TFPImageBitmap descendants behave the same way, once beeing in memory.
Another issue is: I can't save a 1-bit Bmp (pf1bit). If I assign it to Png, I get 8-bits Grey with 2 colors.
Has anyone the same experience, or maybe can you even shine some light here?
Thanks in advance.
HvD.