Gel2D - The free/open source game creation suite

gelImage.h
Go to the documentation of this file.
00001 /*
00002 Gel2D Game Engine - Cross-platform 2D gaming middleware
00003 Copyright (C) 2010-2011 Mark D. Procarione
00004 
00005 Gel2D is free software: you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation, either version 3 of the License, or
00008 (at your option) any later version.
00009 
00010 Gel2D is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013 GNU General Public License for more details.
00014 */
00015 
00016 #ifndef __GELIMAGE_H__
00017 #define __GELIMAGE_H__
00018 
00019 #include "gelNamespace.h"
00020 
00021 namespace gel
00022 {
00024         struct GelImageData
00025         {
00027 
00028             GelImageData() : width(0), height(0), bpp(3), format(GEL_RGB), data(NULL) {};
00029 
00031 
00036             GelImageData( int w, int h, int b, ColorMode f, GELubyte *d ) : width(w), height(h), bpp(b), format(f), data(d) {};
00037 
00039         int width;
00041         int height;
00043         int bpp;
00045         ColorMode format;
00047         GELubyte *data;
00048         };
00049 
00050         class GelImage
00051     {
00052                 public:
00054 
00058                         static int readPNG ( const GelString &filename, GelImageData *image, bool po2 = false );
00060 
00062                         static int writePNG( const GelString &filename, GelImageData *image );
00063 
00065 
00069                         static int readTGA ( const GelString &filename, GelImageData *image, bool po2 = false );
00071 
00075                         static int writeTGA( const GelString &filename, GelImageData *image, ColorMode cmode, bool compress );
00076 
00078 
00082                         static int readJPG ( const GelString &filename, GelImageData *image, bool po2 = false );
00084 
00086                         static int writeJPG( const GelString &filename, GelImageData *image );
00087 
00088                 public:
00089                         static int Gelcmode2Icmode( int cmode );
00090                         static ColorMode Icmode2Gelcmode( int cmode );
00091                         static int Gelcmode2GLcmode( int cmode );
00092     };
00093 }
00094 
00095 #endif // __GELIMAGE_H__