[−][src]Struct openpol::image13h::Image13h
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
impl RefUnwindSafe for Image13h
impl Send for Image13h
impl Sync for Image13h
impl Unpin for Image13h
impl UnwindSafe for Image13h
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,