/
recoil.h
205 lines (175 loc) · 5.79 KB
/
recoil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// Generated automatically with "fut". Do not edit.
#pragma once
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RECOIL RECOIL;
RECOIL *RECOIL_New(void);
void RECOIL_Delete(RECOIL *self);
/**
* RECOIL version - major part.
*/
#define RECOIL_VERSION_MAJOR 6
/**
* RECOIL version - minor part.
*/
#define RECOIL_VERSION_MINOR 4
/**
* RECOIL version - micro part.
*/
#define RECOIL_VERSION_MICRO 0
/**
* RECOIL version as a string.
*/
#define RECOIL_VERSION "6.4.0"
/**
* Years RECOIL was created in.
*/
#define RECOIL_YEARS "2009-2023"
/**
* Short credits for RECOIL.
*/
#define RECOIL_CREDITS "Retro Computer Image Library (C) 2009-2023 Piotr Fusik\n"
/**
* Short license notice.
* Display after the credits.
*/
#define RECOIL_COPYRIGHT "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."
/**
* Maximum length of a supported platform palette file.
*/
#define RECOIL_MAX_PLATFORM_PALETTE_CONTENT_LENGTH 32768
/**
* Maximum length of a string returned by <code>GetPlatform()</code>.
*/
#define RECOIL_MAX_PLATFORM_LENGTH 22
/**
* Selects the PAL/NTSC video standard for applicable platforms.
* Resets all platform palettes loaded with <code>SetPlatformPalette</code> to default.
* @param self This <code>RECOIL</code>.
* @param ntsc <code>true</code> for NTSC, <code>false</code> for PAL
*/
void RECOIL_SetNtsc(RECOIL *self, bool ntsc);
/**
* Returns <code>true</code> if NTSC video standard is selected.
* @param self This <code>RECOIL</code>.
*/
bool RECOIL_IsNtsc(const RECOIL *self);
/**
* Sets a custom platform palette.
*
* <ul>
* <li>768-byte <code>ACT</code>/<code>PAL</code> file with an Atari 8-bit palette</li>
* <li><code>VPL</code> VICE Palette file with a C64 or C16 palette</li>
* </ul>
* <p>Returns <code>true</code> on success.
* @param self This <code>RECOIL</code>.
* @param filename Name of the file to decode. Only the extension is processed, for format recognition.
* @param content File contents.
* @param contentLength File length.
*/
bool RECOIL_SetPlatformPalette(RECOIL *self, const char *filename, uint8_t const *content, int contentLength);
/**
* Checks whether the filename extension is supported by RECOIL.
* <code>true</code> doesn't necessarily mean that the file contents is valid for RECOIL.
* With this function you can avoid reading files which are known to be unsupported.
* @param filename Name of the file to be checked.
*/
bool RECOIL_IsOurFile(const char *filename);
/**
* Decodes a picture file to an RGB bitmap.
* Returns <code>true</code> on success.
* @param self This <code>RECOIL</code>.
* @param filename Name of the file to decode. Only the extension is processed, for format recognition.
* @param content File contents.
* @param contentLength File length.
*/
bool RECOIL_Decode(RECOIL *self, const char *filename, uint8_t const *content, int contentLength);
/**
* Returns decoded image width.
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetWidth(const RECOIL *self);
/**
* Returns decoded image height.
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetHeight(const RECOIL *self);
/**
* Returns pixels of the decoded image, top-down, left-to-right.
* Each pixel is a 24-bit integer 0xRRGGBB.
* @param self This <code>RECOIL</code>.
*/
int const *RECOIL_GetPixels(const RECOIL *self);
/**
* Returns the computer family of the decoded file format.
* @param self This <code>RECOIL</code>.
*/
const char *RECOIL_GetPlatform(const RECOIL *self);
/**
* Returns original width of the decoded image (informational).
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetOriginalWidth(const RECOIL *self);
/**
* Returns original height of the decoded image (informational).
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetOriginalHeight(const RECOIL *self);
/**
* Returns horizontal pixel density per meter or zero if unknown.
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetXPixelsPerMeter(const RECOIL *self);
/**
* Returns vertical pixel density per meter or zero if unknown.
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetYPixelsPerMeter(const RECOIL *self);
/**
* Returns horizontal pixel density per inch or zero if unknown.
* @param self This <code>RECOIL</code>.
*/
float RECOIL_GetXPixelsPerInch(const RECOIL *self);
/**
* Returns vertical pixel density per inch or zero if unknown.
* @param self This <code>RECOIL</code>.
*/
float RECOIL_GetYPixelsPerInch(const RECOIL *self);
/**
* Returns the number of alternating frames the pictures is composed of.
*
* <ul>
* <li>1 means the picture doesn't flicker.</li>
* <li>2 means the picture is displayed by quickly alternating two sub-pictures.</li>
* <li>3 means the picture is displayed by alternating three sub-pictures.</li>
* </ul>
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetFrames(const RECOIL *self);
/**
* Returns number of unique colors in the decoded picture.
* @param self This <code>RECOIL</code>.
*/
int RECOIL_GetColors(RECOIL *self);
/**
* Converts the decoded picture to palette-indexed.
* Returns palette of 256 0xRRGGBB entries.
* Call <code>GetColors()</code> for the actual number of colors.
* Returns <code>null</code> if conversion fails,
* because there are more than 256 colors.
* @param self This <code>RECOIL</code>.
*/
int const *RECOIL_ToPalette(RECOIL *self);
/**
* Returns the palette-indexed picture,
* as a bitmap of <code>GetHeight()</code> rows of <code>GetWidth()</code> pixels.
* Call after <code>ToPalette()</code> returns non-null.
* @param self This <code>RECOIL</code>.
*/
uint8_t const *RECOIL_GetIndexes(const RECOIL *self);
#ifdef __cplusplus
}
#endif