1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-10-02 17:26:00 +03:00
gmenu2x/src/imageio.h
Maarten ter Huurne 8b17e2ef62 PNG: Make loadPNG() responsible for creating an RGBA surface.
Before this commit loadPNG() could return any surface format and the caller
was responsible for converting it to the desired format. However, in practice
all callers want a surface with an alpha channel and SDL only supports that
with 32bpp surfaces, so RGBA or a permutation thereof. So I changed the
contract for loadPNG() so it is required to return an RGBA surface, and
removed the conversion code in the callers.

The next step is to replace IMG_Load() by a function that calls libpng
directly and loads a fixed 32bpp pixel format. That way, we can drop the
SDL_image dependency and avoid unnecessary pixel format conversions.
2011-06-02 06:19:21 +02:00

13 lines
215 B
C++

#ifndef IMAGEIO_H
#define IMAGEIO_H
#include <string>
struct SDL_Surface;
/** Loads an image from a PNG file into a newly allocated 32bpp RGBA surface.
*/
SDL_Surface *loadPNG(const std::string &path);
#endif