Struct native_windows_gui::CanvasRenderer
[−]
[src]
pub struct CanvasRenderer<'a, ID: Clone + Hash + 'a> { /* fields omitted */ }
Object that offers a light wrapper over the D2D1 api.
Methods
impl<'a, ID: Clone + Hash> CanvasRenderer<'a, ID>
[src]
fn clear(&mut self, r: f32, g: f32, b: f32, a: f32)
Clears the drawing area to the specified color.
Arguments:
• r
: Red component. 0.0 - 1.0
• g
: Green component. 0.0 - 1.0
• b
: Blue component. 0.0 - 1.0
• a
: Alpha component. 0.0 - 1.0
fn get_render_size(&mut self) -> (f32, f32)
Return the render target size in a tuple of (width
, height
)
fn set_transform(&mut self, m: &[[FLOAT; 2]; 3])
Set the transformation matrix of the renderer
Arguments:
• m
: The 3x2 matrix.
fn get_transform(&mut self) -> [[FLOAT; 2]; 3]
Return the transformation matrix of the renderer
fn fill_rectangle(&mut self, brush: &ID, r: &Rectangle) -> Result<(), Error>
Fill a rectangle shape defined by r
using the brush identified by brush
Arguments:
• brush
: Id of the brush saved in the canvas
• r
: The rectangle shape to draw
fn fill_rounded_rectangle(
&mut self,
brush: &ID,
r: &Rectangle,
radius: (f32, f32)
) -> Result<(), Error>
&mut self,
brush: &ID,
r: &Rectangle,
radius: (f32, f32)
) -> Result<(), Error>
Fill a rounded rectangle shape defined by r
using the brush identified by brush
Arguments:
• brush
: Id of the brush saved in the canvas
• r
: The rectangle shape to draw
• radius
: Amount of rounding on the rectangle border. (width
, height
)
fn fill_ellipse(&mut self, brush: &ID, e: &Ellipse) -> Result<(), Error>
Fill an ellipse shape defined by e
using the brush identified by brush
Arguments:
• brush
: Id of the brush saved in the canvas
• e
: The ellipse shape to draw
fn draw_rectangle(
&mut self,
brush: &ID,
pen: Option<&ID>,
r: &Rectangle,
width: f32
) -> Result<(), Error>
&mut self,
brush: &ID,
pen: Option<&ID>,
r: &Rectangle,
width: f32
) -> Result<(), Error>
Draw the outline of a rectangle shape defined by r
using the brush identified by brush
and the pen identifed
by pen
.
Arguments:
• brush
: Id of the brush saved in the canvas
• pen
: Id of the pen saved in the canvas
• r
: The rectangle shape to draw
• width
: Width of the outline to draw
fn draw_rounded_rectangle(
&mut self,
brush: &ID,
pen: Option<&ID>,
r: &Rectangle,
width: f32,
radius: (f32, f32)
) -> Result<(), Error>
&mut self,
brush: &ID,
pen: Option<&ID>,
r: &Rectangle,
width: f32,
radius: (f32, f32)
) -> Result<(), Error>
Draw the outline of a rounded rectangle shape defined by r
using the brush identified by brush
and the pen identifed
by pen
.
Arguments:
• brush
: Id of the brush saved in the canvas
• pen
: Id of the pen saved in the canvas
• r
: The rectangle shape to draw
• width
: Width of the outline to draw
• radius
: Amount of rounding on the rectangle border. (width
, height
)
fn draw_ellipse(
&mut self,
brush: &ID,
pen: Option<&ID>,
e: &Ellipse,
width: f32
) -> Result<(), Error>
&mut self,
brush: &ID,
pen: Option<&ID>,
e: &Ellipse,
width: f32
) -> Result<(), Error>
Draw the outline of an ellipse shape defined by e
using the brush identified by brush
and the pen identifed
by pen
.
Arguments:
• brush
: Id of the brush saved in the canvas
• pen
: Id of the pen saved in the canvas
• e
: The ellipse shape to draw
• width
: Width of the outline to draw
Methods from Deref<Target = Canvas<ID>>
fn renderer<'a>(&'a mut self) -> Result<CanvasRenderer<'a, ID>, Error>
Make the canvas "paint ready" and return an object to paint to it. In very very very rare case, the renderer creation can fail.
fn create_solid_brush(
&mut self,
name: &ID,
brush: &SolidBrush
) -> Result<(), Error>
&mut self,
name: &ID,
brush: &SolidBrush
) -> Result<(), Error>
Create a solid brush into the canvas and add it under the selected name
.
Errors:
• Error::System
if the canvas could not create the brush.
• Error::KeyExists
if the a resource with the specified name already exists
fn create_pen(&mut self, name: &ID, pen: &Pen) -> Result<(), Error>
Create a pen into the canvas and add it under the selected name
.
Errors:
• Error::System
if the canvas could not create the brush.
• Error::KeyExists
if the a resource with the specified name already exists
fn redraw(&self)
Redraw the canvas
fn set_render_size(&mut self, w: u32, h: u32)
Set the render target resolution.
If the control size do not match the render target size, the result will be upscaled or downscaled
fn get_dpi(&mut self) -> (f32, f32)
Return the render target's dots per inch (DPI).
fn set_dpi(&mut self, dpix: f32, fpiy: f32)
Sets the dots per inch (DPI) of the render target.
Arguments:
• dpix
: A value greater than or equal to zero that specifies the horizontal DPI of the render target.
• dpiy
: A value greater than or equal to zero that specifies the vertical DPI of the render target.
fn get_visibility(&self) -> bool
fn set_visibility(&self, visible: bool)
fn get_position(&self) -> (i32, i32)
fn set_position(&self, x: i32, y: i32)
fn get_size(&self) -> (u32, u32)
fn set_size(&self, w: u32, h: u32)
fn get_enabled(&self) -> bool
fn set_enabled(&self, e: bool)
Trait Implementations
impl<'a, ID: Clone + Hash> Deref for CanvasRenderer<'a, ID>
[src]
type Target = Canvas<ID>
The resulting type after dereferencing
fn deref(&self) -> &Canvas<ID>
The method called to dereference a value