pub struct ImageRef<'buf, Layout = &'buf Bytes> { /* private fields */ }
Expand description

A read-only view of an image.

Note that this requires its underlying buffer to be highly aligned! For that reason it is not possible to take a reference at an arbitrary number of bytes.

Implementations

Get a reference to those bytes used by the layout.

Get a view of this image.

Check if a call to ImageRef::with_layout would succeed.

Change this view to a different layout.

This returns Some if the layout fits the underlying data, and None otherwise. Use ImageRef::fits to check this property in a separate call. Note that the new layout need not be related to the old layout in any other way.

Decay into a image with less specific layout.

See Image::decay.

Copy all bytes to a newly allocated image.

Get a slice of the individual samples in the layout.

View this buffer as a slice of pixels.

This reinterprets the bytes of the buffer. It can be used to view the buffer as any kind of pixel, regardless of its association with the layout. Use it with care.

An alternative way to get a slice of texels when a layout has an inherent texel type is Self::as_slice.

Turn into a slice of the individual samples in the layout.

This preserves the lifetime with which the layout is borrowed from the underlying image, and the ImageMut need not stay alive.

Retrieve a single texel from a raster image.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

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

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

🔬 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.