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
fn will_render(&self)
fn will_render(&self)
Called at the beginning of a frame.
fn did_render(&self)
fn did_render(&self)
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.
Rotates the transformation matrix by the given angle, in degrees.
Multiplies the transformation matrix by the given matrix.
fn multiply_alpha(&self, factor: f32)
fn multiply_alpha(&self, factor: f32)
Multiplies the alpha by the given factor.
fn set_blend_mode(&self, blend_mode: BlendMode)
fn set_blend_mode(&self, blend_mode: BlendMode)
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.
Draws a texture at the given point.
Draws a texture sub-region at the given point.
Draws a repeating texture to the given region.