[−][src]Struct canrust::utils::Image
Struct containing an image which can be projected onto the Canvas.
Implementations
impl Image
[src]
pub fn from_file(path: &str, position: (f32, f32)) -> Result<Self, String>
[src]
Load a new image from file.
pub fn from_image(img: &Image) -> Option<Self>
[src]
Clones an existing image from reference
impl Image
[src]
pub fn save(&self, path: &str) -> Result<(), String>
[src]
Saves Image to file
pub fn get_size(&self) -> Option<(u32, u32)>
[src]
Returns size of the Image
pub fn get_pixel(&self, x: u32, y: u32) -> Option<Color>
[src]
Returns color of a pixel at give coordinates
pub fn put_pixel(&mut self, x: u32, y: u32, color: Color) -> Result<(), String>
[src]
Gives a pixel at given coordinates a color. Returns and Error if the coordinates are too large.
pub fn pixels_memory(&self) -> Option<&[u8]>
[src]
Returns Images memory buffer
pub fn set_position(&mut self, pos: (f32, f32)) -> Result<(), String>
[src]
Sets objects position on the Canvas
pub fn get_position(&self) -> Option<(f32, f32)>
[src]
Returns objects position on the Canvas
pub fn set_rotation(&mut self, angle: f32) -> Result<(), String>
[src]
Sets the angle at which the image will be displayed on Canvas
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>,