Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
n64graphics.h
Go to the documentation of this file.
1 #ifndef N64GRAPHICS_H_
2 #define N64GRAPHICS_H_
3 
4 #include <stdint.h>
5 
6 // intermediate formats
7 typedef struct _rgba
8 {
9  uint8_t red;
10  uint8_t green;
11  uint8_t blue;
12  uint8_t alpha;
13 } rgba;
14 
15 typedef struct _ia
16 {
17  uint8_t intensity;
18  uint8_t alpha;
19 } ia;
20 
21 //---------------------------------------------------------
22 // N64 RGBA/IA/I/CI -> intermediate RGBA/IA
23 //---------------------------------------------------------
24 
25 // N64 raw RGBA16/RGBA32 -> intermediate RGBA
26 rgba *raw2rgba(const uint8_t *raw, int width, int height, int depth);
27 
28 // N64 raw IA1/IA4/IA8/IA16 -> intermediate IA
29 ia *raw2ia(const uint8_t *raw, int width, int height, int depth);
30 
31 // N64 raw I4/I8 -> intermediate IA
32 ia *raw2i(const uint8_t *raw, int width, int height, int depth);
33 
34 // N64 raw CI + palette -> intermediate RGBA
35 rgba *rawci2rgba(const uint8_t *rawci, const uint8_t *palette, int width, int height, int depth);
36 
37 
38 //---------------------------------------------------------
39 // intermediate RGBA/IA -> N64 RGBA/IA/I/CI
40 // returns length written to 'raw' used or -1 on error
41 //---------------------------------------------------------
42 
43 // intermediate RGBA -> N64 raw RGBA16/RGBA32
44 int rgba2raw(uint8_t *raw, const rgba *img, int width, int height, int depth);
45 
46 // intermediate IA -> N64 raw IA1/IA4/IA8/IA16
47 int ia2raw(uint8_t *raw, const ia *img, int width, int height, int depth);
48 
49 // intermediate IA -> N64 raw I4/I8
50 int i2raw(uint8_t *raw, const ia *img, int width, int height, int depth);
51 
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);
55 
56 
57 //---------------------------------------------------------
58 // intermediate RGBA/IA -> PNG
59 //---------------------------------------------------------
60 
61 // intermediate RGBA write to PNG file
62 int rgba2png(const char *png_filename, const rgba *img, int width, int height);
63 
64 // intermediate IA write to grayscale PNG file
65 int ia2png(const char *png_filename, const ia *img, int width, int height);
66 
67 
68 //---------------------------------------------------------
69 // PNG -> intermediate RGBA/IA
70 //---------------------------------------------------------
71 
72 // PNG file -> intermediate RGBA
73 rgba *png2rgba(const char *png_filename, int *width, int *height);
74 
75 // PNG file -> intermediate IA
76 ia *png2ia(const char *png_filename, int *width, int *height);
77 
78 
79 //---------------------------------------------------------
80 // version
81 //---------------------------------------------------------
82 
83 // get version of underlying graphics reading library
84 const char *n64graphics_get_read_version(void);
85 
86 // get version of underlying graphics writing library
87 const char *n64graphics_get_write_version(void);
88 
89 #endif // N64GRAPHICS_H_
struct _rgba rgba
const char * n64graphics_get_write_version(void)
Definition: n64graphics.c:502
rgba * rawci2rgba(const uint8_t *rawci, const uint8_t *palette, int width, int height, int depth)
Definition: n64graphics.c:167
int rgba2raw(uint8_t *raw, const rgba *img, int width, int height, int depth)
Definition: n64graphics.c:200
ia * raw2ia(const uint8_t *raw, int width, int height, int depth)
Definition: n64graphics.c:68
const char * n64graphics_get_read_version(void)
Definition: n64graphics.c:497
uint8_t alpha
Definition: n64graphics.h:18
uint8_t alpha
Definition: n64graphics.h:12
uint8_t blue
Definition: n64graphics.h:11
uint8_t green
Definition: n64graphics.h:10
uint8_t intensity
Definition: n64graphics.h:17
struct _ia ia
ia * raw2i(const uint8_t *raw, int width, int height, int depth)
Definition: n64graphics.c:125
ia * png2ia(const char *png_filename, int *width, int *height)
Definition: n64graphics.c:436
Definition: n64graphics.h:7
Definition: n64graphics.h:15
int ia2png(const char *png_filename, const ia *img, int width, int height)
Definition: n64graphics.c:344
rgba * png2rgba(const char *png_filename, int *width, int *height)
Definition: n64graphics.c:372
uint8_t red
Definition: n64graphics.h:9
rgba * raw2rgba(const uint8_t *raw, int width, int height, int depth)
Definition: n64graphics.c:37
int i2raw(uint8_t *raw, const ia *img, int width, int height, int depth)
Definition: n64graphics.c:282
int ia2raw(uint8_t *raw, const ia *img, int width, int height, int depth)
Definition: n64graphics.c:230
int rgba2png(const char *png_filename, const rgba *img, int width, int height)
Definition: n64graphics.c:318