[][src]Struct openpol::image13h::Image13h

pub struct Image13h { /* fields omitted */ }

Methods

impl Image13h[src]

pub fn width(&self) -> usize[src]

Get the width of the image

pub fn height(&self) -> usize[src]

Get the height of the image.

pub fn data(&self) -> &[u8][src]

Get a reference to a slice containing the image data. The data is stored row by row.

pub fn data_mut(&mut self) -> &mut [u8][src]

Like data, but mutable.

pub fn line(&self, line: usize) -> &[u8][src]

Get the image contents of a particular line as a byte slice. line is 0-based. Since the data is stored line-by-line internally it's more optimal that way. If you want to access particular pixel just index into the slice.

pub fn mut_line(&mut self, line: usize) -> &mut [u8][src]

Mutable variant of line().

pub fn load<T: Read>(reader: T) -> Option<Image13h>[src]

Load an image from a reader. Extra content after the expected data is ignored.

Errors

The method will return None if there's something wrong with the contents:

  • width or height equal 0
  • not enough bytes when reading

pub fn empty(width: usize, height: usize) -> Image13h[src]

Create an empty image with the specified dimensions. Empty means the image is filled with color 0.

pub fn empty_screen_sized() -> Image13h[src]

Create an empty, screen-sized Image13h.

pub fn filled_with_color(width: usize, height: usize, color: u8) -> Image13h[src]

Create an image filled with desired color.

pub fn save<T: Write>(&self, writer: T)[src]

Save the image to a writer. Write errors will result in a panic.

pub fn subimage(&self, rect: &Rect) -> Image13h[src]

Extract a rect-bound subimage from the image.

pub fn blit(&mut self, image: &Image13h, rect: &Rect)[src]

Blit another image into a rect in this image. The width and height of image and rect need to be the same.

pub fn blit_whole(&mut self, image: &Image13h, x: usize, y: usize)[src]

Blit whole aother image into this image. The width and height of the other image needs to be at most the width and height of this image.

pub fn fill(&mut self, color: u8)[src]

Fill the image with a color.

Trait Implementations

impl Clone for Image13h[src]

impl Debug for Image13h[src]

impl Eq for Image13h[src]

impl PartialEq<Image13h> for Image13h[src]

impl StructuralEq for Image13h[src]

impl StructuralPartialEq for Image13h[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.