open_image 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +5 -0
- data/.yardopts +4 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +18 -0
- data/TODO.md +38 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/open_image/color.c +165 -0
- data/ext/open_image/color.h +27 -0
- data/ext/open_image/common.h +62 -0
- data/ext/open_image/extconf.rb +3 -0
- data/ext/open_image/image.c +398 -0
- data/ext/open_image/image.h +36 -0
- data/ext/open_image/open_image.c +16 -0
- data/ext/open_image/open_image.h +10 -0
- data/ext/open_image/point.c +96 -0
- data/ext/open_image/point.h +24 -0
- data/ext/open_image/rect.c +192 -0
- data/ext/open_image/rect.h +29 -0
- data/ext/open_image/size.c +100 -0
- data/ext/open_image/size.h +20 -0
- data/ext/open_image/stb_image.c +6997 -0
- data/ext/open_image/stb_image.h +453 -0
- data/ext/open_image/stb_image_write.c +1377 -0
- data/ext/open_image/stb_image_write.h +184 -0
- data/lib/open_image.rb +8 -0
- data/lib/open_image/colors.rb +166 -0
- data/lib/open_image/version.rb +3 -0
- data/open_image.gemspec +31 -0
- metadata +121 -0
@@ -0,0 +1,453 @@
|
|
1
|
+
/* stb_image - v2.19 - public domain image loader - http://nothings.org/stb
|
2
|
+
no warranty implied; use at your own risk
|
3
|
+
|
4
|
+
Do this:
|
5
|
+
#define STB_IMAGE_IMPLEMENTATION
|
6
|
+
before you include this file in *one* C or C++ file to create the implementation.
|
7
|
+
|
8
|
+
// i.e. it should look like this:
|
9
|
+
#include ...
|
10
|
+
#include ...
|
11
|
+
#include ...
|
12
|
+
#define STB_IMAGE_IMPLEMENTATION
|
13
|
+
#include "stb_image.h"
|
14
|
+
|
15
|
+
You can #define STBI_ASSERT(x) before the #include to avoid using assert.h.
|
16
|
+
And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free
|
17
|
+
|
18
|
+
|
19
|
+
QUICK NOTES:
|
20
|
+
Primarily of interest to game developers and other people who can
|
21
|
+
avoid problematic images and only need the trivial interface
|
22
|
+
|
23
|
+
JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)
|
24
|
+
PNG 1/2/4/8/16-bit-per-channel
|
25
|
+
|
26
|
+
TGA (not sure what subset, if a subset)
|
27
|
+
BMP non-1bpp, non-RLE
|
28
|
+
PSD (composited view only, no extra channels, 8/16 bit-per-channel)
|
29
|
+
|
30
|
+
GIF (*comp always reports as 4-channel)
|
31
|
+
HDR (radiance rgbE format)
|
32
|
+
PIC (Softimage PIC)
|
33
|
+
PNM (PPM and PGM binary only)
|
34
|
+
|
35
|
+
Animated GIF still needs a proper API, but here's one way to do it:
|
36
|
+
http://gist.github.com/urraka/685d9a6340b26b830d49
|
37
|
+
|
38
|
+
- decode from memory or through FILE (define STBI_NO_STDIO to remove code)
|
39
|
+
- decode from arbitrary I/O callbacks
|
40
|
+
- SIMD acceleration on x86/x64 (SSE2) and ARM (NEON)
|
41
|
+
|
42
|
+
Full documentation under "DOCUMENTATION" below.
|
43
|
+
|
44
|
+
|
45
|
+
LICENSE
|
46
|
+
|
47
|
+
See end of file for license information.
|
48
|
+
|
49
|
+
RECENT REVISION HISTORY:
|
50
|
+
|
51
|
+
2.19 (2018-02-11) fix warning
|
52
|
+
2.18 (2018-01-30) fix warnings
|
53
|
+
2.17 (2018-01-29) bugfix, 1-bit BMP, 16-bitness query, fix warnings
|
54
|
+
2.16 (2017-07-23) all functions have 16-bit variants; optimizations; bugfixes
|
55
|
+
2.15 (2017-03-18) fix png-1,2,4; all Imagenet JPGs; no runtime SSE detection on GCC
|
56
|
+
2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs
|
57
|
+
2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes
|
58
|
+
2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes
|
59
|
+
2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64
|
60
|
+
RGB-format JPEG; remove white matting in PSD;
|
61
|
+
allocate large structures on the stack;
|
62
|
+
correct channel count for PNG & BMP
|
63
|
+
2.10 (2016-01-22) avoid warning introduced in 2.09
|
64
|
+
2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED
|
65
|
+
|
66
|
+
See end of file for full revision history.
|
67
|
+
|
68
|
+
|
69
|
+
============================ Contributors =========================
|
70
|
+
|
71
|
+
Image formats Extensions, features
|
72
|
+
Sean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info)
|
73
|
+
Nicolas Schulz (hdr, psd) Martin "SpartanJ" Golini (stbi_info)
|
74
|
+
Jonathan Dummer (tga) James "moose2000" Brown (iPhone PNG)
|
75
|
+
Jean-Marc Lienher (gif) Ben "Disch" Wenger (io callbacks)
|
76
|
+
Tom Seddon (pic) Omar Cornut (1/2/4-bit PNG)
|
77
|
+
Thatcher Ulrich (psd) Nicolas Guillemot (vertical flip)
|
78
|
+
Ken Miller (pgm, ppm) Richard Mitton (16-bit PSD)
|
79
|
+
github:urraka (animated gif) Junggon Kim (PNM comments)
|
80
|
+
Christopher Forseth (animated gif) Daniel Gibson (16-bit TGA)
|
81
|
+
socks-the-fox (16-bit PNG)
|
82
|
+
Jeremy Sawicki (handle all ImageNet JPGs)
|
83
|
+
Optimizations & bugfixes Mikhail Morozov (1-bit BMP)
|
84
|
+
Fabian "ryg" Giesen Anael Seghezzi (is-16-bit query)
|
85
|
+
Arseny Kapoulkine
|
86
|
+
John-Mark Allen
|
87
|
+
|
88
|
+
Bug & warning fixes
|
89
|
+
Marc LeBlanc David Woo Guillaume George Martins Mozeiko
|
90
|
+
Christpher Lloyd Jerry Jansson Joseph Thomson Phil Jordan
|
91
|
+
Dave Moore Roy Eltham Hayaki Saito Nathan Reed
|
92
|
+
Won Chun Luke Graham Johan Duparc Nick Verigakis
|
93
|
+
the Horde3D community Thomas Ruf Ronny Chevalier github:rlyeh
|
94
|
+
Janez Zemva John Bartholomew Michal Cichon github:romigrou
|
95
|
+
Jonathan Blow Ken Hamada Tero Hanninen github:svdijk
|
96
|
+
Laurent Gomila Cort Stratton Sergio Gonzalez github:snagar
|
97
|
+
Aruelien Pocheville Thibault Reuille Cass Everitt github:Zelex
|
98
|
+
Ryamond Barbiero Paul Du Bois Engin Manap github:grim210
|
99
|
+
Aldo Culquicondor Philipp Wiesemann Dale Weiler github:sammyhw
|
100
|
+
Oriol Ferrer Mesia Josh Tobin Matthew Gregan github:phprus
|
101
|
+
Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo
|
102
|
+
Christian Floisand Kevin Schmidt github:darealshinji
|
103
|
+
Blazej Dariusz Roszkowski github:Michaelangel007
|
104
|
+
*/
|
105
|
+
|
106
|
+
#ifndef STBI_INCLUDE_STB_IMAGE_H
|
107
|
+
#define STBI_INCLUDE_STB_IMAGE_H 1
|
108
|
+
|
109
|
+
// DOCUMENTATION
|
110
|
+
//
|
111
|
+
// Limitations:
|
112
|
+
// - no 12-bit-per-channel JPEG
|
113
|
+
// - no JPEGs with arithmetic coding
|
114
|
+
// - GIF always returns *comp=4
|
115
|
+
//
|
116
|
+
// Basic usage (see HDR discussion below for HDR usage):
|
117
|
+
// int x,y,n;
|
118
|
+
// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
|
119
|
+
// // ... process data if not NULL ...
|
120
|
+
// // ... x = width, y = height, n = # 8-bit components per pixel ...
|
121
|
+
// // ... replace '0' with '1'..'4' to force that many components per pixel
|
122
|
+
// // ... but 'n' will always be the number that it would have been if you said 0
|
123
|
+
// stbi_image_free(data)
|
124
|
+
//
|
125
|
+
// Standard parameters:
|
126
|
+
// int *x -- outputs image width in pixels
|
127
|
+
// int *y -- outputs image height in pixels
|
128
|
+
// int *channels_in_file -- outputs # of image components in image file
|
129
|
+
// int desired_channels -- if non-zero, # of image components requested in result
|
130
|
+
//
|
131
|
+
// The return value from an image loader is an 'unsigned char *' which points
|
132
|
+
// to the pixel data, or NULL on an allocation failure or if the image is
|
133
|
+
// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels,
|
134
|
+
// with each pixel consisting of N interleaved 8-bit components; the first
|
135
|
+
// pixel pointed to is top-left-most in the image. There is no padding between
|
136
|
+
// image scanlines or between pixels, regardless of format. The number of
|
137
|
+
// components N is 'desired_channels' if desired_channels is non-zero, or
|
138
|
+
// *channels_in_file otherwise. If desired_channels is non-zero,
|
139
|
+
// *channels_in_file has the number of components that _would_ have been
|
140
|
+
// output otherwise. E.g. if you set desired_channels to 4, you will always
|
141
|
+
// get RGBA output, but you can check *channels_in_file to see if it's trivially
|
142
|
+
// opaque because e.g. there were only 3 channels in the source image.
|
143
|
+
//
|
144
|
+
// An output image with N components has the following components interleaved
|
145
|
+
// in this order in each pixel:
|
146
|
+
//
|
147
|
+
// N=#comp components
|
148
|
+
// 1 grey
|
149
|
+
// 2 grey, alpha1
|
150
|
+
// 3 red, green, blue
|
151
|
+
// 4 red, green, blue, alpha
|
152
|
+
//
|
153
|
+
// If image loading fails for any reason, the return value will be NULL,
|
154
|
+
// and *x, *y, *channels_in_file will be unchanged. The function
|
155
|
+
// stbi_failure_reason() can be queried for an extremely brief, end-user
|
156
|
+
// unfriendly explanation of why the load failed. Define STBI_NO_FAILURE_STRINGS
|
157
|
+
// to avoid compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
|
158
|
+
// more user-friendly ones.
|
159
|
+
//
|
160
|
+
// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.
|
161
|
+
//
|
162
|
+
// ===========================================================================
|
163
|
+
//
|
164
|
+
// Philosophy
|
165
|
+
//
|
166
|
+
// stb libraries are designed with the following priorities:
|
167
|
+
//
|
168
|
+
// 1. easy to use
|
169
|
+
// 2. easy to maintain
|
170
|
+
// 3. good performance
|
171
|
+
//
|
172
|
+
// Sometimes I let "good performance" creep up in priority over "easy to maintain",
|
173
|
+
// and for best performance I may provide less-easy-to-use APIs that give higher
|
174
|
+
// performance, in addition to the easy to use ones. Nevertheless, it's important
|
175
|
+
// to keep in mind that from the standpoint of you, a client of this library,
|
176
|
+
// all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all.
|
177
|
+
//
|
178
|
+
// Some secondary priorities arise directly from the first two, some of which
|
179
|
+
// make more explicit reasons why performance can't be emphasized.
|
180
|
+
//
|
181
|
+
// - Portable ("ease of use")
|
182
|
+
// - Small source code footprint ("easy to maintain")
|
183
|
+
// - No dependencies ("ease of use")
|
184
|
+
//
|
185
|
+
// ===========================================================================
|
186
|
+
//
|
187
|
+
// I/O callbacks
|
188
|
+
//
|
189
|
+
// I/O callbacks allow you to read from arbitrary sources, like packaged
|
190
|
+
// files or some other source. Data read from callbacks are processed
|
191
|
+
// through a small internal buffer (currently 128 bytes) to try to reduce
|
192
|
+
// overhead.
|
193
|
+
//
|
194
|
+
// The three functions you must define are "read" (reads some bytes of data),
|
195
|
+
// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end).
|
196
|
+
//
|
197
|
+
// ===========================================================================
|
198
|
+
//
|
199
|
+
// SIMD support
|
200
|
+
//
|
201
|
+
// The JPEG decoder will try to automatically use SIMD kernels on x86 when
|
202
|
+
// supported by the compiler. For ARM Neon support, you must explicitly
|
203
|
+
// request it.
|
204
|
+
//
|
205
|
+
// (The old do-it-yourself SIMD API is no longer supported in the current
|
206
|
+
// code.)
|
207
|
+
//
|
208
|
+
// On x86, SSE2 will automatically be used when available based on a run-time
|
209
|
+
// test; if not, the generic C versions are used as a fall-back. On ARM targets,
|
210
|
+
// the typical path is to have separate builds for NEON and non-NEON devices
|
211
|
+
// (at least this is true for iOS and Android). Therefore, the NEON support is
|
212
|
+
// toggled by a build flag: define STBI_NEON to get NEON loops.
|
213
|
+
//
|
214
|
+
// If for some reason you do not want to use any of SIMD code, or if
|
215
|
+
// you have issues compiling it, you can disable it entirely by
|
216
|
+
// defining STBI_NO_SIMD.
|
217
|
+
//
|
218
|
+
// ===========================================================================
|
219
|
+
//
|
220
|
+
// HDR image support (disable by defining STBI_NO_HDR)
|
221
|
+
//
|
222
|
+
// stb_image now supports loading HDR images in general, and currently
|
223
|
+
// the Radiance .HDR file format, although the support is provided
|
224
|
+
// generically. You can still load any file through the existing interface;
|
225
|
+
// if you attempt to load an HDR file, it will be automatically remapped to
|
226
|
+
// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
|
227
|
+
// both of these constants can be reconfigured through this interface:
|
228
|
+
//
|
229
|
+
// stbi_hdr_to_ldr_gamma(2.2f);
|
230
|
+
// stbi_hdr_to_ldr_scale(1.0f);
|
231
|
+
//
|
232
|
+
// (note, do not use _inverse_ constants; stbi_image will invert them
|
233
|
+
// appropriately).
|
234
|
+
//
|
235
|
+
// Additionally, there is a new, parallel interface for loading files as
|
236
|
+
// (linear) floats to preserve the full dynamic range:
|
237
|
+
//
|
238
|
+
// float *data = stbi_loadf(filename, &x, &y, &n, 0);
|
239
|
+
//
|
240
|
+
// If you load LDR images through this interface, those images will
|
241
|
+
// be promoted to floating point values, run through the inverse of
|
242
|
+
// constants corresponding to the above:
|
243
|
+
//
|
244
|
+
// stbi_ldr_to_hdr_scale(1.0f);
|
245
|
+
// stbi_ldr_to_hdr_gamma(2.2f);
|
246
|
+
//
|
247
|
+
// Finally, given a filename (or an open file or memory block--see header
|
248
|
+
// file for details) containing image data, you can query for the "most
|
249
|
+
// appropriate" interface to use (that is, whether the image is HDR or
|
250
|
+
// not), using:
|
251
|
+
//
|
252
|
+
// stbi_is_hdr(char *filename);
|
253
|
+
//
|
254
|
+
// ===========================================================================
|
255
|
+
//
|
256
|
+
// iPhone PNG support:
|
257
|
+
//
|
258
|
+
// By default we convert iphone-formatted PNGs back to RGB, even though
|
259
|
+
// they are internally encoded differently. You can disable this conversion
|
260
|
+
// by by calling stbi_convert_iphone_png_to_rgb(0), in which case
|
261
|
+
// you will always just get the native iphone "format" through (which
|
262
|
+
// is BGR stored in RGB).
|
263
|
+
//
|
264
|
+
// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per
|
265
|
+
// pixel to remove any premultiplied alpha *only* if the image file explicitly
|
266
|
+
// says there's premultiplied data (currently only happens in iPhone images,
|
267
|
+
// and only if iPhone convert-to-rgb processing is on).
|
268
|
+
//
|
269
|
+
// ===========================================================================
|
270
|
+
//
|
271
|
+
// ADDITIONAL CONFIGURATION
|
272
|
+
//
|
273
|
+
// - You can suppress implementation of any of the decoders to reduce
|
274
|
+
// your code footprint by #defining one or more of the following
|
275
|
+
// symbols before creating the implementation.
|
276
|
+
//
|
277
|
+
// STBI_NO_JPEG
|
278
|
+
// STBI_NO_PNG
|
279
|
+
// STBI_NO_BMP
|
280
|
+
// STBI_NO_PSD
|
281
|
+
// STBI_NO_TGA
|
282
|
+
// STBI_NO_GIF
|
283
|
+
// STBI_NO_HDR
|
284
|
+
// STBI_NO_PIC
|
285
|
+
// STBI_NO_PNM (.ppm and .pgm)
|
286
|
+
//
|
287
|
+
// - You can request *only* certain decoders and suppress all other ones
|
288
|
+
// (this will be more forward-compatible, as addition of new decoders
|
289
|
+
// doesn't require you to disable them explicitly):
|
290
|
+
//
|
291
|
+
// STBI_ONLY_JPEG
|
292
|
+
// STBI_ONLY_PNG
|
293
|
+
// STBI_ONLY_BMP
|
294
|
+
// STBI_ONLY_PSD
|
295
|
+
// STBI_ONLY_TGA
|
296
|
+
// STBI_ONLY_GIF
|
297
|
+
// STBI_ONLY_HDR
|
298
|
+
// STBI_ONLY_PIC
|
299
|
+
// STBI_ONLY_PNM (.ppm and .pgm)
|
300
|
+
//
|
301
|
+
// - If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still
|
302
|
+
// want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB
|
303
|
+
//
|
304
|
+
|
305
|
+
|
306
|
+
#ifndef STBI_NO_STDIO
|
307
|
+
#include <stdio.h>
|
308
|
+
#endif // STBI_NO_STDIO
|
309
|
+
|
310
|
+
#define STBI_VERSION 1
|
311
|
+
|
312
|
+
enum
|
313
|
+
{
|
314
|
+
STBI_default = 0, // only used for desired_channels
|
315
|
+
|
316
|
+
STBI_grey = 1,
|
317
|
+
STBI_grey_alpha = 2,
|
318
|
+
STBI_rgb = 3,
|
319
|
+
STBI_rgb_alpha = 4
|
320
|
+
};
|
321
|
+
|
322
|
+
typedef unsigned char stbi_uc;
|
323
|
+
typedef unsigned short stbi_us;
|
324
|
+
|
325
|
+
#ifdef STB_IMAGE_STATIC
|
326
|
+
#define STBIDEF static
|
327
|
+
#else
|
328
|
+
#define STBIDEF extern
|
329
|
+
#endif
|
330
|
+
|
331
|
+
//////////////////////////////////////////////////////////////////////////////
|
332
|
+
//
|
333
|
+
// PRIMARY API - works on images of any type
|
334
|
+
//
|
335
|
+
|
336
|
+
//
|
337
|
+
// load image by filename, open file, or memory buffer
|
338
|
+
//
|
339
|
+
|
340
|
+
typedef struct
|
341
|
+
{
|
342
|
+
int (*read) (void *user,char *data,int size); // fill 'data' with 'size' bytes. return number of bytes actually read
|
343
|
+
void (*skip) (void *user,int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative
|
344
|
+
int (*eof) (void *user); // returns nonzero if we are at end of file/data
|
345
|
+
} stbi_io_callbacks;
|
346
|
+
|
347
|
+
////////////////////////////////////
|
348
|
+
//
|
349
|
+
// 8-bits-per-channel interface
|
350
|
+
//
|
351
|
+
|
352
|
+
STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels);
|
353
|
+
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels);
|
354
|
+
#ifndef STBI_NO_GIF
|
355
|
+
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp);
|
356
|
+
#endif
|
357
|
+
|
358
|
+
|
359
|
+
#ifndef STBI_NO_STDIO
|
360
|
+
STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
|
361
|
+
STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);
|
362
|
+
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
363
|
+
#endif
|
364
|
+
|
365
|
+
////////////////////////////////////
|
366
|
+
//
|
367
|
+
// 16-bits-per-channel interface
|
368
|
+
//
|
369
|
+
|
370
|
+
STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);
|
371
|
+
STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);
|
372
|
+
|
373
|
+
#ifndef STBI_NO_STDIO
|
374
|
+
STBIDEF stbi_us *stbi_load_16 (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
|
375
|
+
STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);
|
376
|
+
#endif
|
377
|
+
|
378
|
+
////////////////////////////////////
|
379
|
+
//
|
380
|
+
// float-per-channel interface
|
381
|
+
//
|
382
|
+
#ifndef STBI_NO_LINEAR
|
383
|
+
STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);
|
384
|
+
STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);
|
385
|
+
|
386
|
+
#ifndef STBI_NO_STDIO
|
387
|
+
STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
|
388
|
+
STBIDEF float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);
|
389
|
+
#endif
|
390
|
+
#endif
|
391
|
+
|
392
|
+
#ifndef STBI_NO_HDR
|
393
|
+
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
|
394
|
+
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
|
395
|
+
#endif // STBI_NO_HDR
|
396
|
+
|
397
|
+
#ifndef STBI_NO_LINEAR
|
398
|
+
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);
|
399
|
+
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
|
400
|
+
#endif // STBI_NO_LINEAR
|
401
|
+
|
402
|
+
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
|
403
|
+
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);
|
404
|
+
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
|
405
|
+
#ifndef STBI_NO_STDIO
|
406
|
+
STBIDEF int stbi_is_hdr (char const *filename);
|
407
|
+
STBIDEF int stbi_is_hdr_from_file(FILE *f);
|
408
|
+
#endif // STBI_NO_STDIO
|
409
|
+
|
410
|
+
|
411
|
+
// get a VERY brief reason for failure
|
412
|
+
// NOT THREADSAFE
|
413
|
+
STBIDEF const char *stbi_failure_reason (void);
|
414
|
+
|
415
|
+
// free the loaded image -- this is just free()
|
416
|
+
STBIDEF void stbi_image_free (void *retval_from_stbi_load);
|
417
|
+
|
418
|
+
// get image dimensions & components without fully decoding
|
419
|
+
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
420
|
+
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp);
|
421
|
+
STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len);
|
422
|
+
STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user);
|
423
|
+
|
424
|
+
#ifndef STBI_NO_STDIO
|
425
|
+
STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp);
|
426
|
+
STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
|
427
|
+
STBIDEF int stbi_is_16_bit (char const *filename);
|
428
|
+
STBIDEF int stbi_is_16_bit_from_file(FILE *f);
|
429
|
+
#endif
|
430
|
+
|
431
|
+
// for image formats that explicitly notate that they have premultiplied alpha,
|
432
|
+
// we just return the colors as stored in the file. set this flag to force
|
433
|
+
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
434
|
+
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
435
|
+
|
436
|
+
// indicate whether we should process iphone images back to canonical format,
|
437
|
+
// or just pass them through "as-is"
|
438
|
+
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
439
|
+
|
440
|
+
// flip the image vertically, so the first pixel in the output array is the bottom left
|
441
|
+
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);
|
442
|
+
|
443
|
+
// ZLIB client - used by PNG, available for other purposes
|
444
|
+
|
445
|
+
STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
|
446
|
+
STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header);
|
447
|
+
STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
|
448
|
+
STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
449
|
+
|
450
|
+
STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
|
451
|
+
STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
452
|
+
|
453
|
+
#endif // STBI_INCLUDE_STB_IMAGE_H
|