pub struct Painter { /* private fields */ }
Expand description

Helper to paint shapes and text to a specific region on a specific layer.

All coordinates are screen coordinates in the unit points (one point can consist of many physical pixels).

Implementations

Create a painter to a specific layer within a certain clip rectangle.

Redirect where you are painting.

Create a painter for a sub-region of this Painter.

The clip-rect of the returned Painter will be the intersection of the given rectangle and the clip_rect() of the parent Painter.

Redirect where you are painting.

👎 Deprecated:

Use Painter::with_clip_rect

Get a reference to the parent Context.

Available fonts.

Where we paint

Everything painted in this Painter will be clipped against this. This means nothing outside of this rectangle will be visible on screen.

Everything painted in this Painter will be clipped against this. This means nothing outside of this rectangle will be visible on screen.

Useful for pixel-perfect rendering.

Useful for pixel-perfect rendering.

Useful for pixel-perfect rendering.

It is up to the caller to make sure there is room for this. Can be used for free painting. NOTE: all coordinates are screen coordinates!

Add many shapes at once.

Calling this once is generally faster than calling Self::add multiple times.

Modify an existing Shape.

text with a background

Paints a line from the first point to the second.

Paints a horizontal line.

Paints a vertical line.

Show an arrow starting at origin and going in the direction of vec, with the length vec.length().

Lay out and paint some text.

To center the text at the given position, use Align2::CENTER_CENTER.

To find out the size of text before painting it, use Self::layout or Self::layout_no_wrap.

Returns where the text ended up.

Will wrap text at the given width and line break at \n.

Paint the results with Self::galley.

Will line break at \n.

Paint the results with Self::galley.

Paint text that has already been layed out in a Galley.

You can create the Galley with Self::layout.

If you want to change the color of the text, use Self::galley_with_color.

Paint text that has already been layed out in a Galley.

You can create the Galley with Self::layout.

The text color in the Galley will be replaced with the given color.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more