Struct graphics::image::Image [−] [src]

pub struct Image {
    pub color: Option<Color>,
    pub rectangle: Option<Rectangle>,
    pub source_rectangle: Option<SourceRectangle>,
}

An image

Fields

color

The color

rectangle

The rectangle to draw image inside

source_rectangle

The image source rectangle

Methods

impl Image

fn new() -> Image

Creates a new image

fn new_colored(color: Color) -> Image

Creates a new colored image

fn color(self, value: Color) -> Self

Sets color.

fn maybe_color(self, value: Option<Color>) -> Self

Sets optional color.

fn rect<R: Into<Rectangle>>(self, value: R) -> Self

Sets rectangle.

fn maybe_rect<R: Into<Rectangle>>(self, value: Option<R>) -> Self

Sets optional rectangle.

fn src_rect(self, value: SourceRectangle) -> Self

Sets source rectangle.

fn maybe_src_rect(self, value: Option<SourceRectangle>) -> Self

Sets optional source rectangle.

fn draw<G>(&self, texture: &G::Texture, draw_state: &DrawState, transform: Matrix2d, g: &mut G) where G: Graphics

Draws the image.

Trait Implementations

Derived Implementations

impl Clone for Image

fn clone(&self) -> Image

fn clone_from(&mut self, source: &Self)

impl Copy for Image