Struct orbimage::Image
[−]
[src]
pub struct Image { /* fields omitted */ }
Methods
impl Image
[src]
fn new(width: u32, height: u32) -> Self
Create a new image
fn from_color(width: u32, height: u32, color: Color) -> Self
Create a new image filled whole with color
fn from_data(width: u32, height: u32, data: Box<[Color]>) -> Result<Self, String>
Create a new image from a boxed slice of colors
fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, String>
Load an image from file path. Supports BMP and PNG
fn default() -> Self
Create a new empty image
fn width(&self) -> u32
Get the width of the image in pixels
fn height(&self) -> u32
Get the height of the image in pixels
fn roi<'a>(&'a self, x: u32, y: u32, w: u32, h: u32) -> ImageRoi<'a>
Get a piece of the image
fn data(&self) -> &[Color]
Return a reference to a slice of colors making up the image
fn into_data(self) -> Box<[Color]>
Return a boxed slice of colors making up the image
fn draw(&self, window: &mut Window, x: i32, y: i32)
Draw the image on a window