TPicture.RegisterFileFormat('PNG', 'PNG graphics from DevExpress', TdxPNGImage);
Causes problems with delphi form streaming.
I have created some components using TPNGImage, when assign a PNG picture @ design delphi saves the png image using TdxPNGImage, when running the application without using any of your components the images are empty since the TdxPNGImage is not registered and i am not using any of your sources.
I think that you should not register TdxPNGImage for hanlind png objects for delphi 2009+, let delphi do its work. I think that this issue should affect many of the users running d2009+ and the only work around i can see is to use your gdiplus library which is not an option for me as well
We have closed this ticket because another page addresses its subject:
RAD Studio 2009 and later - Make TdxPNGImage class registration optional for loading PNG images
Hello Nick,
Thank you for the message.
I've tried to reproduce the problem you described, but failed, sorry.
Sorry, but it's difficult to give you a precise answer to your question, due to the lack of information. Could you please provide us with a sample project illustrating this problem? We'll test it and try to find an acceptable solution for you.
Thanks,
Valdemar
A sample project will not be of help since i need to supply component sources as well.
My problem is very specific, why do you register tdxpngimage and you force me to use you gdiplus library when i simple need to use delphi's png images.
If i modify your sources and comment the tdxpngimage registration will this cause me any problems ?
Are you able to disable picture registration and tdxpngimage with delphi 2009+ ?
Hello Nick,
It looks very strange. If you don't use our components, TdxPNGImage shouldn't be registered. Probably, you have some our units in your uses section, and these units refer to the dxGDIPlusClasses unit. To check this, please put a break point to the RegisterAssistants procedure in the dxGDIPlusClasses unit, and run your project. From a call stack you will see a unit that calls the dxGDIPlusClasses unit.
The TdxPNGImage is necessary for our controls, which use skins, for example the Ribbon or NavBar.
Thanks,
Valdemar
I am not using the components for specific application causing the issue (eg not using ribbon or anything else)
> The TdxPNGImage is necessary for our controls, which use skins, for example the Ribbon or NavBar.
I understand this, BUT do you have to register TdxPNGImage as default tpicture loaded for png images ?
Hello Nick,
I've tried to reproduce the problem you described, but failed, sorry. Attached is a small sample project, which seems to work fine at our end.
Please note that TPicture.LoadFromFile method detects the GraphicClass variable as TPngImage
Could you please provide me with step-by-step instructions on how to reproduce your problem, and I'll try to find an acceptable solution for you.
procedure TPicture.LoadFromFile(const Filename: string); var Ext: string; NewGraphic: TGraphic; GraphicClass: TGraphicClass; begin Ext := ExtractFileExt(Filename); Delete(Ext, 1, 1); GraphicClass := FileFormats.FindExt(Ext); if GraphicClass = nil then raise EInvalidGraphic.CreateFmt(SUnknownExtension, [Ext]); NewGraphic := GraphicClass.Create; try NewGraphic.OnProgress := Progress; NewGraphic.LoadFromFile(Filename); except NewGraphic.Free; raise; end; FGraphic.Free; FGraphic := NewGraphic; FGraphic.OnChange := Changed; Changed(Self); end;
Thanks,
Valdemar
Your sample worked cause you are using loadfromfile @ runt-time.
My problem is @ design time where png images are loaded as TdxPngImage, and then after when running the application form streaming will fail since your gdiplus unit is not been used from my project.
Trying to explain again. Create forms app and drop a TImage component, load a png image and you will see that the pngimage is based on TDxPngImage class which is not correct for me cause i do not want to use your components for the specific project and i am getting forced of doing this. Even worst i am linking against packages and this way i am been forced to deploy riboon packages just for having png image support
Hi Nick,
Thank you for the clarification. Apparently, the "PNG graphics from DevExpress" format was registered over other PNG formats. Hence, it's using as the default PNG format. Fortunately, the "Load Picture" standard dialog allows you to choose the necessary format when loading an image. Just choose another PNG-related item from the "Files of type" combo. I've attached a small screenshot for the clarification.
Does this help?
Thanks,
Serge
Ok, thank you for the work around, but again do you really have to register your png image with tpicture ?
Since d2009+ support png images i am get forced to be very carefull when loading png images and select the correct format from the image dialog
Oops, o tried your solution but no matter what the images are still loaded as TdxPNGImage, even if i select the correct png format from the image dialog. This is caused when the loadimage dialog simple select the extention and when the tpciture load from file is executed again you tpicture pnmg registration is been used which cause problems to me again.
Nick,
Yes, we used to register the TdxPNGImage for many versions of our controls. Discontinuing this would be a breaking change for our users. In any case, my tests show that the "Load Picture" dialog always detects file formats by file extensions, ignoring custom descriptions. This means that it always loads PNG images using the latest entry in the list of graphical formats ('PNG graphics from DevExpress' in our situation). I've updated the subject of this report, and am forwarding this ticket to our developers, for further processing. We'll discuss the situation, and try to find a solution.
Thanks,
Serge
> Discontinuing this would be a breaking change for our users
For delphi 2009+ it would not.
The only problem raised is when loading forms @ design time and with the TdxPngImage not register form streaming will fail and forms will loose their images. But still there is a solution for this. You can simple register the class with empty file description and extention this will result form streaming to work as expected in other words for delphi 2009+ instead of
TPicture.RegisterFileFormat('PNG', 'PNG graphics from DevExpress', TdxPNGImage);
you make a call to
TPicture.RegisterFileFormat('', '', TdxPNGImage);
Nick,
Thank you for the ideas. We'll take them into account when discussing this report.
Regards,
Serge
Nick,
We've decided to make the current behavior optional. The functionality will allow you to update the DEFINE directive in our units as your needs dictate, and rebuild our packages using the installer. I've created a new suggestion on your behalf: RAD Studio 2009 and later - Make TdxPNGImage class registration optional for loading PNG images
Thanks,
Serge