1 /*
2  *------------------------------------------------------------
3  * Copyright(c) 2009-2010 by Digital Media Professionals Inc.
4  * All rights reserved.
5  *------------------------------------------------------------
6  * This source code is the confidential and proprietary
7  * of Digital Media Professionals Inc.
8  *------------------------------------------------------------
9  */
10 /* re-formed by Nintendo */
11 
12 #ifndef DMP_TGA_H
13 #define DMP_TGA_H
14 #include <nn/fs.h>
15 
16 #ifdef WIN32
17 #   ifdef DMPIMG_EXPORTS
18 #   define IMAGE_API __declspec(dllexport)
19 #   else
20 #   define IMAGE_API __declspec(dllimport)
21 #   endif
22 #else
23 #   define IMAGE_API
24 #endif
25 
26 /*
27  *
28  */
29 enum {
30     IMAGE_TRUE  = 0,
31     IMAGE_FALSE = 1
32 };
33 
34 /*
35  *
36  */
37 enum {
38     IMAGE_NONE = 0
39 };
40 
41 /*
42  * image format
43  */
44 
45 #define IMAGE_RGB                   0x1907
46 #define IMAGE_RGBA                  0x1908
47 
48 #define IMAGE_BGR                   0x80E0
49 #define IMAGE_BGRA                  0x80E1
50 
51 /*
52 #define IMAGE_RGB8                  0x8051
53 #define IMAGE_RGBA8                 0x8058
54 */
55 
56 /*
57  * Data types
58  */
59 #define IMAGE_BYTE                  0x1400
60 #define IMAGE_UNSIGNED_BYTE         0x1401
61 #define IMAGE_SHORT                 0x1402
62 #define IMAGE_UNSIGNED_SHORT        0x1403
63 #define IMAGE_INT                   0x1404
64 #define IMAGE_UNSIGNED_INT          0x1405
65 #define IMAGE_FLOAT                 0x1406
66 
67 /*
68  * Orientation
69  */
70 #define IMAGE_LOWER_LEFT            0x8CA1
71 #define IMAGE_UPPER_LEFT            0x8CA2
72 
73 /*
74  * image file format
75  */
76 enum {
77     IMAGE_UNKNOWN                   = 0x0000,
78 
79     IMAGE_RAW32                     = 0xec01,
80     IMAGE_RAW24,
81 
82     IMAGE_BMP                       = 0xec11,
83 
84     IMAGE_JPG                       = 0xec21,
85 
86     IMAGE_GIF                       = 0xec31,
87 
88     IMAGE_PNG                       = 0xec41,
89 
90     IMAGE_TGA32                     = 0xec51,
91     IMAGE_TGA24,
92     IMAGE_TGA32RLE                  = 0xec61,
93     IMAGE_TGA24RLE
94 };
95 
96 void *dmpLoadTGA(
97     const char *filename,
98     unsigned int *width,
99     unsigned int *height,
100     unsigned int *format,
101     unsigned int *type,
102     unsigned int *orientation);
103 
104 unsigned int dmpSaveTGA(
105     unsigned int fileformat,
106     const char *filename,
107     unsigned int width,
108     unsigned int height,
109     unsigned int format,
110     unsigned int type,
111     unsigned int orientation,
112     const void *pixels);
113 
114 #endif /* DMP_TGA_H */
115