Update README.md
[sm64pc.git] / tools / n64graphics.h
blob2ba8e0ad31bcef88fa89ab1662a9d49db141a39e
1 #ifndef N64GRAPHICS_H_
2 #define N64GRAPHICS_H_
4 #include <stdint.h>
6 // intermediate formats
7 typedef struct _rgba
9 uint8_t red;
10 uint8_t green;
11 uint8_t blue;
12 uint8_t alpha;
13 } rgba;
15 typedef struct _ia
17 uint8_t intensity;
18 uint8_t alpha;
19 } ia;
21 //---------------------------------------------------------
22 // N64 RGBA/IA/I/CI -> intermediate RGBA/IA
23 //---------------------------------------------------------
25 // N64 raw RGBA16/RGBA32 -> intermediate RGBA
26 rgba *raw2rgba(const uint8_t *raw, int width, int height, int depth);
28 // N64 raw IA1/IA4/IA8/IA16 -> intermediate IA
29 ia *raw2ia(const uint8_t *raw, int width, int height, int depth);
31 // N64 raw I4/I8 -> intermediate IA
32 ia *raw2i(const uint8_t *raw, int width, int height, int depth);
34 // N64 raw CI + palette -> intermediate RGBA
35 rgba *rawci2rgba(const uint8_t *rawci, const uint8_t *palette, int width, int height, int depth);
38 //---------------------------------------------------------
39 // intermediate RGBA/IA -> N64 RGBA/IA/I/CI
40 // returns length written to 'raw' used or -1 on error
41 //---------------------------------------------------------
43 // intermediate RGBA -> N64 raw RGBA16/RGBA32
44 int rgba2raw(uint8_t *raw, const rgba *img, int width, int height, int depth);
46 // intermediate IA -> N64 raw IA1/IA4/IA8/IA16
47 int ia2raw(uint8_t *raw, const ia *img, int width, int height, int depth);
49 // intermediate IA -> N64 raw I4/I8
50 int i2raw(uint8_t *raw, const ia *img, int width, int height, int depth);
52 // intermediate RGBA -> N64 raw CI + palette
53 // TODO
54 // int rgba2rawci(uint8_t *raw, uint8_t *out_palette, int *pal_len, const rgba *img, int width, int height, int depth);
57 //---------------------------------------------------------
58 // intermediate RGBA/IA -> PNG
59 //---------------------------------------------------------
61 // intermediate RGBA write to PNG file
62 int rgba2png(const char *png_filename, const rgba *img, int width, int height);
64 // intermediate IA write to grayscale PNG file
65 int ia2png(const char *png_filename, const ia *img, int width, int height);
68 //---------------------------------------------------------
69 // PNG -> intermediate RGBA/IA
70 //---------------------------------------------------------
72 // PNG file -> intermediate RGBA
73 rgba *png2rgba(const char *png_filename, int *width, int *height);
75 // PNG file -> intermediate IA
76 ia *png2ia(const char *png_filename, int *width, int *height);
79 //---------------------------------------------------------
80 // version
81 //---------------------------------------------------------
83 // get version of underlying graphics reading library
84 const char *n64graphics_get_read_version(void);
86 // get version of underlying graphics writing library
87 const char *n64graphics_get_write_version(void);
89 #endif // N64GRAPHICS_H_