Struct ggez::graphics::Image
[−]
[src]
pub struct Image { /* fields omitted */ }
In-memory image data available to be drawn on the screen.
Methods
impl Image
[src]
fn new<P: AsRef<Path>>(context: &mut Context, path: P) -> GameResult<Image>
Load a new image from the file at the given path.
fn solid(context: &mut Context, size: u32, color: Color) -> GameResult<Image>
A little helper function that creates a new Image that is just a solid square of the given size and color. Mainly useful for debugging.
fn rect(&self) -> Rect
Returns the dimensions of the image.
fn blend_mode(&self) -> BlendMode
Returns the BlendMode
of the image.
fn set_blend_mode(&mut self, blend: BlendMode)
Sets the BlendMode
of the image.
See https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode
for detailed description of blend modes.
fn color_mod(&self) -> Color
Get the color mod of the image.
fn set_color_mod(&mut self, color: Color)
Set the color mod of the image. Each pixel of the image is multiplied by this color when drawn.
fn alpha_mod(&self) -> u8
Get the alpha mod of the image.
fn set_alpha_mod(&mut self, alpha: u8)
Set the alpha mod of the image. Each pixel's alpha will be multiplied by this value when drawn.
fn width(&self) -> u32
Return the width of the image.
fn height(&self) -> u32
Return the height of the image.
Trait Implementations
impl Debug for Image
[src]
impl Drawable for Image
[src]
fn draw_ex(&mut self,
context: &mut Context,
src: Option<Rect>,
dst: Option<Rect>,
angle: f64,
center: Option<Point>,
flip_horizontal: bool,
flip_vertical: bool)
-> GameResult<()>
context: &mut Context,
src: Option<Rect>,
dst: Option<Rect>,
angle: f64,
center: Option<Point>,
flip_horizontal: bool,
flip_vertical: bool)
-> GameResult<()>
Actually draws the object to the screen. This is the most general version of the operation, which is all that is required for implementing this trait. (It also maps nicely onto SDL2's Renderer::copy_ex(), we might want to wrap the types up a bit more nicely someday.) Read more
fn draw(&mut self,
context: &mut Context,
src: Option<Rect>,
dst: Option<Rect>)
-> GameResult<()>
context: &mut Context,
src: Option<Rect>,
dst: Option<Rect>)
-> GameResult<()>
Draws the drawable onto the rendering target.