pub struct Painter<'a, 'b> { /* private fields */ }Implementations§
Source§impl<'a, 'b> Painter<'a, 'b>
impl<'a, 'b> Painter<'a, 'b>
pub fn new(ctx: &'a mut PaintCtx<'b>) -> Self
pub fn size(&self) -> Size
pub fn rect(&self) -> Rect
pub fn origin_global(&self) -> Point
pub fn ctx(&mut self) -> &mut PaintCtx<'b>
pub fn push_list_transform(&mut self, t: Transform)
pub fn pop_list_transform(&mut self)
pub fn with_transform<R>( &mut self, t: Transform, f: impl FnOnce(&mut Self) -> R, ) -> R
pub fn unproject(&self, p: Point) -> Option<Point>
pub fn to_global_rect(&self, r: Rect) -> Rect
pub fn to_global_point(&self, p: Point) -> Point
pub fn to_local_point(&self, p: Point) -> Point
pub fn fill(&mut self, rect: Rect, fill: Fill) -> Rect
pub fn rounded(&mut self, rect: Rect, radius: f32, fill: Fill) -> Rect
pub fn circle(&mut self, center: Point, radius: f32, fill: Fill) -> Rect
pub fn ring( &mut self, center: Point, radius: f32, width: f32, color: Color, ) -> Rect
pub fn line( &mut self, from: Point, to: Point, stroke: BrushStroke, color: Color, ) -> Rect
pub fn polyline( &mut self, points: &[Point], stroke: BrushStroke, color: Color, ) -> Rect
pub fn curve( &mut self, p0: Point, c0: Point, c1: Point, p1: Point, stroke: BrushStroke, color: Color, ) -> Rect
pub fn rect_outline( &mut self, rect: Rect, radius: f32, stroke: BrushStroke, color: Color, ) -> Rect
pub fn polygon(&mut self, points: &[Point], color: Color) -> Rect
pub fn ellipse(&mut self, center: Point, rx: f32, ry: f32, color: Color) -> Rect
pub fn text(&mut self, text: &str, baseline: Point, size: f32, color: Color)
pub fn text_tl(&mut self, text: &str, top_left: Point, size: f32, color: Color)
pub fn text_tl_rotated( &mut self, text: &str, top_left: Point, size: f32, color: Color, degrees: f32, pivot: Point, )
pub fn text_styled( &mut self, text: &str, baseline: Point, size: f32, weight: FontWeight, color: Color, )
pub fn text_width(&mut self, text: &str, size: f32) -> f32
pub fn text_width_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> f32
pub fn text_center_x( &mut self, text: &str, center_x: f32, top: f32, size: f32, color: Color, )
pub fn text_center(&mut self, rect: Rect, text: &str, size: f32, color: Color)
pub fn image(&mut self, rect: Rect, uv: [f32; 4], source: ImageSource) -> Rect
pub fn pixels(&mut self, rect: Rect, pixels: &Pixels) -> Rect
pub fn pixels_region(&mut self, dst: Rect, pixels: &Pixels, src: Rect) -> Rect
pub fn pixel_uv(width: u32, height: u32, src: Rect) -> Option<[f32; 4]>
pub fn pixel_at( rect: Rect, width: u32, height: u32, p: Point, ) -> Option<(i32, i32)>
pub fn knob(&mut self, center: Point, radius: f32, fill: Color) -> Rect
pub fn sv_field(&mut self, rect: Rect, hue01: f32) -> Rect
pub fn grid(&mut self, step: f32, color: Color) -> u32
pub fn grid_offset(&mut self, step: f32, offset: Vec2, color: Color) -> u32
pub fn axes(&mut self, origin: Point, color: Color, width: f32) -> Rect
pub fn frame(&mut self, rect: Rect, color: Color, width: f32) -> Rect
pub fn cross( &mut self, center: Point, half: f32, width: f32, color: Color, ) -> Rect
pub fn marquee( &mut self, a: Point, b: Point, fill: Fill, outline: Color, ) -> Rect
pub fn ellipse_outline( &mut self, center: Point, rx: f32, ry: f32, stroke: BrushStroke, color: Color, ) -> Rect
pub fn capsule( &mut self, from: Point, to: Point, radius: f32, color: Color, ) -> Rect
pub fn arrow( &mut self, from: Point, to: Point, width: f32, head_len: f32, head_width: f32, color: Color, ) -> Rect
pub fn x_marker( &mut self, center: Point, half: f32, width: f32, color: Color, ) -> Rect
pub fn regular_polygon( &mut self, center: Point, radius: f32, sides: u32, rotation_deg: f32, color: Color, ) -> Rect
pub fn star( &mut self, center: Point, outer_r: f32, inner_r: f32, points: u32, rotation_deg: f32, color: Color, ) -> Rect
pub fn dots( &mut self, step: f32, offset: Vec2, radius: f32, color: Color, ) -> u32
pub fn grid_split( &mut self, step: f32, every: u32, offset: Vec2, minor: Color, major: Color, ) -> u32
pub fn clipped<R>(&mut self, rect: Rect, f: impl FnOnce(&mut Self) -> R) -> R
pub fn clipped_rounded<R>( &mut self, rect: Rect, radius: f32, f: impl FnOnce(&mut Self) -> R, ) -> R
Auto Trait Implementations§
impl<'a, 'b> !RefUnwindSafe for Painter<'a, 'b>
impl<'a, 'b> !Send for Painter<'a, 'b>
impl<'a, 'b> !Sync for Painter<'a, 'b>
impl<'a, 'b> !UnwindSafe for Painter<'a, 'b>
impl<'a, 'b> Freeze for Painter<'a, 'b>
impl<'a, 'b> Unpin for Painter<'a, 'b>
impl<'a, 'b> UnsafeUnpin for Painter<'a, 'b>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more