[][src]Struct pix_engine::image::Image

pub struct Image { /* fields omitted */ }

Methods

impl Image[src]

pub fn new(width: u32, height: u32) -> Self[src]

Creates a new image with given size

pub fn new_ref(width: u32, height: u32) -> ImageRef[src]

pub fn ref_from(image: Image) -> ImageRef[src]

pub fn rgb(width: u32, height: u32) -> Self[src]

pub fn rgb_ref(width: u32, height: u32) -> ImageRef[src]

pub fn rgba(width: u32, height: u32) -> Self[src]

pub fn rgba_ref(width: u32, height: u32) -> ImageRef[src]

pub fn from_bytes(
    width: u32,
    height: u32,
    bytes: &[u8]
) -> PixEngineResult<Self>
[src]

Creates a new image from an array of bytes

pub fn get_pixel(&self, x: u32, y: u32) -> Pixel[src]

Gets the pixel at the given (x, y) coords

pub fn put_pixel(&mut self, x: u32, y: u32, p: Pixel)[src]

Sets the pixel at the given (x, y) coords

pub fn color_type(&self) -> ColorType[src]

ColorType of the image

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

Width of the image

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

Height of the image

pub fn bytes(&self) -> &Vec<u8>[src]

Returns a reference to the pixels within the image

pub fn bytes_mut(&mut self) -> &mut Vec<u8>[src]

Returns a mutable reference to the pixels within the image

pub fn from_file(file: &str) -> PixEngineResult<Self>[src]

Create a new image from a PNG file Only 8-bit RGBA formats are supported currently

pub fn save_to_file(&mut self, file: &str) -> PixEngineResult<()>[src]

Saves a image out to a png file

Trait Implementations

impl Clone for Image[src]

Auto Trait Implementations

impl RefUnwindSafe for Image

impl Send for Image

impl Sync for Image

impl Unpin for Image

impl UnwindSafe for Image

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,