[−][src]Struct egui::Painter
Helper to paint shapes and text to a specific region on a specific layer.
Implementations
impl Painter
[src]
pub fn new(ctx: Arc<Context>, layer_id: LayerId, clip_rect: Rect) -> Self
[src]
#[must_use]pub fn with_layer_id(self, layer_id: LayerId) -> Self
[src]
pub fn set_layer_id(&mut self, layer_id: LayerId)
[src]
redirect
pub fn sub_region(&self, rect: Rect) -> Self
[src]
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 this Painter
.
impl Painter
[src]
pub fn layer_id(&self) -> LayerId
[src]
Where we paint
pub fn clip_rect(&self) -> Rect
[src]
Everything painted in this Painter
will be clipped against this.
This means nothing outside of this rectangle will be visible on screen.
pub fn set_clip_rect(&mut self, clip_rect: Rect)
[src]
Everything painted in this Painter
will be clipped against this.
This means nothing outside of this rectangle will be visible on screen.
pub fn round_to_pixel(&self, point: f32) -> f32
[src]
Useful for pixel-perfect rendering
pub fn round_vec_to_pixels(&self, vec: Vec2) -> Vec2
[src]
Useful for pixel-perfect rendering
pub fn round_pos_to_pixels(&self, pos: Pos2) -> Pos2
[src]
Useful for pixel-perfect rendering
impl Painter
[src]
pub fn add(&self, paint_cmd: PaintCmd) -> PaintCmdIdx
[src]
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!
pub fn extend(&self, cmds: Vec<PaintCmd>)
[src]
pub fn set(&self, idx: PaintCmdIdx, cmd: PaintCmd)
[src]
Modify an existing command.
impl Painter
[src]
pub fn debug_rect(&mut self, rect: Rect, color: Srgba, text: impl Into<String>)
[src]
pub fn error(&self, pos: Pos2, text: impl Display)
[src]
pub fn debug_arrow(&self, origin: Pos2, dir: Vec2, stroke: Stroke)
[src]
impl Painter
[src]
pub fn line_segment(&self, points: [Pos2; 2], stroke: impl Into<Stroke>)
[src]
pub fn circle(
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Srgba>,
stroke: impl Into<Stroke>
)
[src]
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Srgba>,
stroke: impl Into<Stroke>
)
pub fn circle_filled(
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Srgba>
)
[src]
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Srgba>
)
pub fn circle_stroke(
&self,
center: Pos2,
radius: f32,
stroke: impl Into<Stroke>
)
[src]
&self,
center: Pos2,
radius: f32,
stroke: impl Into<Stroke>
)
pub fn rect(
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Srgba>,
stroke: impl Into<Stroke>
)
[src]
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Srgba>,
stroke: impl Into<Stroke>
)
pub fn rect_filled(
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Srgba>
)
[src]
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Srgba>
)
pub fn rect_stroke(
&self,
rect: Rect,
corner_radius: f32,
stroke: impl Into<Stroke>
)
[src]
&self,
rect: Rect,
corner_radius: f32,
stroke: impl Into<Stroke>
)
impl Painter
[src]
pub fn text(
&self,
pos: Pos2,
anchor: (Align, Align),
text: impl Into<String>,
text_style: TextStyle,
text_color: Srgba
) -> Rect
[src]
&self,
pos: Pos2,
anchor: (Align, Align),
text: impl Into<String>,
text_style: TextStyle,
text_color: Srgba
) -> Rect
Lay out and paint some text.
To center the text at the given position, use anchor: (Center, Center)
.
Returns where the text ended up.
pub fn galley(
&self,
pos: Pos2,
galley: Galley,
text_style: TextStyle,
color: Srgba
)
[src]
&self,
pos: Pos2,
galley: Galley,
text_style: TextStyle,
color: Srgba
)
Paint text that has already been layed out in a Galley
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Painter
[src]
impl Send for Painter
[src]
impl Sync for Painter
[src]
impl Unpin for Painter
[src]
impl !UnwindSafe for Painter
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,