API referencestd/image

std/image/ppm

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

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

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 ppm.dodo
color std/image/color ppm.dodo
convert std/image/convert ppm.dodo
meta std/image/meta ppm.dodo
pixels std/image/pixels ppm.dodo
sink std/image/sink ppm.dodo

KIND_AUTO

Constant · Source

EncodeOptions.kind values. Pick by the source layout: gray to P5, RGB to P6, alpha to P7, float to PFM.

pub const KIND_AUTO: u32 = 0

KIND_PGM

Constant · Source

pub const KIND_PGM: u32 = 5

KIND_PPM

Constant · Source

pub const KIND_PPM: u32 = 6

KIND_PAM

Constant · Source

pub const KIND_PAM: u32 = 7

KIND_PFM

Constant · Source

pub const KIND_PFM: u32 = 8

matches

Function · Source

‘P’, a known type byte, then whitespace.

pub fn matches(data: &[u8]) -> bool

info

Function · Source

pub fn info(data: &[u8]) -> pixels.Header!pixels.Error

metadata

Function · Source

Netpbm files carry 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 {
    // KIND_AUTO, KIND_PGM, KIND_PPM, KIND_PAM or KIND_PFM.
    pub kind: u32
}

EncodeOptions.new

Function · Source

pub fn new() -> EncodeOptions

max_encoded_size

Function · Source

The exact size encode writes.

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 source and return the byte count, max_encoded_size(…). PFM from a float view keeps the float values exactly, out-of-range ones included.

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

Search every guide, reference page, and API declaration.