package vendor:stb/image

Types

Io_Callbacks ¶

Io_Callbacks :: struct {
	read: proc "cdecl" (user: rawptr, data: [^]u8, size: i32) -> i32,
	// fill 'data' with 'size' u8s.  return number of u8s actually read
	skip: proc "cdecl" (user: rawptr, n: i32),
	// skip the next 'n' u8s, or 'unget' the last -n u8s if negative
	eof:  proc "cdecl" (_: rawptr) -> i32,
}
 

load image by filename, open file, or memory buffer

colorspace ¶

colorspace :: enum i32 {
	LINEAR, 
	SRGB, 
	MAX_COLORSPACES, 
}

datatype ¶

datatype :: enum i32 {
	UINT8, 
	UINT16, 
	UINT32, 
	FLOAT, 
	MAX_TYPES, 
}

edge ¶

edge :: enum i32 {
	CLAMP   = 1, 
	REFLECT = 2, 
	WRAP    = 3, 
	ZERO    = 4, 
}

filter ¶

filter :: enum i32 {
	DEFAULT      = 0, // use same filter type that easy-to-use API chooses
	BOX          = 1, // A trapezoid w/1-pixel wide ramps, same result as box for integer scale ratios
	TRIANGLE     = 2, // On upsampling, produces same results as bilinear texture filtering
	CUBICBSPLINE = 3, // The cubic b-spline (aka Mitchell-Netrevalli with B=1,C=0), gaussian-esque
	CATMULLROM   = 4, // An interpolating cubic spline
	MITCHELL     = 5, // Mitchell-Netrevalli filter with B=1/3, C=1/3
}

write_func ¶

write_func :: proc "cdecl" (ctx: rawptr, data: rawptr, size: i32)

Constants

ALPHA_CHANNEL_NONE ¶

ALPHA_CHANNEL_NONE :: -1

FLAG_ALPHA_PREMULTIPLIED ¶

FLAG_ALPHA_PREMULTIPLIED :: 1 << 0
 

Set this flag if your texture has premultiplied alpha. Otherwise, stbir will use alpha-weighted resampling (effectively premultiplying, resampling, then unpremultiplying).

FLAG_ALPHA_USES_COLORSPACE ¶

FLAG_ALPHA_USES_COLORSPACE :: 1 << 1
 

The specified alpha channel should be handled as gamma-corrected value even when doing sRGB operations.

Variables

This section is empty.

Procedures

convert_iphone_png_to_rgb ¶

convert_iphone_png_to_rgb :: proc "cdecl" (interval: i32) ---
 

indicate whether we should process iphone images back to canonical format, or just pass them through "as-is"

convert_iphone_png_to_rgb_thread ¶

convert_iphone_png_to_rgb_thread :: proc "cdecl" (flag_true_if_should_unpremultiply: b32) ---

failure_reason ¶

failure_reason :: proc "cdecl" () -> cstring ---
 

get a VERY brief reason for failure NOT THREADSAFE

flip_vertically_on_write ¶

flip_vertically_on_write :: proc "cdecl" (flag_true_if_should_unpremultiply: b32) ---

hdr_to_ldr_gamma ¶

hdr_to_ldr_gamma :: proc "cdecl" (ms: f32) ---

hdr_to_ldr_scale ¶

hdr_to_ldr_scale :: proc "cdecl" (ms: f32) ---

image_free ¶

image_free :: proc "cdecl" (_: rawptr) ---
 

free the loaded image -- this is just free()

info ¶

info :: proc "cdecl" (filename: cstring, x, y, comp: ^i32) -> i32 ---
 

get image dimensions & components without fully decoding

info_from_callbacks ¶

info_from_callbacks :: proc "cdecl" (clbk: ^Io_Callbacks, user: rawptr, x, y, comp: ^i32) -> i32 ---

info_from_file ¶

info_from_file :: proc "cdecl" (f: ^libc.FILE, x, y, comp: ^i32) -> i32 ---

info_from_memory ¶

info_from_memory :: proc "cdecl" (buffer: [^]u8, len: i32, x, y, comp: ^i32) -> i32 ---

is_16_bit ¶

is_16_bit :: proc "cdecl" (filename: cstring) -> b32 ---

is_16_bit_from_file ¶

is_16_bit_from_file :: proc "cdecl" (f: ^libc.FILE) -> b32 ---

is_16_bit_from_memory ¶

is_16_bit_from_memory :: proc "cdecl" (buffer: [^]u8, len: i32) -> i32 ---

is_hdr ¶

is_hdr :: proc "cdecl" (filename: cstring) -> i32 ---

is_hdr_from_callbacks ¶

is_hdr_from_callbacks :: proc "cdecl" (clbk: ^Io_Callbacks, user: rawptr) -> i32 ---

is_hdr_from_file ¶

is_hdr_from_file :: proc "cdecl" (stream: ^libc.FILE) -> i32 ---

is_hdr_from_memory ¶

is_hdr_from_memory :: proc "cdecl" (buffer: [^]u8, len: i32) -> i32 ---

ldr_to_hdr_gamma ¶

ldr_to_hdr_gamma :: proc "cdecl" (ms: f32) ---

ldr_to_hdr_scale ¶

ldr_to_hdr_scale :: proc "cdecl" (ms: f32) ---

load ¶

load :: proc "cdecl" (filename: cstring, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]u8 ---
 

//////////////////////////////////

8-bits-per-channel interface

load_16 ¶

load_16 :: proc "cdecl" (filename: cstring, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]u16 ---
 

//////////////////////////////////

16-bits-per-channel interface

load_16_from_callbacks ¶

load_16_from_callbacks :: proc "cdecl" (clbk: ^Io_Callbacks, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]u16 ---

load_16_from_file ¶

load_16_from_file :: proc "cdecl" (f: ^libc.FILE, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]u16 ---

load_16_from_memory ¶

load_16_from_memory :: proc "cdecl" (
	buffer:                 [^]u8, 
	len:                    i32, 
	x, y, channels_in_file: ^i32, 
) -> [^]u16 ---

load_from_callbacks ¶

load_from_callbacks :: proc "cdecl" (
	clbk:                   ^Io_Callbacks, 
	user:                   rawptr, 
	x, y, channels_in_file: ^i32, 
) -> [^]u8 ---

load_from_file ¶

load_from_file :: proc "cdecl" (f: ^libc.FILE, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]u8 ---

load_from_memory ¶

load_from_memory :: proc "cdecl" (
	buffer:                 [^]u8, 
	len:                    i32, 
	x, y, channels_in_file: ^i32, 
) -> [^]u8 ---

load_gif_from_memory ¶

load_gif_from_memory :: proc "cdecl" (
	buffer:        [^]u8, 
	len:           i32, 
	delays:        ^[^]i32, 
	x, y, z, comp: ^i32, 
) -> [^]u8 ---

loadf ¶

loadf :: proc "cdecl" (filename: cstring, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]f32 ---
 

//////////////////////////////////

float-per-channel interface

loadf_from_callbacks ¶

loadf_from_callbacks :: proc "cdecl" (
	clbk:                   ^Io_Callbacks, 
	user:                   rawptr, 
	x, y, channels_in_file: ^i32, 
) -> [^]f32 ---

loadf_from_file ¶

loadf_from_file :: proc "cdecl" (f: ^libc.FILE, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]f32 ---

loadf_from_memory ¶

loadf_from_memory :: proc "cdecl" (
	buffer:                 [^]u8, 
	len:                    i32, 
	x, y, channels_in_file: ^i32, 
) -> [^]f32 ---

resize ¶

resize :: proc "cdecl" (
	input_pixels:                               rawptr, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              rawptr, 
	output_w, output_h, output_stride_in_bytes: i32, 
	datatype:                                   datatype, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
	edge_mode_horizontal, edge_mode_vertical:   edge, 
	filter_horizontal, filter_vertical:         filter, 
	space:                                      colorspace, 
) -> i32 ---

resize_float ¶

resize_float :: proc "cdecl" (
	input_pixels:                               [^]f32, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]f32, 
	output_w, output_h, output_stride_in_bytes: i32, 
) -> i32 ---

resize_float_generic ¶

resize_float_generic :: proc "cdecl" (
	input_pixels:                               [^]f32, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]f32, 
	output_w, output_h, output_stride_in_bytes: i32, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
	filter:                                     filter, 
	space:                                      colorspace, 
) -> i32 ---

resize_region ¶

resize_region :: proc "cdecl" (
	input_pixels:                               rawptr, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              rawptr, 
	output_w, output_h, output_stride_in_bytes: i32, 
	datatype:                                   datatype, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
	edge_mode_horizontal, edge_mode_vertical:   edge, 
	filter_horizontal, filter_vertical:         filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
	x_scale, y_scale:                           f32, 
	x_offset, 
) -> i32 ---

resize_subpixel ¶

resize_subpixel :: proc "cdecl" (
	input_pixels:                               rawptr, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              rawptr, 
	output_w, output_h, output_stride_in_bytes: i32, 
	datatype:                                   datatype, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
	edge_mode_horizontal, edge_mode_vertical:   edge, 
	filter_horizontal, filter_vertical:         filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
	x_scale, y_scale:                           f32, 
	x_offset, 
) -> i32 ---

resize_uint16_generic ¶

resize_uint16_generic :: proc "cdecl" (
	input_pixels:                               [^]u16, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]u16, 
	output_w, output_h, output_stride_in_bytes: i32, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
	filter:                                     filter, 
	space:                                      colorspace, 
) -> i32 ---

resize_uint8 ¶

resize_uint8 :: proc "cdecl" (
	input_pixels:                               [^]u8, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]u8, 
	output_w, output_h, output_stride_in_bytes: i32, 
) -> i32 ---

resize_uint8_generic ¶

resize_uint8_generic :: proc "cdecl" (
	input_pixels:                               [^]u8, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]u8, 
	output_w, output_h, output_stride_in_bytes: i32, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
	filter:                                     filter, 
	space:                                      colorspace, 
) -> i32 ---

resize_uint8_srgb ¶

resize_uint8_srgb :: proc "cdecl" (
	input_pixels:                               [^]u8, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]u8, 
	output_w, output_h, output_stride_in_bytes: i32, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
) -> i32 ---

resize_uint8_srgb_edgemode ¶

resize_uint8_srgb_edgemode :: proc "cdecl" (
	input_pixels:                               [^]u8, 
	input_w, input_h, input_stride_in_bytes:    i32, 
	output_pixels:                              [^]u8, 
	output_w, output_h, output_stride_in_bytes: i32, 
	num_channels:                               i32, 
	alpha_channel:                              b32, 
	flags:                                      i32, 
) -> i32 ---
 

This function adds the ability to specify how requests to sample off the edge of the image are handled.

set_flip_vertically_on_load ¶

set_flip_vertically_on_load :: proc "cdecl" (interval: i32) ---
 

flip the image vertically, so the first pixel in the output array is the bottom left

set_flip_vertically_on_load_thread ¶

set_flip_vertically_on_load_thread :: proc "cdecl" (flag_true_if_should_unpremultiply: b32) ---

set_unpremultiply_on_load ¶

set_unpremultiply_on_load :: proc "cdecl" (interval: i32) ---
 

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.

set_unpremultiply_on_load_thread ¶

set_unpremultiply_on_load_thread :: proc "cdecl" (flag_true_if_should_unpremultiply: b32) ---
 

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

write_bmp ¶

write_bmp :: proc "cdecl" (filename: cstring, w, h, comp: i32, data: rawptr) -> i32 ---

write_bmp_to_func ¶

write_bmp_to_func :: proc "cdecl" (
	func:       write_func, 
	ctx:        rawptr, 
	w, h, comp: i32, 
) -> i32 ---

write_hdr ¶

write_hdr :: proc "cdecl" (filename: cstring, w, h, comp: i32, data: [^]f32) -> i32 ---

write_hdr_to_func ¶

write_hdr_to_func :: proc "cdecl" (
	func:       write_func, 
	ctx:        rawptr, 
	w, h, comp: i32, 
) -> i32 ---

write_jpg ¶

write_jpg :: proc "cdecl" (
	filename:   cstring, 
	w, h, comp: i32, 
	data:       rawptr, 
) -> i32 ---

write_jpg_to_func ¶

write_jpg_to_func :: proc "cdecl" (
	func:       write_func, 
	ctx:        rawptr, 
	w, h, comp: i32, 
	data:       rawptr, 
) -> i32 ---

write_png ¶

write_png :: proc "cdecl" (
	filename:   cstring, 
	w, h, comp: i32, 
	data:       rawptr, 
) -> i32 ---

write_png_to_func ¶

write_png_to_func :: proc "cdecl" (
	func:       write_func, 
	ctx:        rawptr, 
	w, h, comp: i32, 
	data:       rawptr, 
) -> i32 ---

write_tga ¶

write_tga :: proc "cdecl" (filename: cstring, w, h, comp: i32, data: rawptr) -> i32 ---

write_tga_to_func ¶

write_tga_to_func :: proc "cdecl" (
	func:       write_func, 
	ctx:        rawptr, 
	w, h, comp: i32, 
) -> i32 ---

zlib_decode_buffer ¶

zlib_decode_buffer :: proc "cdecl" (obuffer: [^]u8, olen: i32, ibuffer: [^]u8, ilen: i32) -> i32 ---

zlib_decode_malloc ¶

zlib_decode_malloc :: proc "cdecl" (data: [^]u8, dataLength: i32, compDataLength: ^i32) -> [^]u8 ---

zlib_decode_malloc_guesssize ¶

zlib_decode_malloc_guesssize :: proc "cdecl" (buffer: [^]u8, len: i32, initial_size: i32, outlen: ^i32) -> [^]u8 ---
 

ZLIB client - used by PNG, available for other purposes

zlib_decode_malloc_guesssize_headerflag ¶

zlib_decode_malloc_guesssize_headerflag :: proc "cdecl" (buffer: [^]u8, len: i32, initial_size: i32, outlen: ^i32, parse_header: b32) -> [^]u8 ---

zlib_decode_noheader_buffer ¶

zlib_decode_noheader_buffer :: proc "cdecl" (obuffer: [^]u8, olen: i32, ibuffer: [^]u8, ilen: i32) -> i32 ---

zlib_decode_noheader_malloc ¶

zlib_decode_noheader_malloc :: proc "cdecl" (data: [^]u8, dataLength: i32, compDataLength: ^i32) -> [^]u8 ---

Procedure Groups

This section is empty.

Source Files

Generation Information

Generated with odin version dev-2022-12 (vendor "odin") Windows_amd64 @ 2022-12-06 21:08:55.247810500 +0000 UTC