[][src]Struct native_windows_gui::CanvasRenderer

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]

pub fn clear(&mut self, r: f32, g: f32, b: f32, a: f32)[src]

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

pub fn get_render_size(&mut self) -> (f32, f32)[src]

Return the render target size in a tuple of (width, height)

pub fn set_transform(&mut self, m: &[[FLOAT; 2]; 3])[src]

Set the transformation matrix of the renderer

Arguments:
m: The 3x2 matrix.

pub fn get_transform(&mut self) -> [[FLOAT; 2]; 3][src]

Return the transformation matrix of the renderer

pub fn fill_rectangle(&mut self, brush: &ID, r: &Rectangle) -> Result<(), Error>[src]

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

pub fn fill_rounded_rectangle(
    &mut self,
    brush: &ID,
    r: &Rectangle,
    radius: (f32, f32)
) -> Result<(), Error>
[src]

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)

pub fn fill_ellipse(&mut self, brush: &ID, e: &Ellipse) -> Result<(), Error>[src]

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

pub fn draw_rectangle(
    &mut self,
    brush: &ID,
    pen: Option<&ID>,
    r: &Rectangle,
    width: f32
) -> Result<(), Error>
[src]

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

pub fn draw_rounded_rectangle(
    &mut self,
    brush: &ID,
    pen: Option<&ID>,
    r: &Rectangle,
    width: f32,
    radius: (f32, f32)
) -> Result<(), Error>
[src]

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)

pub fn draw_ellipse(
    &mut self,
    brush: &ID,
    pen: Option<&ID>,
    e: &Ellipse,
    width: f32
) -> Result<(), Error>
[src]

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>>

pub fn renderer<'a>(&'a mut self) -> Result<CanvasRenderer<'a, ID>, Error>[src]

Make the canvas "paint ready" and return an object to paint to it. In very very very rare case, the renderer creation can fail.

pub fn create_solid_brush(
    &mut self,
    name: &ID,
    brush: &SolidBrush
) -> Result<(), Error>
[src]

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

pub fn create_pen(&mut self, name: &ID, pen: &Pen) -> Result<(), Error>[src]

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

pub fn redraw(&self)[src]

Redraw the canvas

pub fn set_render_size(&mut self, w: u32, h: u32)[src]

Set the render target resolution.
If the control size do not match the render target size, the result will be upscaled or downscaled

pub fn get_dpi(&mut self) -> (f32, f32)[src]

Return the render target's dots per inch (DPI).

pub fn set_dpi(&mut self, dpix: f32, fpiy: f32)[src]

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.

pub fn get_visibility(&self) -> bool[src]

pub fn set_visibility(&self, visible: bool)[src]

pub fn get_position(&self) -> (i32, i32)[src]

pub fn set_position(&self, x: i32, y: i32)[src]

pub fn get_size(&self) -> (u32, u32)[src]

pub fn set_size(&self, w: u32, h: u32)[src]

pub fn get_enabled(&self) -> bool[src]

pub fn set_enabled(&self, e: bool)[src]

Trait Implementations

impl<'a, ID: Clone + Hash> Drop for CanvasRenderer<'a, ID>[src]

impl<'a, ID: Clone + Hash> DerefMut for CanvasRenderer<'a, ID>[src]

impl<'a, ID: Clone + Hash> Deref for CanvasRenderer<'a, ID>[src]

type Target = Canvas<ID>

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a, ID> !Send for CanvasRenderer<'a, ID>

impl<'a, ID> !Sync for CanvasRenderer<'a, ID>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]