简体   繁体   中英

C++ Bitmap Resource (RT_BITMAP) and PNG Image Format

An application I'm developing displays various PNG images to the user in a window, and it works fine. My question is more on the grounds on HOW my PNG's are stored in the PE. Currently, the PNG's are stored in the executable as a resource, under the RT_RCDATA Resource Type, as this is the most appropriate/relevant type I've found.

Question #1: Is there a more appropriate Resource Type for storing PNG's?

In addition, I noticed that there is a Resource Type that is suitable for BMP's (Bitmaps), named RT_BITMAP .

Question #2: Why is there a predefined resource type for Bitmaps, but not one for more widely used image formats, such as PNG/JPG?

Answer #1: Not really. There are no functions I'm aware of to work with PNG resources specifically, meaning that you've got to load the resource yourself manually before handballing the data to GDI+ or some other image-loading library. Whether the text reads RT_DATA or RT_IMG or RT_PNG or RT_JPG is more-or-less arbitrary, provided one does not introduce collisions with pre-existing resource-types.

Answer #2: Because at the time the resource-types were created, PNGs and JPGs were yet to be created. PNGs appeared around 1996 and JPGs about 1992.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM