pub struct Pen<'renderer> { /* private fields */ }
Expand description

A pen controls its color and renders geometries to the renderer.

This will render when be dropped. So you should re-create on every render.

Implementations§

source§

impl<'renderer> Pen<'renderer>

source

pub fn new(renderer: &'renderer Renderer<'_>) -> Self

Constructs a pen from the renderer Renderer.

source

pub fn renderer(&self) -> &Renderer<'_>

Returns the renderer that the pen is drawing.

source

pub fn set_color(&self, _: Rgb)

Sets the drawing color.

source

pub fn color(&self) -> Rgb

Returns the drawing color.

source

pub fn clear(&self)

Clears all the renderer area.

source

pub fn blend_mode(&self) -> BlendMode

Returns the current color blend mode.

source

pub fn set_blend_mode(&self, mode: BlendMode)

Sets the color blend mode.

source

pub fn line(&self, line: Line)

Draws the line.

source

pub fn lines(&self, points: impl IntoIterator<Item = Point>)

Draws the lines.

source

pub fn point(&self, point: Point)

Draw the point.

source

pub fn points(&self, points: impl IntoIterator<Item = Point>)

Draw the points.

source

pub fn stroke_rect(&self, rect: Rect)

Draw the rectangle only lines.

source

pub fn stroke_rects(&self, rects: impl IntoIterator<Item = Rect>)

Draw the rectangles only lines.

source

pub fn fill_rect(&self, rect: Rect)

Draw the filled rectangle.

source

pub fn fill_rects(&self, rects: impl IntoIterator<Item = Rect>)

Draw the filled rectangles.

Trait Implementations§

source§

impl<'renderer> Debug for Pen<'renderer>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'renderer> Drop for Pen<'renderer>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl FontRenderExt for Pen<'_>

source§

fn text(&self, font: &Font<'_>, text: &str, options: FontRenderOptions)

Renders a text to the area with the font.

Auto Trait Implementations§

§

impl<'renderer> !RefUnwindSafe for Pen<'renderer>

§

impl<'renderer> !Send for Pen<'renderer>

§

impl<'renderer> !Sync for Pen<'renderer>

§

impl<'renderer> Unpin for Pen<'renderer>

§

impl<'renderer> !UnwindSafe for Pen<'renderer>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.