Struct egui::Painter [−][src]
pub struct Painter { /* fields omitted */ }
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
impl Painter
[src]
impl Painter
[src]pub fn new(ctx: CtxRef, 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]
pub fn set_layer_id(&mut self, layer_id: LayerId)
[src]redirect
pub fn sub_region(&self, rect: Rect) -> Self
[src]
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]
impl Painter
[src]pub fn clip_rect(&self) -> Rect
[src]
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]
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]
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]
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]
pub fn round_pos_to_pixels(&self, pos: Pos2) -> Pos2
[src]Useful for pixel-perfect rendering
impl Painter
[src]
impl Painter
[src]pub fn add(&self, shape: Shape) -> ShapeIdx
[src]
pub fn add(&self, shape: Shape) -> ShapeIdx
[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!
impl Painter
[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<Color32>,
stroke: impl Into<Stroke>
)
[src]
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Color32>,
stroke: impl Into<Stroke>
)
pub fn circle_filled(
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Color32>
)
[src]
&self,
center: Pos2,
radius: f32,
fill_color: impl Into<Color32>
)
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<Color32>,
stroke: impl Into<Stroke>
)
[src]
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Color32>,
stroke: impl Into<Stroke>
)
pub fn rect_filled(
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Color32>
)
[src]
&self,
rect: Rect,
corner_radius: f32,
fill_color: impl Into<Color32>
)
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]
impl Painter
[src]pub fn text(
&self,
pos: Pos2,
anchor: Align2,
text: impl ToString,
text_style: TextStyle,
text_color: Color32
) -> Rect
[src]
pub fn text(
&self,
pos: Pos2,
anchor: Align2,
text: impl ToString,
text_style: TextStyle,
text_color: Color32
) -> Rect
[src]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: Arc<Galley>, color: Color32)
[src]
pub fn galley(&self, pos: Pos2, galley: Arc<Galley>, color: Color32)
[src]Paint text that has already been layed out in a Galley
.
pub fn galley_with_italics(
&self,
pos: Pos2,
galley: Arc<Galley>,
color: Color32,
fake_italics: bool
)
[src]
&self,
pos: Pos2,
galley: Arc<Galley>,
color: Color32,
fake_italics: bool
)
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Painter
impl Send for Painter
impl Sync for Painter
impl Unpin for Painter
impl !UnwindSafe for Painter
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more