daily update on 20241228 by nitload youmu, better dot in checking
This commit is contained in:
+114
-99
@@ -373,14 +373,13 @@ RECENT REVISION HISTORY:
|
||||
|
||||
#define STBI_VERSION 1
|
||||
|
||||
enum
|
||||
{
|
||||
STBI_default = 0, // only used for desired_channels
|
||||
enum {
|
||||
STBI_default = 0, // only used for desired_channels
|
||||
|
||||
STBI_grey = 1,
|
||||
STBI_grey_alpha = 2,
|
||||
STBI_rgb = 3,
|
||||
STBI_rgb_alpha = 4
|
||||
STBI_grey = 1,
|
||||
STBI_grey_alpha = 2,
|
||||
STBI_rgb = 3,
|
||||
STBI_rgb_alpha = 4
|
||||
};
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -399,142 +398,159 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIMARY API - works on images of any type
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIMARY API - works on images of any type
|
||||
//
|
||||
|
||||
//
|
||||
// load image by filename, open file, or memory buffer
|
||||
//
|
||||
//
|
||||
// load image by filename, open file, or memory buffer
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*read) (void* user, char* data, int size); // fill 'data' with 'size' bytes. return number of bytes actually read
|
||||
void (*skip) (void* user, int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative
|
||||
int (*eof) (void* user); // returns nonzero if we are at end of file/data
|
||||
} stbi_io_callbacks;
|
||||
typedef struct {
|
||||
int (*read)(
|
||||
void *user, char *data,
|
||||
int size); // fill 'data' with 'size' bytes. return number of bytes actually read
|
||||
void (*skip)(void *user,
|
||||
int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative
|
||||
int (*eof)(void *user); // returns nonzero if we are at end of file/data
|
||||
} stbi_io_callbacks;
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 8-bits-per-channel interface
|
||||
//
|
||||
|
||||
STBIDEF stbi_uc* stbi_load_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
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);
|
||||
STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
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);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF stbi_uc* stbi_load(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF void stbi_load_to_target(char const* filename, int* x, int* y, stbi_uc* target, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc* stbi_load_from_file(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
||||
STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
STBIDEF void stbi_load_to_target(char const *filename, int *x, int *y, stbi_uc *target,
|
||||
int *channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
// for stbi_load_from_file, file pointer is left pointing immediately after image
|
||||
#endif
|
||||
|
||||
#ifndef STBI_NO_GIF
|
||||
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);
|
||||
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);
|
||||
#endif
|
||||
|
||||
#ifdef STBI_WINDOWS_UTF8
|
||||
STBIDEF int stbi_convert_wchar_to_utf8(char* buffer, size_t bufferlen, const wchar_t* input);
|
||||
STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t *input);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
////////////////////////////////////
|
||||
//
|
||||
// 16-bits-per-channel interface
|
||||
//
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF stbi_us* stbi_load_16(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us* stbi_load_from_file_16(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
//
|
||||
// float-per-channel interface
|
||||
//
|
||||
////////////////////////////////////
|
||||
//
|
||||
// float-per-channel interface
|
||||
//
|
||||
#ifndef STBI_NO_LINEAR
|
||||
STBIDEF float* stbi_loadf_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float* stbi_loadf_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y,
|
||||
int *channels_in_file, int desired_channels);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF float* stbi_loadf(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float* stbi_loadf_from_file(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
|
||||
STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *channels_in_file,
|
||||
int desired_channels);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef STBI_NO_HDR
|
||||
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
|
||||
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
|
||||
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
|
||||
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
|
||||
#endif // STBI_NO_HDR
|
||||
|
||||
#ifndef STBI_NO_LINEAR
|
||||
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);
|
||||
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
|
||||
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);
|
||||
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
|
||||
#endif // STBI_NO_LINEAR
|
||||
|
||||
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
|
||||
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const* clbk, void* user);
|
||||
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const* buffer, int len);
|
||||
// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR
|
||||
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);
|
||||
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF int stbi_is_hdr(char const* filename);
|
||||
STBIDEF int stbi_is_hdr_from_file(FILE* f);
|
||||
STBIDEF int stbi_is_hdr(char const *filename);
|
||||
STBIDEF int stbi_is_hdr_from_file(FILE *f);
|
||||
#endif // STBI_NO_STDIO
|
||||
|
||||
// get a VERY brief reason for failure
|
||||
// on most compilers (and ALL modern mainstream compilers) this is threadsafe
|
||||
STBIDEF const char *stbi_failure_reason(void);
|
||||
|
||||
// get a VERY brief reason for failure
|
||||
// on most compilers (and ALL modern mainstream compilers) this is threadsafe
|
||||
STBIDEF const char* stbi_failure_reason(void);
|
||||
// free the loaded image -- this is just free()
|
||||
STBIDEF void stbi_image_free(void *retval_from_stbi_load);
|
||||
|
||||
// free the loaded image -- this is just free()
|
||||
STBIDEF void stbi_image_free(void* retval_from_stbi_load);
|
||||
|
||||
// get image dimensions & components without fully decoding
|
||||
STBIDEF int stbi_info_from_memory(stbi_uc const* buffer, int len, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const* clbk, void* user, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const* buffer, int len);
|
||||
STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const* clbk, void* user);
|
||||
// get image dimensions & components without fully decoding
|
||||
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
|
||||
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y,
|
||||
int *comp);
|
||||
STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len);
|
||||
STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user);
|
||||
|
||||
#ifndef STBI_NO_STDIO
|
||||
STBIDEF int stbi_info(char const* filename, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_info_from_file(FILE* f, int* x, int* y, int* comp);
|
||||
STBIDEF int stbi_is_16_bit(char const* filename);
|
||||
STBIDEF int stbi_is_16_bit_from_file(FILE* f);
|
||||
STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp);
|
||||
STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp);
|
||||
STBIDEF int stbi_is_16_bit(char const *filename);
|
||||
STBIDEF int stbi_is_16_bit_from_file(FILE *f);
|
||||
#endif
|
||||
|
||||
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||
// we just return the colors as stored in the file. set this flag to force
|
||||
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
||||
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
||||
|
||||
// indicate whether we should process iphone images back to canonical format,
|
||||
// or just pass them through "as-is"
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
||||
|
||||
// for image formats that explicitly notate that they have premultiplied alpha,
|
||||
// we just return the colors as stored in the file. set this flag to force
|
||||
// unpremultiplication. results are undefined if the unpremultiply overflow.
|
||||
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
|
||||
// flip the image vertically, so the first pixel in the output array is the bottom left
|
||||
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);
|
||||
|
||||
// indicate whether we should process iphone images back to canonical format,
|
||||
// or just pass them through "as-is"
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
|
||||
// as above, but only applies to images loaded on the thread that calls the function
|
||||
// this function is only available if your compiler supports thread-local variables;
|
||||
// calling it will fail to link if your compiler doesn't
|
||||
STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply);
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert);
|
||||
STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip);
|
||||
|
||||
// flip the image vertically, so the first pixel in the output array is the bottom left
|
||||
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);
|
||||
// ZLIB client - used by PNG, available for other purposes
|
||||
|
||||
// as above, but only applies to images loaded on the thread that calls the function
|
||||
// this function is only available if your compiler supports thread-local variables;
|
||||
// calling it will fail to link if your compiler doesn't
|
||||
STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply);
|
||||
STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert);
|
||||
STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip);
|
||||
|
||||
// ZLIB client - used by PNG, available for other purposes
|
||||
|
||||
STBIDEF char* stbi_zlib_decode_malloc_guesssize(const char* buffer, int len, int initial_size, int* outlen);
|
||||
STBIDEF char* stbi_zlib_decode_malloc_guesssize_headerflag(const char* buffer, int len, int initial_size, int* outlen, int parse_header);
|
||||
STBIDEF char* stbi_zlib_decode_malloc(const char* buffer, int len, int* outlen);
|
||||
STBIDEF int stbi_zlib_decode_buffer(char* obuffer, int olen, const char* ibuffer, int ilen);
|
||||
|
||||
STBIDEF char* stbi_zlib_decode_noheader_malloc(const char* buffer, int len, int* outlen);
|
||||
STBIDEF int stbi_zlib_decode_noheader_buffer(char* obuffer, int olen, const char* ibuffer, int ilen);
|
||||
STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size,
|
||||
int *outlen);
|
||||
STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len,
|
||||
int initial_size, int *outlen,
|
||||
int parse_header);
|
||||
STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
|
||||
STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
|
||||
|
||||
STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
|
||||
STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer,
|
||||
int ilen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -728,7 +744,6 @@ extern "C" {
|
||||
first released version
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
@@ -769,4 +784,4 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user