openMSX
Classes | Functions
openmsx::PNG Namespace Reference

Utility functions to hide the complexity of saving to a PNG file. More...

Classes

struct  PNGReadHandle
 
struct  PNGWriteHandle
 

Functions

SDLSurfacePtr load (const std::string &filename, bool want32bpp)
 Load the given PNG file in a SDL_Surface. More...
 
void save (unsigned width, unsigned height, const void **rowPointers, const SDL_PixelFormat &format, const std::string &filename)
 
void save (unsigned width, unsigned height, const void **rowPointers, const std::string &filename)
 
void saveGrayscale (unsigned width, unsigned height, const void **rowPointers, const std::string &filename)
 

Detailed Description

Utility functions to hide the complexity of saving to a PNG file.

Function Documentation

◆ load()

SDLSurfacePtr openmsx::PNG::load ( const std::string &  filename,
bool  want32bpp 
)

Load the given PNG file in a SDL_Surface.

This SDL_Surface is either 24bpp or 32bpp, depending on whether the PNG file had an alpha layer. But it's possible to force a 32bpp surface. The surface will use RGB(A) or BGR(A) format depending on the current display format.

Definition at line 92 of file PNG.cc.

References SDLSurfacePtr::getLinePtr(), openmsx::MSXException::getMessage(), openmsx::PNG::PNGReadHandle::info, openmsx::PNG::PNGReadHandle::ptr, swap(), and VLA.

Referenced by openmsx::VisibleSurface::createSurface(), and openmsx::SDLImage::SDLImage().

◆ save() [1/2]

void openmsx::PNG::save ( unsigned  width,
unsigned  height,
const void **  rowPointers,
const SDL_PixelFormat &  format,
const std::string &  filename 
)

Definition at line 382 of file PNG.cc.

◆ save() [2/2]

void openmsx::PNG::save ( unsigned  width,
unsigned  height,
const void **  rowPointers,
const std::string &  filename 
)

Definition at line 396 of file PNG.cc.

◆ saveGrayscale()

void openmsx::PNG::saveGrayscale ( unsigned  width,
unsigned  height,
const void **  rowPointers,
const std::string &  filename 
)

Definition at line 402 of file PNG.cc.

Referenced by openmsx::Paper::save().