pub struct Gray { /* private fields */ }Expand description
A single-channel 8-bit image: row-major samples carried with their dimensions.
Implementations§
Source§impl Gray
impl Gray
Sourcepub fn from_vec(data: Vec<u8>, width: usize, height: usize) -> Self
pub fn from_vec(data: Vec<u8>, width: usize, height: usize) -> Self
Panics unless data.len() == width * height.
Sourcepub fn from_rgb(rgb: &[u8], width: usize, height: usize) -> Self
pub fn from_rgb(rgb: &[u8], width: usize, height: usize) -> Self
Interleaved 8-bit RGB flattened with the paper’s weights, which sum to exactly 256. Ward notes the green channel alone works as well.
Panics unless rgb.len() == width * height * 3.
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn sample(&self, x: usize, y: usize) -> u8
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Gray
impl RefUnwindSafe for Gray
impl Send for Gray
impl Sync for Gray
impl Unpin for Gray
impl UnsafeUnpin for Gray
impl UnwindSafe for Gray
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