Skip to main content

BoxBorder

Trait BoxBorder 

Source
pub trait BoxBorder: ShapeBorder {
    // Required methods
    fn top(&self) -> BorderSide;
    fn bottom(&self) -> BorderSide;
    fn is_uniform(&self) -> bool;
    fn paint(
        &self,
        canvas: &mut DisplayListBuilder,
        rect: Rect,
        text_direction: Option<TextDirection>,
        shape: BoxShape,
        border_radius: Option<BorderRadius>,
    );
}
Expand description

Base class for box borders that can paint as rectangles, circles, or rounded rectangles.

The only API difference that this class introduces over ShapeBorder is that its paint method takes additional arguments.

Required Methods§

Source

fn top(&self) -> BorderSide

The top side of this border.

Source

fn bottom(&self) -> BorderSide

The bottom side of this border.

Source

fn is_uniform(&self) -> bool

Whether all four sides of the border are identical. Uniform borders are typically more efficient to paint.

Source

fn paint( &self, canvas: &mut DisplayListBuilder, rect: Rect, text_direction: Option<TextDirection>, shape: BoxShape, border_radius: Option<BorderRadius>, )

Paints the border within the given Rect on the given Canvas.

This is an extension of the ShapeBorder::paint method. It allows BoxBorder borders to be applied to different BoxShapes and with different border_radius parameters, without changing the BoxBorder object itself.

Implementations§

Source§

impl dyn BoxBorder

Source

pub fn from_ltrb( top: BorderSide, right: BorderSide, bottom: BorderSide, left: BorderSide, ) -> Border

Creates a Border.

Source

pub fn all( color: Color, width: f64, style: BorderStyle, stroke_align: f64, ) -> Border

A uniform Border with all sides the same color and width.

Source

pub fn from_border_side(side: BorderSide) -> Border

Creates a Border whose sides are all the same.

Source

pub fn symmetric(vertical: BorderSide, horizontal: BorderSide) -> Border

Creates a Border with symmetrical vertical and horizontal sides.

Source

pub fn from_steb( top: BorderSide, start: BorderSide, end: BorderSide, bottom: BorderSide, ) -> BorderDirectional

Creates a BorderDirectional.

Source

pub fn paint_non_uniform_border( canvas: &mut DisplayListBuilder, rect: Rect, border_radius: Option<BorderRadius>, text_direction: Option<TextDirection>, shape: BoxShape, top: BorderSide, right: BorderSide, bottom: BorderSide, left: BorderSide, color: Color, )

Paints a Border with different widths, styles and strokeAligns, on any borderRadius while using a single color.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§