use pixels::Pixels;
pub trait PixelsExt {
fn get_frame_u32(&mut self) -> &mut [u32];
}
impl PixelsExt for Pixels {
fn get_frame_u32(&mut self) -> &mut [u32] {
if let Ok(slice) = bytemuck::try_cast_slice_mut::<u8, u32>(self.get_frame()) {
slice
} else {
panic!("Pixels are not aligned on a 4-byte boundary");
}
}
}