[−][src]Struct pix_engine::image::Image
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]
width: u32,
height: u32,
bytes: &[u8]
) -> PixEngineResult<Self>
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
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]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,