[][src]Struct romy::Image

pub struct Image { /* fields omitted */ }

An image that can be displayed by the runtime.

Internally stores data as an array of 32 bit RGBA values.

Methods

impl Image[src]

pub fn new(width: i32, height: i32, color: Color) -> Image[src]

Create a blank image

Arguments

  • width - the number of horizontal pixels
  • height - the number of vertical pixels.
  • color - the initial color of all pixels in the image.

pub fn from_data(width: i32, height: i32, data: &[u8]) -> Image[src]

Create an image from a slice of existing data

Arguments

  • width - the number of horizontal pixels
  • height - the number of vertical pixels
  • data - slice of existing data.

pub fn set_pixel(&mut self, x: i32, y: i32, color: Color)[src]

Sets a pixel in the image to a specified color

Arguments

  • x - horizontal coordinate
  • y - vertical coordinate
  • color - color to set the pixel to

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

Gets the number of horizontal pixels

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

Gets the number of vertical pixels

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

Gets a reference to the raw pixel buffer

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

Gets a reference to the raw pixel as u8s

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

Gets a mutable reference to the raw pixel buffer

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

Gets a mutable reference to the raw pixel buffer as u8s

pub fn blit(&mut self, source: &Image, x: i32, y: i32, width: i32, height: i32)[src]

Draws an image into a section of this one, will ignore fully transparent pixels, but does not blend semi-transparent ones.

Arguments

  • `source' - Image to take data from
  • x - horizontal coordinate to draw at in this image
  • y - vertical coordinate to draw at in this image
  • width - horizontal pixel span to draw into on this image
  • height - vertical pixel span to draw into on this image

Trait Implementations

impl<'de> Deserialize<'de> for Image[src]

impl Debug for Image[src]

impl Serialize for Image[src]

Auto Trait Implementations

impl Send for Image

impl Sync for Image

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

impl<T, U> TryInto 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<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.