core/image/qoi
qoi
Types
6Error
Error :: ErrorSourceImage
Image :: ImageSourceOptions
Options :: OptionsSourceQOI_Opcode_Tag
QOI_Opcode_Tag :: enum u8 {
// 2-bit tags
INDEX = 0, // 6-bit index into color array follows
DIFF = 64, // 3x (RGB) 2-bit difference follows (-2..1), bias of 2.
LUMA = 128, // Luma difference
RUN = 192, // Run length encoding, bias -1
// 8-bit tags
RGB = 254, // Raw RGB pixel follows
RGBA = 255, // Raw RGBA pixel follows
}SourceRGBA_Pixel
RGBA_Pixel :: RGBA_PixelSourceRGB_Pixel
RGB_Pixel :: RGB_PixelSourceConstants
2QOI_Data_Mask
QOI_Data_Mask :: 0b0011_1111SourceQOI_Opcode_Mask
QOI_Opcode_Mask :: 0b1100_0000SourceProcedures
7destroy
destroy :: proc(img: ^Image)SourceCleanup of image-specific data.
load_from_bytes
load_from_bytes :: proc(data: []u8, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (img: ^Image, err: Error)Sourceload_from_context
load_from_context :: proc(ctx: ^C, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (img: ^Image, err: Error)Sourceload_from_file
load_from_file :: proc(filename: string, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (img: ^Image, err: Error)Sourceqoi_hash
qoi_hash :: proc(pixel: RGBA_Pixel) -> (index: u8)Sourcesave_to_buffer
save_to_buffer :: proc(output: ^bytes.Buffer, img: ^Image, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (err: Error)Sourcesave_to_file
save_to_file :: proc(output: string, img: ^Image, options: Options = Options{}, allocator: mem.Allocator = context.allocator) -> (err: Error)SourceProcedure Groups
2load
load :: proc{load_from_file, load_from_bytes, load_from_context}Sourcesave
save :: proc{save_to_buffer, save_to_file}Source