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>
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 resize(&self,
w: u32,
h: u32,
resize_type: ResizeType)
-> Result<Self, String>
w: u32,
h: u32,
resize_type: ResizeType)
-> Result<Self, String>
fn roi<'a>(&'a self, x: u32, y: u32, w: u32, h: u32) -> ImageRoi<'a>
Get a piece of the image
fn into_data(self) -> Box<[Color]>
Return a boxed slice of colors making up the image
fn draw<R: Renderer>(&self, renderer: &mut R, x: i32, y: i32)
Draw the image on a window
Trait Implementations
impl Clone for Image
[src]
fn clone(&self) -> Image
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Renderer for Image
[src]
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 data(&self) -> &[Color]
Return a reference to a slice of colors making up the image
fn data_mut(&mut self) -> &mut [Color]
Return a mutable reference to a slice of colors making up the image
fn sync(&mut self) -> bool
Flip the buffer
fn pixel(&mut self, x: i32, y: i32, color: Color)
Draw a pixel
fn arc(&mut self, x0: i32, y0: i32, radius: i32, parts: u8, color: Color)
Draw a piece of an arc. Negative radius will fill in the inside
fn circle(&mut self, x0: i32, y0: i32, radius: i32, color: Color)
Draw a circle. Negative radius will fill in the inside
fn line(&mut self, argx1: i32, argy1: i32, argx2: i32, argy2: i32, color: Color)
Draw a line
fn lines(&mut self, points: &[[i32; 2]], color: Color)
fn draw_path_stroke(&mut self, graphicspath: GraphicsPath, color: Color)
Draw a path (GraphicsPath)
fn char(&mut self, x: i32, y: i32, c: char, color: Color)
Draw a character, using the loaded font
fn set(&mut self, color: Color)
Set entire window to a color
fn clear(&mut self)
Sets the whole window to black
fn rect(&mut self, x: i32, y: i32, w: u32, h: u32, color: Color)
Draw rectangle
fn image(&mut self, start_x: i32, start_y: i32, w: u32, h: u32, data: &[Color])
Display an image
fn linear_gradient(&mut self,
rect_x: i32,
rect_y: i32,
rect_width: u32,
rect_height: u32,
start_x: i32,
start_y: i32,
end_x: i32,
end_y: i32,
start_color: Color,
end_color: Color)
rect_x: i32,
rect_y: i32,
rect_width: u32,
rect_height: u32,
start_x: i32,
start_y: i32,
end_x: i32,
end_y: i32,
start_color: Color,
end_color: Color)
Draw a linear gradient in a rectangular region
fn rounded_rect(&mut self,
x: i32,
y: i32,
w: u32,
h: u32,
radius: u32,
filled: bool,
color: Color)
x: i32,
y: i32,
w: u32,
h: u32,
radius: u32,
filled: bool,
color: Color)
Draw a rect with rounded corners