Skip to main content

Painter

Struct Painter 

Source
pub struct Painter<'a, 'b> { /* private fields */ }

Implementations§

Source§

impl<'a, 'b> Painter<'a, 'b>

Source

pub fn new(ctx: &'a mut PaintCtx<'b>) -> Self

Source

pub fn size(&self) -> Size

Source

pub fn rect(&self) -> Rect

Source

pub fn origin_global(&self) -> Point

Source

pub fn ctx(&mut self) -> &mut PaintCtx<'b>

Source

pub fn push_list_transform(&mut self, t: Transform)

Source

pub fn pop_list_transform(&mut self)

Source

pub fn with_transform<R>( &mut self, t: Transform, f: impl FnOnce(&mut Self) -> R, ) -> R

Source

pub fn unproject(&self, p: Point) -> Option<Point>

Source

pub fn to_global_rect(&self, r: Rect) -> Rect

Source

pub fn to_global_point(&self, p: Point) -> Point

Source

pub fn to_local_point(&self, p: Point) -> Point

Source

pub fn fill(&mut self, rect: Rect, fill: Fill) -> Rect

Source

pub fn rounded(&mut self, rect: Rect, radius: f32, fill: Fill) -> Rect

Source

pub fn circle(&mut self, center: Point, radius: f32, fill: Fill) -> Rect

Source

pub fn ring( &mut self, center: Point, radius: f32, width: f32, color: Color, ) -> Rect

Source

pub fn line( &mut self, from: Point, to: Point, stroke: BrushStroke, color: Color, ) -> Rect

Source

pub fn polyline( &mut self, points: &[Point], stroke: BrushStroke, color: Color, ) -> Rect

Source

pub fn curve( &mut self, p0: Point, c0: Point, c1: Point, p1: Point, stroke: BrushStroke, color: Color, ) -> Rect

Source

pub fn rect_outline( &mut self, rect: Rect, radius: f32, stroke: BrushStroke, color: Color, ) -> Rect

Source

pub fn polygon(&mut self, points: &[Point], color: Color) -> Rect

Source

pub fn ellipse(&mut self, center: Point, rx: f32, ry: f32, color: Color) -> Rect

Source

pub fn text(&mut self, text: &str, baseline: Point, size: f32, color: Color)

Source

pub fn text_tl(&mut self, text: &str, top_left: Point, size: f32, color: Color)

Source

pub fn text_tl_rotated( &mut self, text: &str, top_left: Point, size: f32, color: Color, degrees: f32, pivot: Point, )

Source

pub fn text_styled( &mut self, text: &str, baseline: Point, size: f32, weight: FontWeight, color: Color, )

Source

pub fn text_width(&mut self, text: &str, size: f32) -> f32

Source

pub fn text_width_weighted( &mut self, text: &str, size: f32, weight: FontWeight, ) -> f32

Source

pub fn text_center_x( &mut self, text: &str, center_x: f32, top: f32, size: f32, color: Color, )

Source

pub fn text_center(&mut self, rect: Rect, text: &str, size: f32, color: Color)

Source

pub fn image(&mut self, rect: Rect, uv: [f32; 4], source: ImageSource) -> Rect

Source

pub fn pixels(&mut self, rect: Rect, pixels: &Pixels) -> Rect

Source

pub fn pixels_region(&mut self, dst: Rect, pixels: &Pixels, src: Rect) -> Rect

Source

pub fn pixel_uv(width: u32, height: u32, src: Rect) -> Option<[f32; 4]>

Source

pub fn pixel_at( rect: Rect, width: u32, height: u32, p: Point, ) -> Option<(i32, i32)>

Source

pub fn knob(&mut self, center: Point, radius: f32, fill: Color) -> Rect

Source

pub fn sv_field(&mut self, rect: Rect, hue01: f32) -> Rect

Source

pub fn grid(&mut self, step: f32, color: Color) -> u32

Source

pub fn grid_offset(&mut self, step: f32, offset: Vec2, color: Color) -> u32

Source

pub fn axes(&mut self, origin: Point, color: Color, width: f32) -> Rect

Source

pub fn frame(&mut self, rect: Rect, color: Color, width: f32) -> Rect

Source

pub fn cross( &mut self, center: Point, half: f32, width: f32, color: Color, ) -> Rect

Source

pub fn marquee( &mut self, a: Point, b: Point, fill: Fill, outline: Color, ) -> Rect

Source

pub fn ellipse_outline( &mut self, center: Point, rx: f32, ry: f32, stroke: BrushStroke, color: Color, ) -> Rect

Source

pub fn capsule( &mut self, from: Point, to: Point, radius: f32, color: Color, ) -> Rect

Source

pub fn arrow( &mut self, from: Point, to: Point, width: f32, head_len: f32, head_width: f32, color: Color, ) -> Rect

Source

pub fn x_marker( &mut self, center: Point, half: f32, width: f32, color: Color, ) -> Rect

Source

pub fn regular_polygon( &mut self, center: Point, radius: f32, sides: u32, rotation_deg: f32, color: Color, ) -> Rect

Source

pub fn star( &mut self, center: Point, outer_r: f32, inner_r: f32, points: u32, rotation_deg: f32, color: Color, ) -> Rect

Source

pub fn dots( &mut self, step: f32, offset: Vec2, radius: f32, color: Color, ) -> u32

Source

pub fn grid_split( &mut self, step: f32, every: u32, offset: Vec2, minor: Color, major: Color, ) -> u32

Source

pub fn clipped<R>(&mut self, rect: Rect, f: impl FnOnce(&mut Self) -> R) -> R

Source

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> 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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.