00001 /********************************************************************* 00002 * lescegra * 00003 * * 00004 * http://geeky.kicks-ass.org/projects/lescegra.html * 00005 * * 00006 * Copyright 2003 by Enno Cramer <uebergeek@web.de> * 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Library General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free * 00020 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 *********************************************************************/ 00022 00023 #ifndef LSG_IMAGE_H 00024 #define LSG_IMAGE_H 1 00025 00026 #include <lescegra/util/object.h> 00027 00028 /** 00029 * \file image.h 00030 * \brief Bitmap 00031 */ 00032 00033 #define IMAGE_GRAYSCALE 1 00034 #define IMAGE_RGB 3 00035 #define IMAGE_RGBA 4 00036 00037 /** 00038 * \brief Bitmap 00039 * 00040 * A bitmap with a variable number of channel. 00041 * Every channel has a resolution of 8 bit per pixel. 00042 */ 00043 typedef struct { 00044 LsgObject super; 00045 int width; 00046 int height; 00047 int bpp; 00048 unsigned char* data; 00049 } LsgImage; 00050 00051 /** 00052 * Allocate and initialize an image with the given resolution and number 00053 * of channels. 00054 * @param width The width of the bitmap 00055 * @param height The height of the bitmap 00056 * @param bpp The number of channels 00057 * @return An image with the given width, height and number of channels 00058 */ 00059 LsgImage* LsgImage_create(int width, int height, int bpp); 00060 00061 void LsgImage_init(LsgImage* self, int width, int height, int bpp); 00062 void LsgImage_destroy(LsgImage* self); 00063 00064 /** 00065 * Load an image stored in PCX format. 00066 * @param filename The name of the PCX file 00067 * @return The bitmap stored in the file referenced by filename 00068 */ 00069 LsgImage* LsgImage_loadPCX(const char* filename); 00070 00071 /* LsgImage* LsgImage_loadTGA(const char* filename); */ 00072 00073 #endif