API referencestd/image

std/image/convert

Public declarations, types, methods, and source contracts for std/image/convert.

On this page

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/convert"

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
color std/image/color convert.dodo
pixels std/image/pixels convert.dodo
ptr core/ptr convert.dodo

f32_bits

Function · Source

pub fn f32_bits(value: f32) -> u32

f32_from_bits

Function · Source

pub fn f32_from_bits(bits: u32) -> f32

half_to_f32_bits

Function · Source

An IEEE binary16 value widened exactly to binary32 bits.

pub fn half_to_f32_bits(half: u16) -> u32

f32_bits_to_half

Function · Source

Binary32 bits rounded to binary16, to nearest with ties to even.

pub fn f32_bits_to_half(bits: u32) -> u16

f32_bits_to_unorm16

Function · Source

Binary32 bits clamped to 0.0..1.0 and rounded to a 16-bit unorm; NaN is 0.

pub fn f32_bits_to_unorm16(bits: u32) -> u16

unorm16_to_f32_bits

Function · Source

A 16-bit unorm as the nearest binary32 bits of value / 65535.

pub fn unorm16_to_f32_bits(value: u16) -> u32

luma16

Function · Source

pub fn luma16(r: u32, g: u32, b: u32) -> u32

load_rgba16

Function · Source

count pixels of row (in layout) from pixel first, as straight 16-bit RGBA in out[..4 * count].

pub fn load_rgba16(row: &[u8], layout: &pixels.Layout, first: usize, count: usize, out: &mut[u16])

store_rgba16

Function · Source

Write count straight 16-bit RGBA pixels from input[..4 * count] into row (in layout) from pixel first.

pub fn store_rgba16(input: &[u16], row: &mut[u8], layout: &pixels.Layout, first: usize, count: usize)

load_rgba8

Function · Source

count pixels from pixel first as straight 8-bit RGBA in out[..4 * count]. 8-bit RGBA and RGB rows are copied directly.

pub fn load_rgba8(row: &[u8], layout: &pixels.Layout, first: usize, count: usize, out: &mut[u8])

store_rgba8

Function · Source

Write count straight 8-bit RGBA pixels into row from pixel first.

pub fn store_rgba8(input: &[u8], row: &mut[u8], layout: &pixels.Layout, first: usize, count: usize)

row

Function · Source

Convert count pixels of source (in from, starting at pixel source_first) into target (in to, from pixel target_first).

pub fn row(source: &[u8], source_layout: &pixels.Layout, source_first: usize, target: &mut[u8], target_layout: &pixels.Layout, target_first: usize, count: usize)

copy_rect

Function · Source

Convert source into target with its top-left corner at (x, y), skipping pixels outside the target.

pub fn copy_rect(source: &pixels.View, target: &mut pixels.ViewMut, x: u32, y: u32)

copy

Function · Source

Convert source into target, which must have the same size.

pub fn copy(source: &pixels.View, target: &mut pixels.ViewMut) -> void!pixels.Error

premultiply

Function · Source

Multiply color by alpha in place and mark the view premultiplied. Views without alpha, or already premultiplied, are unchanged.

pub fn premultiply(view: &mut pixels.ViewMut)

unpremultiply

Function · Source

Divide color by alpha in place and mark the view straight.

pub fn unpremultiply(view: &mut pixels.ViewMut)

srgb_to_linear

Function · Source

Re-encode the color channels of view from sRGB to linear light in place. 8-bit samples lose shadow detail this way; prefer 16-bit or float views. Float samples use the exact curve on 16-bit precision values clamped to 0.0..1.0 for integer layouts; float layouts keep the sign and use the curve’s tables per sample.

pub fn srgb_to_linear(view: &mut pixels.ViewMut)

linear_to_srgb

Function · Source

Re-encode the color channels of view from linear light to sRGB in place.

pub fn linear_to_srgb(view: &mut pixels.ViewMut)

Search every guide, reference page, and API declaration.