pub struct Image {
pub width: usize,
pub height: usize,
pub format: Format,
/* private fields */
}Expand description
A Netpbm image
Fields§
§width: usizeWidth of the image in pixels
height: usizeHeight of the image in pixels
format: FormatFormat of the image (pbm, pgm or ppm)
Implementations§
Source§impl Image
impl Image
Sourcepub fn new(image_type: Format, width: usize, height: usize) -> Image
pub fn new(image_type: Format, width: usize, height: usize) -> Image
Create a new image of the given format and dimensions
pub fn width(&self) -> usize
pub fn height(&self) -> usize
Sourcepub fn set_pixel(&mut self, x: usize, y: usize, value: u8)
pub fn set_pixel(&mut self, x: usize, y: usize, value: u8)
Set the pixel at the given coordinates to a new color
pub fn get_pixel(&self, x: usize, y: usize) -> u8
Sourcepub fn write_to<W: Write>(
&self,
writer: &mut W,
encoding: Encoding,
) -> Result<()>
pub fn write_to<W: Write>( &self, writer: &mut W, encoding: Encoding, ) -> Result<()>
Write the image to a writer
pub fn read_from<R: Read>(reader: &mut R) -> Result<Self>
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
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