From: Alexander Shulgin <alex.shulgin@gm...> - 2008-05-26 09:37:04
On Sun, May 25, 2008 at 8:57 PM, Glenn Randers-Pehrson
> At 02:11 PM 5/23/2008 +0200, Ulises Valli wrote:
>>Hi, How can i convert a PNG to a HBITMAP handle with LIBPNG ?
> Do we still have any Windows gurus here who could answer the question?
Don't want to be dubbed as 'Windows guru', but I think I know how to
do this, because I've done so once a few years back. :-)
Needless to say, it's impossible to do this in pure libpng--but you'll
need it to load the PNG file in memory and convert it to RGB (or RGBA)
color format. After this, use Windows GDI functions like
CreateDIBSection, CreateCompatibleBitmap, etc. to create a HBITMAP
object and SetDIBits to copy data bytes from the decoded PNG image to
the bitmap's buffer.
Sorry, I don't have a working example for this--you'll have to figure
out the rest yourself. Feel free to ask me a question if
documentation (MSDN) isn't clear enough for you. ;-)
Tip: use google's cache if the page does not load.
Get latest updates about Open Source Projects, Conferences and News.