pub struct PaintCtx<'a> {
pub environment: &'a Environment,
pub rect: Rect,
pub element: ElementId,
pub state: VisualState,
pub window: WindowId,
pub hovered_subtree: bool,
/* private fields */
}Fields§
§environment: &'a Environment§rect: Rect§element: ElementId§state: VisualState§window: WindowId§hovered_subtree: boolImplementations§
Source§impl PaintCtx<'_>
impl PaintCtx<'_>
pub fn shapes(&self) -> &ShapeCache
pub fn raster_options(&self) -> RasterOptions
pub fn translate(&mut self, dx: f32, dy: f32)
pub fn set_draw_offset(&mut self, offset: impl Into<Point>)
pub fn draw_offset(&self) -> Vec2
pub fn reset_draw_offset(&mut self)
pub fn save(&mut self)
pub fn restore(&mut self)
pub fn path_from_svg(&self, data: &str) -> Option<Path>
pub fn rect(&mut self, rect: Rect, color: Color)
pub fn rounded(&mut self, rect: Rect, radius: f32, color: Color)
pub fn circle(&mut self, center: Point, radius: f32, color: Color) -> Rect
pub fn fill_gradient_rect( &mut self, rect: Rect, stops: &[GradientStop], orientation: Orientation, ) -> Rect
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 path(&mut self, path: &Path, width: f32, color: Color) -> Rect
pub fn text(&mut self, text: &str, size: f32, color: Color)
pub fn fill(&mut self, path: &Path, color: Color) -> Rect
pub fn fill_rule(&mut self, path: &Path, rule: FillRule, color: Color) -> Rect
pub fn stroke(&mut self, path: &Path, style: &StrokeStyle, color: Color) -> Rect
pub fn shape(&mut self, shape: &Shape, color: Color) -> Rect
pub fn draw_shape(&mut self, shape: &Shape, at: Point, color: Color) -> Rect
pub fn fill_gradient(&mut self, path: &Path, gradient: &Gradient) -> Rect
pub fn fill_gradient_rule( &mut self, path: &Path, rule: FillRule, gradient: &Gradient, ) -> Rect
pub fn rounded_rect_gradient( &mut self, rect: Rect, radius: f32, gradient: &Gradient, ) -> Rect
pub fn stroke_gradient( &mut self, path: &Path, style: &StrokeStyle, gradient: &Gradient, ) -> Rect
pub fn shadow( &mut self, rect: Rect, radius: f32, blur: f32, offset: Point, color: Color, ) -> Rect
pub fn inner_shadow( &mut self, rect: Rect, radius: f32, blur: f32, offset: Point, color: Color, ) -> Rect
pub fn shape_gradient_bands( &self, shape: &Shape, at: Point, gradient: &Gradient, band: f32, ) -> Vec<(Rect, Color, f32)>
pub fn push_gradient_bands(&mut self, bands: &[(Rect, Color, f32)]) -> Rect
pub fn draw_shape_gradient( &mut self, shape: &Shape, at: Point, gradient: &Gradient, band: f32, ) -> Rect
pub fn shape_gradient(&mut self, shape: &Shape, gradient: &Gradient) -> Rect
pub fn fill_rect(&mut self, rect: Rect, color: Color) -> Rect
pub fn bars(&mut self, bars: &[Rect], color: Color) -> Rect
pub fn waveform( &mut self, area: Rect, peaks: &[MinMax], opts: WaveformOpts, color: Color, ) -> Rect
pub fn waveform_window( &mut self, area: Rect, peaks: &Peaks, start_peak: usize, count: usize, opts: WaveformOpts, color: Color, ) -> (Rect, usize)
pub fn waveform_line( &mut self, area: Rect, peaks: &[MinMax], width: f32, color: Color, ) -> Rect
pub fn waveform_image( &mut self, area: Rect, peaks: &[MinMax], fg: Color, bg: Color, id: u64, version: u64, ) -> Rect
pub fn disk(&mut self, center: Point, radius: f32, color: Color) -> Rect
pub fn rounded_rect(&mut self, rect: Rect, radius: f32, color: Color) -> Rect
pub fn ellipse(&mut self, center: Point, rx: f32, ry: f32, color: Color) -> Rect
pub fn ellipse_outline( &mut self, center: Point, rx: f32, ry: f32, style: &StrokeStyle, color: Color, ) -> Rect
pub fn rect_outline( &mut self, rect: Rect, style: &StrokeStyle, color: Color, ) -> Rect
pub fn rounded_rect_outline( &mut self, rect: Rect, radius: f32, style: &StrokeStyle, color: Color, ) -> Rect
pub fn rounded_rect_corners( &mut self, rect: Rect, radii: impl Into<Radius>, color: Color, ) -> Rect
pub fn rounded_rect_corners_outline( &mut self, rect: Rect, radii: impl Into<Radius>, style: &StrokeStyle, 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 arrow_styled( &mut self, from: Point, to: Point, style: &StrokeStyle, head_len: f32, head_width: f32, color: Color, ) -> Rect
pub fn cross( &mut self, center: Point, half: f32, 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 regular_polygon_outline( &mut self, center: Point, radius: f32, sides: u32, rotation_deg: f32, style: &StrokeStyle, 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 star_outline( &mut self, center: Point, outer_r: f32, inner_r: f32, points: u32, rotation_deg: f32, style: &StrokeStyle, color: Color, ) -> Rect
pub fn ring( &mut self, center: Point, radius: f32, width: f32, color: Color, ) -> Rect
pub fn arc( &mut self, center: Point, radius: f32, from_deg: f32, to_deg: f32, width: f32, color: Color, ) -> Rect
pub fn sector( &mut self, center: Point, radius: f32, from_deg: f32, to_deg: f32, color: Color, ) -> Rect
pub fn donut_sector( &mut self, center: Point, inner_r: f32, outer_r: f32, from_deg: f32, to_deg: f32, color: Color, ) -> Rect
pub fn line(&mut self, from: Point, to: Point, width: f32, color: Color) -> Rect
pub fn line_crisp( &mut self, from: Point, to: Point, width: f32, color: Color, ) -> Rect
pub fn dotted_line( &mut self, from: Point, to: Point, width: f32, spacing: f32, color: Color, ) -> Rect
pub fn line_styled( &mut self, from: Point, to: Point, style: &StrokeStyle, color: Color, ) -> Rect
pub fn dashed_line( &mut self, from: Point, to: Point, width: f32, dash: impl Into<Dash>, color: Color, ) -> Rect
pub fn outline( &mut self, points: &[Point], style: &StrokeStyle, color: Color, ) -> Rect
pub fn polygon(&mut self, points: &[Point], color: Color) -> Rect
pub fn spline( &mut self, points: &[Point], tension: f32, style: &StrokeStyle, color: Color, ) -> Rect
pub fn curve( &mut self, from: Point, c1: Point, c2: Point, to: Point, style: &StrokeStyle, color: Color, ) -> Rect
pub fn curve_quad( &mut self, from: Point, control: Point, to: Point, style: &StrokeStyle, color: Color, ) -> Rect
pub fn draw_svg( &mut self, data: &str, style: Option<&StrokeStyle>, color: Color, ) -> Rect
pub fn draw_transformed( &mut self, path: &Path, transform: Transform, style: Option<&StrokeStyle>, color: Color, ) -> Rect
Source§impl PaintCtx<'_>
impl PaintCtx<'_>
pub fn theme(&self) -> Theme
pub fn runtime(&self) -> &Runtime
pub fn window_rect(&self) -> Rect
pub fn window_size(&self) -> Size
pub fn scale(&self) -> f32
pub fn safe_insets(&self) -> Edges
pub fn element(&self) -> ElementId
pub fn baseline_centered(rect_top: f32, rect_h: f32, size: f32) -> f32
pub fn baseline_top(rect_top: f32, size: f32) -> f32
pub fn quad(&mut self, rect: Rect, color: Color, radius: f32)
pub fn bordered_quad( &mut self, rect: Rect, background: Color, radius: f32, border_width: f32, border_color: Color, )
pub fn paint_box(&mut self, style: BoxStyle)
pub fn paint_box_in(&mut self, style: BoxStyle, rect: Rect)
pub fn push_clip(&mut self, rect: Rect)
pub fn pop_clip(&mut self)
pub fn push_rounded_clip(&mut self, rect: Rect, radius: f32)
pub fn list_clip_depth(&self) -> usize
pub fn push_backdrop(&mut self, rect: Rect, backdrop: Backdrop)
pub fn draw_text( &mut self, text: &str, origin: (f32, f32), size: f32, color: Color, )
pub fn draw_text_weighted( &mut self, text: &str, origin: (f32, f32), size: f32, weight: FontWeight, color: Color, )
pub fn draw_text_wrapped( &mut self, text: &str, origin: (f32, f32), size: f32, weight: FontWeight, width: f32, mode: WrapMode, color: Color, )
pub fn draw_text_wrapped_spaced( &mut self, text: &str, origin: (f32, f32), size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, color: Color, )
pub fn draw_text_spaced( &mut self, text: &str, origin: (f32, f32), size: f32, spacing: LetterSpacing, color: Color, )
pub fn draw_text_weighted_spaced( &mut self, text: &str, origin: (f32, f32), size: f32, weight: FontWeight, spacing: LetterSpacing, color: Color, )
pub fn draw_text_styled_spaced( &mut self, text: &str, origin: (f32, f32), size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, color: Color, )
pub fn draw_text_wrapped_styled_spaced( &mut self, text: &str, origin: (f32, f32), size: f32, weight: FontWeight, width: f32, mode: WrapMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, color: Color, )
pub fn draw_rich( &mut self, rich: &RichParagraph, origin: (f32, f32), default_color: Color, )
pub fn draw_rich_spans( &mut self, spans: &[TextSpan], origin: (f32, f32), size: f32, width: f32, mode: WrapMode, spacing: LetterSpacing, align: RichAlign, default_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_width_weighted_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> f32
pub fn text_width_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> f32
pub fn elide_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, spacing: LetterSpacing, ) -> String
pub fn elide_styled_spaced( &mut self, text: &str, size: f32, weight: FontWeight, max_width: f32, mode: ElideMode, spacing: LetterSpacing, family: Option<&str>, style: FontStyle, ) -> String
pub fn caret_positions( &mut self, text: &str, size: f32, weight: FontWeight, ) -> Vec<f32>
pub fn caret_positions_spaced( &mut self, text: &str, size: f32, weight: FontWeight, spacing: LetterSpacing, ) -> Vec<f32>
pub fn shape_rich_full( &mut self, spans: &[TextSpan], size: f32, width: f32, mode: WrapMode, spacing: LetterSpacing, align: RichAlign, ) -> Rc<RichParagraph>
pub fn scale_factor(&self) -> f32
pub fn request_frame(&self)
pub fn live_color_exp(&self, prop: Prop, target: Color, rate: f32) -> Color
pub fn draw_sprite( &mut self, key: u64, width: u32, height: u32, alpha: &[u8], rect: Rect, color: Color, )
pub fn image(&mut self, rect: Rect, uv: [f32; 4], source: ImageSource)
pub fn show_overlay(&self, entry: OverlayEntry) -> OverlayId
pub fn hide_overlay(&self, id: OverlayId) -> bool
pub fn has_overlay(&self, id: OverlayId) -> bool
pub fn overlay_rect(&self, id: OverlayId) -> Option<Rect>
pub fn drag_session(&self) -> Option<DragSession>
pub fn is_drag_target(&self) -> bool
pub fn has_focus_within(&self) -> bool
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for PaintCtx<'a>
impl<'a> !Send for PaintCtx<'a>
impl<'a> !Sync for PaintCtx<'a>
impl<'a> !UnwindSafe for PaintCtx<'a>
impl<'a> Freeze for PaintCtx<'a>
impl<'a> Unpin for PaintCtx<'a>
impl<'a> UnsafeUnpin for PaintCtx<'a>
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