pub struct Image { /* private fields */ }
Expand description

A decoded icon image.

An Image struct consists of a width, a height, a PixelFormat, and a data array encoding the image pixels in that format.

Regardless of format, pixel data for an image is always stored one complete pixel at a time, in row-major order (that is, the top-left pixel comes first, followed by the rest of the top row from left to right; then comes the second row down, again from left to right, and so on until finally the bottom-right pixel comes last).

Implementations

Reads an image from a PNG file.

Internal function to decode a PNG.

Writes the image to a PNG file.

Creates a new image with all pixel data set to zero.

Creates a new image using the given pixel data. Returns an error if the data array is not the correct length.

Returns the format in which this image’s pixel data is stored.

Returns the width of the image, in pixels.

Returns the height of the image, in pixels.

Returns a reference to the image’s pixel data.

Returns a mutable reference to the image’s pixel data.

Consumes the image, returning the pixel data without cloning it.

Creates a copy of this image by converting to the specified pixel format. This operation always succeeds, but may lose information (e.g. converting from RGBA to RGB will silently drop the alpha channel). If the source image is already in the requested format, this is equivalant to simply calling clone().

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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.