package vendor:stb/image

⌘K
Ctrl+K
or
/

    Types

    Io_Callbacks ¶

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

    load image by filename, open file, or memory buffer

    Related Procedures With Parameters

    colorspace ¶

    colorspace :: enum i32 {
    	LINEAR, 
    	SRGB, 
    	MAX_COLORSPACES, 
    }
    Related Procedures With Parameters

    datatype ¶

    datatype :: enum i32 {
    	UINT8, 
    	UINT16, 
    	UINT32, 
    	FLOAT, 
    	MAX_TYPES, 
    }
    Related Procedures With Parameters

    edge ¶

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

    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
    }
    Related Procedures With Parameters

    write_func ¶

    write_func :: proc "c" (ctx: rawptr, data: rawptr, size: i32)
    Related Procedures With Parameters

    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.

    NO_STDIO ¶

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

    Variables

    This section is empty.

    Procedures

    convert_iphone_png_to_rgb ¶

    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 ¶

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

    failure_reason ¶

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

    get a VERY brief reason for failure NOT THREADSAFE

    flip_vertically_on_write ¶

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

    hdr_to_ldr_gamma ¶

    hdr_to_ldr_gamma :: proc "c" (gamma: f32) ---

    hdr_to_ldr_scale ¶

    hdr_to_ldr_scale :: proc "c" (scale: f32) ---

    image_free ¶

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

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

    info ¶

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

    get image dimensions & components without fully decoding

    info_from_callbacks ¶

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

    info_from_file ¶

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

    info_from_memory ¶

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

    get image dimensions & components without fully decoding

    is_16_bit ¶

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

    is_16_bit_from_file ¶

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

    is_16_bit_from_memory ¶

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

    is_hdr ¶

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

    is_hdr_from_callbacks ¶

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

    is_hdr_from_file ¶

    is_hdr_from_file :: proc "c" (f: ^libc.FILE) -> i32 ---

    is_hdr_from_memory ¶

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

    ldr_to_hdr_gamma ¶

    ldr_to_hdr_gamma :: proc "c" (gamma: f32) ---

    ldr_to_hdr_scale ¶

    ldr_to_hdr_scale :: proc "c" (scale: f32) ---

    load ¶

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

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

    8-bits-per-channel interface

    load_16 ¶

    load_16 :: proc "c" (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 "c" (clbk: ^Io_Callbacks, x, y, channels_in_file: ^i32, desired_channels: i32) -> [^]u16 ---

    load_16_from_file ¶

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

    load_16_from_memory ¶

    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_callbacks ¶

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

    load_from_file ¶

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

    load_from_memory ¶

    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 ¶

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

    loadf ¶

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

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

    float-per-channel interface

    loadf_from_callbacks ¶

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

    loadf_from_file ¶

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

    loadf_from_memory ¶

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

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

    float-per-channel interface

    resize ¶

    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:                              b32, 
    	flags:                                      i32, 
    	edge_mode_horizontal, edge_mode_vertical:   edge, 
    	filter_horizontal, filter_vertical:         filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_float ¶

    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 ¶

    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:                              b32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    	filter:                                     filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_region ¶

    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:                              b32, 
    	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 ¶

    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:                              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, 
    	y_offset:                                   f32, 
    ) -> i32 ---

    resize_uint16_generic ¶

    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:                              b32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    	filter:                                     filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_uint8 ¶

    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 ¶

    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:                              b32, 
    	flags:                                      i32, 
    	edge_wrap_mode:                             edge, 
    	filter:                                     filter, 
    	space:                                      colorspace, 
    	alloc_context:                              rawptr, 
    ) -> i32 ---

    resize_uint8_srgb ¶

    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:                              b32, 
    	flags:                                      i32, 
    ) -> i32 ---

    resize_uint8_srgb_edgemode ¶

    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:                              b32, 
    	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 ¶

    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 ¶

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

    set_unpremultiply_on_load ¶

    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 ¶

    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

    write_bmp ¶

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

    write_bmp_to_func ¶

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

    write_hdr ¶

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

    write_hdr_to_func ¶

    write_hdr_to_func :: proc "c" (
    	func:       write_func, 
    	ctx:        rawptr, 
    	w, h, comp: i32, 
    	data:       [^]f32, 
    ) -> i32 ---

    write_jpg ¶

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

    write_jpg_to_func ¶

    write_jpg_to_func :: proc "c" (
    	func:       write_func, 
    	ctx:        rawptr, 
    	x, y, comp: i32, 
    	data:       rawptr, 
    	quality:    i32, 
    ) -> i32 ---

    write_png ¶

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

    write_png_to_func ¶

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

    write_tga ¶

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

    write_tga_to_func ¶

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

    zlib_decode_buffer ¶

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

    zlib_decode_malloc ¶

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

    zlib_decode_malloc_guesssize ¶

    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 ¶

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

    zlib_decode_noheader_buffer ¶

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

    zlib_decode_noheader_malloc ¶

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

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-20 21:10:47.874228900 +0000 UTC