pub struct Matrix<P> { /* private fields */ }Expand description
A matrix of packed texels (channel groups).
The underlying buffer may have more data allocated than this region and cause the overhead to be reused when resizing the image. All ways to construct this already check that all pixels within the resulting image can be addressed via an index.
Implementations§
Source§impl<P> Matrix<P>
impl<P> Matrix<P>
pub fn from_width_height( pixel: Texel<P>, width: usize, height: usize, ) -> Option<Self>
pub fn width_and_height(width: usize, height: usize) -> Option<Self>where
P: AsTexel,
pub const fn empty(pixel: Texel<P>) -> Self
pub fn into_matrix_bytes(self) -> MatrixBytes
pub fn width(self) -> usize
pub fn height(self) -> usize
pub fn pixel(self) -> Texel<P>
Sourcepub fn transmute<Q: AsTexel>(self) -> Matrix<Q>
pub fn transmute<Q: AsTexel>(self) -> Matrix<Q>
Reinterpret to another, same size pixel type.
See transmute_to for details.
Sourcepub fn transmute_to<Q>(self, pixel: Texel<Q>) -> Matrix<Q>
pub fn transmute_to<Q>(self, pixel: Texel<Q>) -> Matrix<Q>
Reinterpret to another, same size pixel type.
§Panics
Like std::mem::transmute, the size of the two types need to be equal. This ensures that
all indices are valid in both directions.
Source§impl<P> Matrix<P>
impl<P> Matrix<P>
pub fn with_matrix(pixel: Texel<P>, matrix: MatrixBytes) -> Option<Self>
Trait Implementations§
impl<P> Copy for Matrix<P>
impl<P> Eq for Matrix<P>
Source§impl<P> From<Matrix<P>> for MatrixBytes
impl<P> From<Matrix<P>> for MatrixBytes
Source§impl<P> MatrixLayout for Matrix<P>
impl<P> MatrixLayout for Matrix<P>
Source§fn matrix(&self) -> MatrixBytes
fn matrix(&self) -> MatrixBytes
The valid matrix specification of this layout. Read more
Source§impl<P> PartialOrd for Matrix<P>
impl<P> PartialOrd for Matrix<P>
Source§impl<P> Raster<P> for Matrix<P>
Note: on 64-bit targets only the first u32::MAX dimensions appear accessible.
impl<P> Raster<P> for Matrix<P>
Note: on 64-bit targets only the first u32::MAX dimensions appear accessible.
Source§impl<P> SliceLayout for Matrix<P>
impl<P> SliceLayout for Matrix<P>
Source§impl<P: AsTexel> StridedLayout for Matrix<P>
impl<P: AsTexel> StridedLayout for Matrix<P>
Source§fn strided(&self) -> StridedBytes
fn strided(&self) -> StridedBytes
The valid strided specification of this layout. Read more
Auto Trait Implementations§
impl<P> Freeze for Matrix<P>
impl<P> RefUnwindSafe for Matrix<P>where
P: RefUnwindSafe,
impl<P> Send for Matrix<P>where
P: Send,
impl<P> Sync for Matrix<P>where
P: Sync,
impl<P> Unpin for Matrix<P>where
P: Unpin,
impl<P> UnsafeUnpin for Matrix<P>
impl<P> UnwindSafe for Matrix<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more