Trait penrose::draw::DrawContext [−][src]
pub trait DrawContext {
fn font(&mut self, font_name: &str, point_size: i32) -> Result<()>;
fn color(&mut self, color: &Color);
fn clear(&mut self);
fn translate(&self, dx: f64, dy: f64);
fn set_x_offset(&self, x: f64);
fn set_y_offset(&self, y: f64);
fn rectangle(&self, x: f64, y: f64, w: f64, h: f64);
fn text(
&self,
s: &str,
h_offset: f64,
padding: (f64, f64)
) -> Result<(f64, f64)>;
fn text_extent(&self, s: &str) -> Result<(f64, f64)>;
fn flush(&self);
}
Expand description
Used for simple drawing to the screen
Required methods
Set the active font, must have been registered on the partent Draw
Translate this context by (dx, dy) from its current position
fn set_x_offset(&self, x: f64)
fn set_x_offset(&self, x: f64)
Set the x offset for this context absolutely
fn set_y_offset(&self, y: f64)
fn set_y_offset(&self, y: f64)
Set the y offset for this context absolutely
Draw a filled rectangle using the current color
Render ‘s’ using the current font with the supplied padding. returns the extent taken up by the rendered text
Determine the pixel width of a given piece of text using the current font