[go: up one dir, main page]

Struct qoi::Header[][src]

pub struct Header {
    pub width: u32,
    pub height: u32,
    pub channels: Channels,
    pub colorspace: ColorSpace,
}
Expand description

Image header: dimensions, channels, color space.

Notes

A valid image header must satisfy the following conditions:

  • Both width and height must be non-zero.
  • Maximum number of pixels is 400Mp (=4e8 pixels).

Fields

width: u32

Image width in pixels

height: u32

Image height in pixels

channels: Channels

Number of 8-bit channels per pixel

colorspace: ColorSpace

Color space (informative field, doesn’t affect encoding)

Implementations

Creates a new header and validates image dimensions.

Creates a new header with modified channels.

Creates a new header with modified color space.

Returns a number of pixels in the image.

Returns the total number of bytes in the raw pixel array.

This may come useful when pre-allocating a buffer to decode the image into.

The maximum number of bytes the encoded image will take.

Can be used to pre-allocate the buffer to encode the image into.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.