logo
pub trait Graphics: Debug {
Show 17 methods fn will_render(&self); fn did_render(&self); fn on_resize(&self, width: i32, height: i32); fn save(&self); fn translate(&self, x: f32, y: f32); fn scale(&self, x: f32, y: f32); fn rotate(&self, rotation: f32); fn transform(
        &self,
        m00: f32,
        m10: f32,
        m01: f32,
        m11: f32,
        m02: f32,
        m12: f32
    ); fn multiply_alpha(&self, factor: f32); fn set_alpha(&self, alpha: f32); fn set_blend_mode(&self, blend_mode: BlendMode); fn apply_scissor(&self, x: f32, y: f32, width: f32, height: f32); fn restore(&self); fn draw_texture(&self, texture: &Rc<dyn Texture>, dest_x: f32, dest_y: f32); fn draw_sub_texture(
        &self,
        texture: &Rc<dyn Texture>,
        dest_x: f32,
        dest_y: f32,
        source_x: f32,
        source_y: f32,
        source_w: f32,
        source_h: f32
    ); fn draw_pattern(
        &self,
        texture: &Rc<dyn Texture>,
        dest_x: f32,
        dest_y: f32,
        width: f32,
        height: f32
    ); fn fill_rect(&self, color: i32, x: f32, y: f32, width: f32, height: f32);
}
Expand description

Draws to a surface.

Required Methods

Called at the beginning of a frame.

Called at the end of a frame.

Called when the buffer being drawn to was resized.

Saves the graphics state until the next restore(). The state contains the transformation matrix, alpha, blend mode, and scissor rectangle.

Translates the transformation matrix.

Scales the transformation matrix.

Rotates the transformation matrix by the given angle, in degrees.

Multiplies the transformation matrix by the given matrix.

Multiplies the alpha by the given factor.

Sets the alpha to use for drawing.

Sets the blend mode to use for drawing.

Sets the scissor rectangle to the intersection of the current scissor rectangle and the given rectangle, in local coordinates.

Restores the graphics state back to the previous save().

Draws a texture at the given point.

Draws a texture sub-region at the given point.

Draws a repeating texture to the given region.

Draws a colored rectangle at the given region.

Implementors