Jonathon Reinhart
Jonathon Reinhart

Reputation: 137547

Save HBITMAP as PNG image using GDI?

I'm looking to save an HBITMAP to a PNG image. Is this possible using only the GDI API? (I'm using C, so no GDI+.) I have only found examples like this, to save to a BMP file. Or should I use libpng and use GetDIBits?

Related question (about reading).

Upvotes: 1

Views: 1698

Answers (2)

Chris Becke
Chris Becke

Reputation: 36131

The Microsoft Windows API does not expose any c++ classes directly from DLLs - The c++ standard does not define an ABI, and as such, the calling conventions and name mangling's used are left to specific implementations to define.

As such, up until Metro at least, all "C++" interfaces supported by the Windows OS have actually been a regular dll exporting a C compatible API, and an accompyining set of c++ header files with the necessary template and inline code.

As such, GDI+ has a Flat API documented in MSDN.

Upvotes: 2

Alexey Frunze
Alexey Frunze

Reputation: 62106

Unfortunately, GDI does not support PNGs.

Upvotes: 3

Related Questions