Skip to main content

PainterExt

Trait PainterExt 

Source
pub trait PainterExt {
    // Required methods
    fn blur_rect(&self, rect: Rect, blur_radius: f32, color: Color32);
    fn glow_rect(
        &self,
        rect: Rect,
        rounding: CornerRadius,
        color: Color32,
        intensity: f32,
    );
    fn shadow(
        &self,
        rect: Rect,
        rounding: CornerRadius,
        offset: Vec2,
        blur_radius: f32,
        color: Color32,
    );
    fn dashed_line(
        &self,
        points: &[Pos2],
        stroke: Stroke,
        dash_length: f32,
        gap_length: f32,
    );
    fn dotted_line(
        &self,
        points: &[Pos2],
        color: Color32,
        dot_radius: f32,
        spacing: f32,
    );
    fn gradient_rect_horizontal(
        &self,
        rect: Rect,
        rounding: CornerRadius,
        from: Color32,
        to: Color32,
    );
    fn radial_glow(
        &self,
        center: Pos2,
        radius: f32,
        color: Color32,
        falloff: f32,
    );
}
Expand description

Extension trait for egui’s Painter with advanced effects

Required Methods§

Source

fn blur_rect(&self, rect: Rect, blur_radius: f32, color: Color32)

Draw a blurred rectangle using layered alpha

Approximates blur by drawing multiple expanding rectangles with decreasing opacity

Source

fn glow_rect( &self, rect: Rect, rounding: CornerRadius, color: Color32, intensity: f32, )

Draw a glow effect around a rectangle

Creates a soft glow by drawing multiple expanding outlines

Source

fn shadow( &self, rect: Rect, rounding: CornerRadius, offset: Vec2, blur_radius: f32, color: Color32, )

Draw a shadow with blur

Renders a blurred shadow offset from the original rectangle

Source

fn dashed_line( &self, points: &[Pos2], stroke: Stroke, dash_length: f32, gap_length: f32, )

Draw a dashed line

Creates a line with alternating dashes and gaps

Source

fn dotted_line( &self, points: &[Pos2], color: Color32, dot_radius: f32, spacing: f32, )

Draw a dotted line

Creates a line with dots at regular intervals

Source

fn gradient_rect_horizontal( &self, rect: Rect, rounding: CornerRadius, from: Color32, to: Color32, )

Draw a gradient-filled rectangle

Uses mesh rendering for smooth gradients

Source

fn radial_glow(&self, center: Pos2, radius: f32, color: Color32, falloff: f32)

Draw a radial glow at a point

Useful for creating spotlight or highlight effects

Implementations on Foreign Types§

Source§

impl PainterExt for Painter

Source§

fn blur_rect(&self, rect: Rect, blur_radius: f32, color: Color32)

Source§

fn glow_rect( &self, rect: Rect, rounding: CornerRadius, color: Color32, intensity: f32, )

Source§

fn shadow( &self, rect: Rect, rounding: CornerRadius, offset: Vec2, blur_radius: f32, color: Color32, )

Source§

fn dashed_line( &self, points: &[Pos2], stroke: Stroke, dash_length: f32, gap_length: f32, )

Source§

fn dotted_line( &self, points: &[Pos2], color: Color32, dot_radius: f32, spacing: f32, )

Source§

fn gradient_rect_horizontal( &self, rect: Rect, rounding: CornerRadius, from: Color32, to: Color32, )

Source§

fn radial_glow(&self, center: Pos2, radius: f32, color: Color32, falloff: f32)

Implementors§