-
-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Hello,
I've found that if you write a console application (no lcl) that use BGRABitmap library and someother standard fpc library that uses fcl-image (fpPdf for example), some errors like '"Portable Network Graphics" already has a reader class' could be issued when the application starts.
Look at the enclosed project for a sample.
This should be caused by the initialization code of the unit BGRAReadBMP, BGRAWriteBMP, BGRAReadPng, BGRAWritePNG that sometimes could be executed before the inizialization code of the standard fpc images-related units.
Surely there could be some workarounds:
- in a really really simple situation, like the enclosed project, I can change the order of the units in the uses clauses
- I can add in my project first uses clauses the standard fpc units:
FPReadJPEG,FPReadPNG,FPReadBMP(and the writers too if needed)
However there could be a smarter solution such as to add, maybe in the BGRABitmapTypes unit, a global variable tryToReplaceFPCImageReadersWriters of type boolean and then to use it in the initializalization code of the BGRABitmap units, for example:
initialization
BGRARegisterImageReader(ifPng, TBGRAReaderPNG, tryToReplaceFPCImageReadersWriters, 'Portable Network Graphics', 'png');This could be a valid option?
If you agree, I can make a pull request with the changes for you convenience.
Thanks for your amazing library,
Domenico