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§
Sourcefn top(&self) -> BorderSide
fn top(&self) -> BorderSide
The top side of this border.
Sourcefn bottom(&self) -> BorderSide
fn bottom(&self) -> BorderSide
The bottom side of this border.
Sourcefn is_uniform(&self) -> bool
fn is_uniform(&self) -> bool
Whether all four sides of the border are identical. Uniform borders are typically more efficient to paint.
Sourcefn paint(
&self,
canvas: &mut DisplayListBuilder,
rect: Rect,
text_direction: Option<TextDirection>,
shape: BoxShape,
border_radius: Option<BorderRadius>,
)
fn paint( &self, canvas: &mut DisplayListBuilder, rect: Rect, text_direction: Option<TextDirection>, shape: BoxShape, border_radius: Option<BorderRadius>, )
Implementations§
Source§impl dyn BoxBorder
impl dyn BoxBorder
Sourcepub fn from_ltrb(
top: BorderSide,
right: BorderSide,
bottom: BorderSide,
left: BorderSide,
) -> Border
pub fn from_ltrb( top: BorderSide, right: BorderSide, bottom: BorderSide, left: BorderSide, ) -> Border
Creates a Border.
Sourcepub fn all(
color: Color,
width: f64,
style: BorderStyle,
stroke_align: f64,
) -> Border
pub fn all( color: Color, width: f64, style: BorderStyle, stroke_align: f64, ) -> Border
A uniform Border with all sides the same color and width.
Sourcepub fn from_border_side(side: BorderSide) -> Border
pub fn from_border_side(side: BorderSide) -> Border
Creates a Border whose sides are all the same.
Sourcepub fn symmetric(vertical: BorderSide, horizontal: BorderSide) -> Border
pub fn symmetric(vertical: BorderSide, horizontal: BorderSide) -> Border
Creates a Border with symmetrical vertical and horizontal sides.
Sourcepub fn from_steb(
top: BorderSide,
start: BorderSide,
end: BorderSide,
bottom: BorderSide,
) -> BorderDirectional
pub fn from_steb( top: BorderSide, start: BorderSide, end: BorderSide, bottom: BorderSide, ) -> BorderDirectional
Creates a BorderDirectional.
Sourcepub 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,
)
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".