stb_image

Taken from: https://github.com/d-gamedev-team/gfm/blob/master/image/gfm/image/stb_image.d Many thanks to p0nce! D translation of stb_image-1.33 (http://nothings.org/stb_image.c)

This port only supports:

  • PNG 8-bit-per-channel only.
  • JPEG baseline (no JPEG progressive).
  • GIF.
  • BMP non-1bpp, non-RLE.

TODO:

  • Support a range as input.

Members

Aliases

resample_row_func
alias resample_row_func = ubyte* function(ubyte* out_, ubyte* in0, ubyte* in1, int w, int hs)
Undocumented in source.
stbi_dequantize_t
alias stbi_dequantize_t = ubyte
Undocumented in source.

Classes

STBImageException
class STBImageException

The exception type thrown when loading an image failed.

Enums

F_none
anonymousenum F_none
Undocumented in source.
SCAN_load
anonymousenum SCAN_load
Undocumented in source.
STBI_default
anonymousenum STBI_default
Undocumented in source.

Functions

DNL
bool DNL(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
EOI
bool EOI(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
IDCT_1D
void IDCT_1D(int s0, int s1, int s2, int s3, int s4, int s5, int s6, int s7, int t0, int t1, int t2, int t3, int x0, int x1, int x2, int x3)
Undocumented in source. Be warned that the author may not have intended to support it.
PNG_TYPE
uint PNG_TYPE(ubyte a, ubyte b, ubyte c, ubyte d)
Undocumented in source. Be warned that the author may not have intended to support it.
RESTART
bool RESTART(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
SOF
bool SOF(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
SOI
bool SOI(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
SOS
bool SOS(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
YCbCr_to_RGB_row
void YCbCr_to_RGB_row(ubyte* out_, ubyte* y, ubyte* pcb, ubyte* pcr, int count, int step)
Undocumented in source. Be warned that the author may not have intended to support it.
at_eof
int at_eof(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
bit_reverse
int bit_reverse(int v, int bits)
Undocumented in source. Be warned that the author may not have intended to support it.
bitcount
int bitcount(uint a)
Undocumented in source. Be warned that the author may not have intended to support it.
bitreverse16
int bitreverse16(int n)
Undocumented in source. Be warned that the author may not have intended to support it.
bmp_load
ubyte* bmp_load(stbi* s, int* x, int* y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
build_huffman
int build_huffman(huffman* h, int* count)
Undocumented in source. Be warned that the author may not have intended to support it.
clamp
ubyte clamp(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
cleanup_jpeg
void cleanup_jpeg(jpeg* j)
Undocumented in source. Be warned that the author may not have intended to support it.
compute_huffman_codes
int compute_huffman_codes(zbuf* a)
Undocumented in source. Be warned that the author may not have intended to support it.
compute_y
ubyte compute_y(int r, int g, int b)
Undocumented in source. Be warned that the author may not have intended to support it.
convert_format
ubyte* convert_format(ubyte* data, int img_n, int req_comp, uint x, uint y)
Undocumented in source. Be warned that the author may not have intended to support it.
create_png_image
int create_png_image(png* a, ubyte* raw, uint raw_len, int out_n, int interlaced)
Undocumented in source. Be warned that the author may not have intended to support it.
decode
int decode(jpeg* j, huffman* h)
Undocumented in source. Be warned that the author may not have intended to support it.
decode_block
int decode_block(jpeg* j, short data, huffman* hdc, huffman* hac, int b)
Undocumented in source. Be warned that the author may not have intended to support it.
decode_jpeg_header
int decode_jpeg_header(jpeg* z, int scan)
Undocumented in source. Be warned that the author may not have intended to support it.
decode_jpeg_image
int decode_jpeg_image(jpeg* j)
Undocumented in source. Be warned that the author may not have intended to support it.
div16
ubyte div16(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
div4
ubyte div4(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
do_png
ubyte* do_png(png* p, int* x, int* y, int* n, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
do_zlib
int do_zlib(zbuf* a, ubyte* obuf, int olen, int exp, int parse_header)
Undocumented in source. Be warned that the author may not have intended to support it.
expand
int expand(zbuf* z, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
expand_palette
int expand_palette(png* a, ubyte* palette, int len, int pal_img_n)
Undocumented in source. Be warned that the author may not have intended to support it.
extend_receive
int extend_receive(jpeg* j, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
f2f
int f2f(double x)
Undocumented in source. Be warned that the author may not have intended to support it.
fill_bits
void fill_bits(zbuf* z)
Undocumented in source. Be warned that the author may not have intended to support it.
float2fixed
int float2fixed(double x)
Undocumented in source. Be warned that the author may not have intended to support it.
fsh
int fsh(int x)
Undocumented in source. Be warned that the author may not have intended to support it.
get16
int get16(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get16le
int get16le(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get32
uint get32(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get32le
uint get32le(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get8
int get8(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get8u
ubyte get8u(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get_chunk_header
chunk get_chunk_header(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
get_marker
ubyte get_marker(jpeg* j)
Undocumented in source. Be warned that the author may not have intended to support it.
getn
int getn(stbi* s, ubyte* buffer, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
grow_buffer_unsafe
void grow_buffer_unsafe(jpeg* j)
Undocumented in source. Be warned that the author may not have intended to support it.
high_bit
int high_bit(uint z)
Undocumented in source. Be warned that the author may not have intended to support it.
idct_block
void idct_block(ubyte* out_, int out_stride, short data, stbi_dequantize_t* dequantize)
Undocumented in source. Be warned that the author may not have intended to support it.
init_defaults
void init_defaults()
Undocumented in source. Be warned that the author may not have intended to support it.
load_jpeg_image
ubyte* load_jpeg_image(jpeg* z, int* out_x, int* out_y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
parse_entropy_coded_data
int parse_entropy_coded_data(jpeg* z)
Undocumented in source. Be warned that the author may not have intended to support it.
parse_huffman_block
int parse_huffman_block(zbuf* a)
Undocumented in source. Be warned that the author may not have intended to support it.
parse_png_file
int parse_png_file(png* z, int scan, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
parse_uncompressed_block
int parse_uncompressed_block(zbuf* a)
Undocumented in source. Be warned that the author may not have intended to support it.
parse_zlib
int parse_zlib(zbuf* a, int parse_header)
Undocumented in source. Be warned that the author may not have intended to support it.
parse_zlib_header
int parse_zlib_header(zbuf* a)
Undocumented in source. Be warned that the author may not have intended to support it.
process_frame_header
int process_frame_header(jpeg* z, int scan)
Undocumented in source. Be warned that the author may not have intended to support it.
process_marker
int process_marker(jpeg* z, int m)
Undocumented in source. Be warned that the author may not have intended to support it.
process_scan_header
int process_scan_header(jpeg* z)
Undocumented in source. Be warned that the author may not have intended to support it.
resample_row_1
ubyte* resample_row_1(ubyte* out_, ubyte* in_near, ubyte* in_far, int w, int hs)
Undocumented in source. Be warned that the author may not have intended to support it.
resample_row_generic
ubyte* resample_row_generic(ubyte* out_, ubyte* in_near, ubyte* in_far, int w, int hs)
Undocumented in source. Be warned that the author may not have intended to support it.
resample_row_h_2
ubyte* resample_row_h_2(ubyte* out_, ubyte* in_near, ubyte* in_far, int w, int hs)
Undocumented in source. Be warned that the author may not have intended to support it.
resample_row_hv_2
ubyte* resample_row_hv_2(ubyte* out_, ubyte* in_near, ubyte* in_far, int w, int hs)
Undocumented in source. Be warned that the author may not have intended to support it.
resample_row_v_2
ubyte* resample_row_v_2(ubyte* out_, ubyte* in_near, ubyte* in_far, int w, int hs)
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset(jpeg* j)
Undocumented in source. Be warned that the author may not have intended to support it.
shiftsigned
int shiftsigned(int v, int shift, int bits)
Undocumented in source. Be warned that the author may not have intended to support it.
skip
void skip(stbi* s, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
start_mem
void start_mem(stbi* s, const(ubyte)* buffer, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_bmp_load
ubyte* stbi_bmp_load(stbi* s, int* x, int* y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_bmp_test
void stbi_bmp_test(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_fill_gif_background
void stbi_fill_gif_background(stbi_gif* g)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_gif_header
int stbi_gif_header(stbi* s, stbi_gif* g, int* comp, int is_info)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_gif_load
ubyte* stbi_gif_load(stbi* s, int* x, int* y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_gif_load_next
ubyte* stbi_gif_load_next(stbi* s, stbi_gif* g, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_gif_parse_colortable
void stbi_gif_parse_colortable(stbi* s, ubyte pal, int num_entries, int transp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_gif_test
void stbi_gif_test(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_image_free
void stbi_image_free(void* retval_from_stbi_load)

Frees an image loaded by stb_image.

stbi_jpeg_load
ubyte* stbi_jpeg_load(stbi* s, int* x, int* y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_jpeg_test
void stbi_jpeg_test(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_load_from_memory
ubyte* stbi_load_from_memory(void[] buffer, int width, int height, int components, int requestedComponents)

Loads an image from memory.

stbi_load_main
ubyte* stbi_load_main(stbi* s, int* x, int* y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_lrot
uint stbi_lrot(uint x, uint y)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_out_gif_code
void stbi_out_gif_code(stbi_gif* g, ushort code)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_png_load
ubyte* stbi_png_load(stbi* s, int* x, int* y, int* comp, int req_comp)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_png_test
void stbi_png_test(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_process_gif_raster
ubyte* stbi_process_gif_raster(stbi* s, stbi_gif* g)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_rewind
void stbi_rewind(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_zlib_decode_buffer
int stbi_zlib_decode_buffer(ubyte* obuffer, int olen, const(ubyte)* ibuffer, int ilen)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_zlib_decode_malloc
ubyte* stbi_zlib_decode_malloc(const(ubyte)* buffer, int len, int* outlen)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_zlib_decode_malloc_guesssize
ubyte* stbi_zlib_decode_malloc_guesssize(const(ubyte)* buffer, int len, int initial_size, int* outlen)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_zlib_decode_malloc_guesssize_headerflag
ubyte* stbi_zlib_decode_malloc_guesssize_headerflag(const(ubyte)* buffer, int len, int initial_size, int* outlen, int parse_header)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_zlib_decode_noheader_buffer
int stbi_zlib_decode_noheader_buffer(ubyte* obuffer, int olen, const(ubyte)* ibuffer, int ilen)
Undocumented in source. Be warned that the author may not have intended to support it.
stbi_zlib_decode_noheader_malloc
ubyte* stbi_zlib_decode_noheader_malloc(const(ubyte)* buffer, int len, int* outlen)
Undocumented in source. Be warned that the author may not have intended to support it.
zbuild_huffman
int zbuild_huffman(zhuffman* z, ubyte* sizelist, int num)
Undocumented in source. Be warned that the author may not have intended to support it.
zget8
int zget8(zbuf* z)
Undocumented in source. Be warned that the author may not have intended to support it.
zhuffman_decode
int zhuffman_decode(zbuf* a, zhuffman* z)
Undocumented in source. Be warned that the author may not have intended to support it.
zreceive
uint zreceive(zbuf* z, int n)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

FAST_BITS
enum FAST_BITS;
Undocumented in source.
MARKER_none
enum MARKER_none;
Undocumented in source.
STBI_VERSION
enum STBI_VERSION;
Undocumented in source.
ZFAST_BITS
enum ZFAST_BITS;
Undocumented in source.
ZFAST_MASK
enum ZFAST_MASK;
Undocumented in source.

Static functions

check_png_header
int check_png_header(stbi* s)
Undocumented in source. Be warned that the author may not have intended to support it.
compute_transparency
int compute_transparency(png* z, ubyte tc, int out_n)
Undocumented in source. Be warned that the author may not have intended to support it.
create_png_image_raw
int create_png_image_raw(png* a, ubyte* raw, uint raw_len, int out_n, uint x, uint y)
Undocumented in source. Be warned that the author may not have intended to support it.
paeth
int paeth(int a, int b, int c)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

bmask
uint bmask;
Undocumented in source.
default_distance
ubyte[32] default_distance;
Undocumented in source.
default_length
ubyte[288] default_length;
Undocumented in source.
dezigzag
ubyte dezigzag;
Undocumented in source.
dist_base
int dist_base;
Undocumented in source.
dist_extra
int dist_extra;
Undocumented in source.
first_row_filter
ubyte[5] first_row_filter;
Undocumented in source.
length_base
int length_base;
Undocumented in source.
length_extra
int length_extra;
Undocumented in source.
stbi_png_partial
int stbi_png_partial;
Undocumented in source.

Structs

chunk
struct chunk
Undocumented in source.
huffman
struct huffman
Undocumented in source.
jpeg
struct jpeg
Undocumented in source.
png
struct png
Undocumented in source.
stbi
struct stbi
Undocumented in source.
stbi_gif
struct stbi_gif
Undocumented in source.
stbi_gif_lzw
struct stbi_gif_lzw
Undocumented in source.
stbi_resample
struct stbi_resample
Undocumented in source.
zbuf
struct zbuf
Undocumented in source.
zhuffman
struct zhuffman
Undocumented in source.

Meta