Bindings for [[ stb_image.h ; https://github.com/nothings/stb/blob/master/stb_image.h ]].

Collection Info

View Source
Collection
vendor
Path
stb/image
Entries
73

Source Files

Constants

4

FLAG_ALPHA_PREMULTIPLIED #

Source
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 #

Source
FLAG_ALPHA_USES_COLORSPACE :: 1 << 1

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

NO_STDIO #

Source
NO_STDIO :: ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32

Types

6

Procedures

63

convert_iphone_png_to_rgb #

Source
convert_iphone_png_to_rgb :: proc "c" (flag_true_if_should_convert: 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 #

Source
convert_iphone_png_to_rgb_thread :: proc "c" (flag_true_if_should_convert: b32) ---

failure_reason #

Source
failure_reason :: proc "c" () -> cstring ---

get a VERY brief reason for failure NOT THREADSAFE

flip_vertically_on_write #

Source
flip_vertically_on_write :: proc "c" (flip_boolean: b32) ---

image_free #

Source
image_free :: proc "c" (retval_from_load: rawptr) ---

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

info #

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

get image dimensions & components without fully decoding

info_from_memory #

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

get image dimensions & components without fully decoding

load #

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

////////////////////////////////// 8-bits-per-channel interface

load_16 #

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

////////////////////////////////// 16-bits-per-channel interface

load_16_from_file #

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

load_16_from_memory #

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

////////////////////////////////// 16-bits-per-channel interface

load_from_memory #

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

////////////////////////////////// 8-bits-per-channel interface

load_gif_from_memory #

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

loadf #

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

////////////////////////////////// float-per-channel interface

loadf_from_memory #

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

////////////////////////////////// float-per-channel interface

resize #

Source
resize :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
	edge_mode_horizontal, edge_mode_vertical:   edge, 
	filter_horizontal, filter_vertical:         filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
) -> i32 ---

resize_float #

Source
resize_float :: proc "c" (
	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, 
) -> i32 ---

resize_float_generic #

Source
resize_float_generic :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
	filter:                                     filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
) -> i32 ---

resize_region #

Source
resize_region :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
	edge_mode_horizontal, edge_mode_vertical:   edge, 
	filter_horizontal, filter_vertical:         filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
	s0, t0, s1, t1:                             f32, 
) -> i32 ---

resize_subpixel #

Source
resize_subpixel :: proc "c" (
	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:                              i32, 
	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, y_offset:                         f32, 
) -> i32 ---

resize_uint16_generic #

Source
resize_uint16_generic :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
	filter:                                     filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
) -> i32 ---

resize_uint8 #

Source
resize_uint8 :: proc "c" (
	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, 
) -> i32 ---

resize_uint8_generic #

Source
resize_uint8_generic :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
	filter:                                     filter, 
	space:                                      colorspace, 
	alloc_context:                              rawptr, 
) -> i32 ---

resize_uint8_srgb #

Source
resize_uint8_srgb :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
) -> i32 ---

resize_uint8_srgb_edgemode #

Source
resize_uint8_srgb_edgemode :: proc "c" (
	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:                              i32, 
	flags:                                      i32, 
	edge_wrap_mode:                             edge, 
) -> 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 #

Source
set_flip_vertically_on_load :: proc "c" (flag_true_if_should_flip: i32) ---

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

set_flip_vertically_on_load_thread #

Source
set_flip_vertically_on_load_thread :: proc "c" (flag_true_if_should_flip: b32) ---

set_unpremultiply_on_load #

Source
set_unpremultiply_on_load :: proc "c" (flag_true_if_should_unpremultiply: 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 #

Source
set_unpremultiply_on_load_thread :: proc "c" (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

zlib_decode_malloc_guesssize #

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

ZLIB client - used by PNG, available for other purposes

zlib_decode_malloc_guesssize_headerflag #

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

zlib_decode_noheader_buffer #

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

zlib_decode_noheader_malloc #

Source
zlib_decode_noheader_malloc :: proc "c" (buffer: [^]u8, len: i32, outlen: ^i32) -> [^]u8 ---