Struct macroquad::texture::Image[][src]

pub struct Image {
    pub bytes: Vec<u8>,
    pub width: u16,
    pub height: u16,
}
Expand description

Image, data stored in CPU memory

Fields

bytes: Vec<u8>width: u16height: u16

Implementations

Creates an empty Image.

let image = Image::empty();

Creates an Image from a slice of bytes that contains an encoded image.

If format is None, it will make an educated guess on the ImageFormat.

Example
let icon = Image::from_file_with_format(
    include_bytes!("../examples/rust.png"),
    Some(ImageFormat::Png),
    );

Creates an Image filled with the provided Color.

Updates this image from a slice of Colors.

Returns the width of this image.

Returns the height of this image.

Returns this image’s data as a slice of 4-byte arrays.

Returns this image’s data as a mutable slice of 4-byte arrays.

Modifies a pixel Color in this image.

Returns a pixel Color from this image.

Returns an Image from a rect inside this image.

Saves this image as a PNG file.

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

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.