Advertisement

Libpng: writing PNG files...

Started by July 10, 2004 06:17 PM
10 comments, last by Max_Payne 20 years, 4 months ago
I recently used libpng in writing out as .PNG file. I overloaded their error routine and replaced by my custom error handler. libpng.txt should give you all the required details I guess. go for a step-by-step check of your execution to know the exact place where it calls the error routine.

this should be of some help I guess. post if u need any more specific help

~ matt
Quote: Original post by taurean
I recently used libpng in writing out as .PNG file. I overloaded their error routine and replaced by my custom error handler. libpng.txt should give you all the required details I guess. go for a step-by-step check of your execution to know the exact place where it calls the error routine.

this should be of some help I guess. post if u need any more specific help

~ matt


I went with haro's suggestion instead... Lets just say corona has a bit of a better API:

/******************************************************** Function: CImage::SavePNG()* Purpose : Save image data to a PNG file* Initial : Max Payne on July 10, 2004********************************************************Revisions and bug fixes:*/bool CImage::SavePNG(const char* FilePath){	// Make sure there is image data	if (!m_pImageData)		return false;	// Create a corona image	corona::Image* pImage = corona::CreateImage(m_Width, m_Height, corona::PF_R8G8B8, m_pImageData);	// Make sure the image was created	if (!pImage)		return false;	// Save the image to a PNG file	corona::SaveImage(FilePath, corona::FF_PNG, pImage);	// Delete the corona image	delete pImage;	// Nothing went wrong	return true;}


Its not that I don't like non-oop code... Its that libpng's code is just awful. Oh yeah, and corona worked out of the box, in under 10 minutes ;) Thumbs up!

Looking for a serious game project?
www.xgameproject.com

This topic is closed to new replies.

Advertisement