Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/image/qoi"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
binary |
std/image/shared/binary |
qoi.dodo |
color |
std/image/color |
qoi.dodo |
meta |
std/image/meta |
qoi.dodo |
pixels |
std/image/pixels |
qoi.dodo |
sink |
std/image/sink |
qoi.dodo |
matches
Function · Source
pub fn matches(data: &[u8]) -> bool
info
Function · Source
pub fn info(data: &[u8]) -> pixels.Header!pixels.Error
metadata
Function · Source
QOI carries no metadata.
pub fn metadata(data: &[u8]) -> meta.Metadata!pixels.Error
scratch_size
Function · Source
The decoder needs no scratch.
pub fn scratch_size(data: &[u8]) -> usize!pixels.Error
decode
Function · Source
pub fn decode<S: sink.Sink>(data: &[u8], output: &mut S, scratch: &mut[u8]) -> void!pixels.Error
EncodeOptions
Struct · Source
pub struct EncodeOptions {
// 0 picks 4 channels when the source has alpha, else 3; 3 or 4 forces
// the count (3 drops alpha).
pub channels: u32
// Write colorspace 1, linear light, instead of 0, sRGB.
pub linear: bool
}
EncodeOptions.new
Function · Source
pub fn new() -> EncodeOptions
max_encoded_size
Function · Source
The largest file encode can produce: every pixel as a full RGB or RGBA chunk, plus the header and end marker.
pub fn max_encoded_size(width: u32, height: u32, layout: &pixels.Layout, options: &EncodeOptions) -> usize!pixels.Error
encode_scratch_size
Function · Source
pub fn encode_scratch_size(width: u32, height: u32, layout: &pixels.Layout, options: &EncodeOptions) -> usize!pixels.Error
encode
Function · Source
Write
sourceas QOI and return the file’s length. The output needs at most max_encoded_size bytes; a smaller buffer works when the image compresses well, else fails with BufferTooSmall.
pub fn encode(source: &pixels.View, options: &EncodeOptions, output: &mut[u8], scratch: &mut[u8]) -> usize!pixels.Error
encode_from
Function · Source
pub fn encode_from<S: sink.Source>(source: &S, options: &EncodeOptions, output: &mut[u8], scratch: &mut[u8]) -> usize!pixels.Error