summary refs log tree commit diff stats
path: root/libs/cocos2d/Support/TGAlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/cocos2d/Support/TGAlib.h')
-rwxr-xr-xlibs/cocos2d/Support/TGAlib.h55
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
15enum {
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 */
25typedef 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!
41void tgaLoadHeader(FILE *file, tImageTGA *info);
42
43/// loads the image pixels. You shouldn't call this function directly
44void tgaLoadImageData(FILE *file, tImageTGA *info);
45
46/// this is the function to call when we want to load an image
47tImageTGA * tgaLoad(const char *filename);
48
49// /converts RGB to greyscale
50void tgaRGBtogreyscale(tImageTGA *info);
51
52/// releases the memory used for the image
53void tgaDestroy(tImageTGA *info);
54
55//#endif // TGA_LIB