From 9cd57b731ab1c666d4a1cb725538fdc137763d12 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sat, 30 Jul 2011 11:19:14 -0400 Subject: Initial commit (version 0.2.1) --- libs/cocos2d/Support/TGAlib.h | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 libs/cocos2d/Support/TGAlib.h (limited to 'libs/cocos2d/Support/TGAlib.h') diff --git a/libs/cocos2d/Support/TGAlib.h b/libs/cocos2d/Support/TGAlib.h new file mode 100755 index 0000000..247084e --- /dev/null +++ b/libs/cocos2d/Support/TGAlib.h @@ -0,0 +1,55 @@ +// +// TGA lib for cocos2d-iphone +// +// sources from: http://www.lighthouse3d.com/opengl/terrain/index.php3?tgasource +// + +//#ifndef TGA_LIB +//#define TGA_LIB + +/** + @file + TGA image support + */ + +enum { + TGA_OK, + TGA_ERROR_FILE_OPEN, + TGA_ERROR_READING_FILE, + TGA_ERROR_INDEXED_COLOR, + TGA_ERROR_MEMORY, + TGA_ERROR_COMPRESSED_FILE, +}; + +/** TGA format */ +typedef struct sImageTGA { + int status; + unsigned char type, pixelDepth; + + /** map width */ + short int width; + + /** map height */ + short int height; + + /** raw data */ + unsigned char *imageData; + int flipped; +} tImageTGA; + +/// load the image header fields. We only keep those that matter! +void tgaLoadHeader(FILE *file, tImageTGA *info); + +/// loads the image pixels. You shouldn't call this function directly +void tgaLoadImageData(FILE *file, tImageTGA *info); + +/// this is the function to call when we want to load an image +tImageTGA * tgaLoad(const char *filename); + +// /converts RGB to greyscale +void tgaRGBtogreyscale(tImageTGA *info); + +/// releases the memory used for the image +void tgaDestroy(tImageTGA *info); + +//#endif // TGA_LIB -- cgit 1.4.1