diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-07-30 11:19:14 -0400 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-07-30 11:19:14 -0400 |
commit | 9cd57b731ab1c666d4a1cb725538fdc137763d12 (patch) | |
tree | 5bac45ae5157a1cb10c6e45500cbf72789917980 /libs/cocos2d/Support/TGAlib.h | |
download | cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.gz cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.tar.bz2 cartcollect-9cd57b731ab1c666d4a1cb725538fdc137763d12.zip |
Initial commit (version 0.2.1)
Diffstat (limited to 'libs/cocos2d/Support/TGAlib.h')
-rwxr-xr-x | libs/cocos2d/Support/TGAlib.h | 55 |
1 files changed, 55 insertions, 0 deletions
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 @@ | |||
1 | // | ||
2 | // TGA lib for cocos2d-iphone | ||
3 | // | ||
4 | // sources from: http://www.lighthouse3d.com/opengl/terrain/index.php3?tgasource | ||
5 | // | ||
6 | |||
7 | //#ifndef TGA_LIB | ||
8 | //#define TGA_LIB | ||
9 | |||
10 | /** | ||
11 | @file | ||
12 | TGA image support | ||
13 | */ | ||
14 | |||
15 | enum { | ||
16 | TGA_OK, | ||
17 | TGA_ERROR_FILE_OPEN, | ||
18 | TGA_ERROR_READING_FILE, | ||
19 | TGA_ERROR_INDEXED_COLOR, | ||
20 | TGA_ERROR_MEMORY, | ||
21 | TGA_ERROR_COMPRESSED_FILE, | ||
22 | }; | ||
23 | |||
24 | /** TGA format */ | ||
25 | typedef struct sImageTGA { | ||
26 | int status; | ||
27 | unsigned char type, pixelDepth; | ||
28 | |||
29 | /** map width */ | ||
30 | short int width; | ||
31 | |||
32 | /** map height */ | ||
33 | short int height; | ||
34 | |||
35 | /** raw data */ | ||
36 | unsigned char *imageData; | ||
37 | int flipped; | ||
38 | } tImageTGA; | ||
39 | |||
40 | /// load the image header fields. We only keep those that matter! | ||
41 | void tgaLoadHeader(FILE *file, tImageTGA *info); | ||
42 | |||
43 | /// loads the image pixels. You shouldn't call this function directly | ||
44 | void tgaLoadImageData(FILE *file, tImageTGA *info); | ||
45 | |||
46 | /// this is the function to call when we want to load an image | ||
47 | tImageTGA * tgaLoad(const char *filename); | ||
48 | |||
49 | // /converts RGB to greyscale | ||
50 | void tgaRGBtogreyscale(tImageTGA *info); | ||
51 | |||
52 | /// releases the memory used for the image | ||
53 | void tgaDestroy(tImageTGA *info); | ||
54 | |||
55 | //#endif // TGA_LIB | ||