|
cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
|
00001 // 00002 // TGA lib for cocos2d-iphone 00003 // 00004 // sources from: http://www.lighthouse3d.com/opengl/terrain/index.php3?tgasource 00005 // 00006 00007 //#ifndef TGA_LIB 00008 //#define TGA_LIB 00009 00015 enum { 00016 TGA_OK, 00017 TGA_ERROR_FILE_OPEN, 00018 TGA_ERROR_READING_FILE, 00019 TGA_ERROR_INDEXED_COLOR, 00020 TGA_ERROR_MEMORY, 00021 TGA_ERROR_COMPRESSED_FILE, 00022 }; 00023 00025 typedef struct sImageTGA { 00026 int status; 00027 unsigned char type, pixelDepth; 00028 00030 short int width; 00031 00033 short int height; 00034 00036 unsigned char *imageData; 00037 int flipped; 00038 } tImageTGA; 00039 00041 void tgaLoadHeader(FILE *file, tImageTGA *info); 00042 00044 void tgaLoadImageData(FILE *file, tImageTGA *info); 00045 00047 tImageTGA * tgaLoad(const char *filename); 00048 00049 // /converts RGB to greyscale 00050 void tgaRGBtogreyscale(tImageTGA *info); 00051 00053 void tgaDestroy(tImageTGA *info); 00054 00055 //#endif // TGA_LIB