Skip to main content

ShapeBorder

Trait ShapeBorder 

Source
pub trait ShapeBorder: Any + Debug {
Show 17 methods // Required methods fn dimensions(&self) -> EdgeInsetsGeometry; fn scale(&self, t: f64) -> ShapeBorderRef; fn get_outer_path( &self, rect: Rect, text_direction: Option<TextDirection>, ) -> Path; fn get_inner_path( &self, rect: Rect, text_direction: Option<TextDirection>, ) -> Path; fn paint( &self, canvas: &mut DisplayListBuilder, rect: Rect, text_direction: Option<TextDirection>, ); fn as_any(&self) -> &(dyn Any + 'static); // Provided methods fn add( &self, other: &ShapeBorderRef, reversed: bool, ) -> Option<ShapeBorderRef> { ... } fn lerp_from( &self, a: Option<&(dyn ShapeBorder + 'static)>, t: f64, ) -> Option<ShapeBorderRef> { ... } fn lerp_to( &self, b: Option<&(dyn ShapeBorder + 'static)>, t: f64, ) -> Option<ShapeBorderRef> { ... } fn hit_test( &self, rect: Rect, position: Offset, text_direction: Option<TextDirection>, ) -> bool { ... } fn paint_interior( &self, canvas: &mut DisplayListBuilder, rect: Rect, paint: &Paint, text_direction: Option<TextDirection>, ) { ... } fn prefer_paint_interior(&self) -> bool { ... } fn as_outlined_border(&self) -> Option<&(dyn OutlinedBorder + 'static)> { ... } fn into_outlined_border(self: Rc<Self>) -> Option<Rc<dyn OutlinedBorder>> { ... } fn as_box_border(&self) -> Option<&(dyn BoxBorder + 'static)> { ... } fn into_box_border(self: Rc<Self>) -> Option<Rc<dyn BoxBorder>> { ... } fn eq_shape(&self, other: &(dyn ShapeBorder + 'static)) -> bool { ... }
}
Expand description

Base class for shape outlines.

This class handles how to add multiple borders together. Subclasses define various shapes, like circles (CircleBorder), rounded rectangles (RoundedRectangleBorder), continuous rectangles (ContinuousRectangleBorder), or beveled rectangles (BeveledRectangleBorder).

Required Methods§

Source

fn dimensions(&self) -> EdgeInsetsGeometry

The widths of the sides of this border represented as an EdgeInsetsGeometry.

Source

fn scale(&self, t: f64) -> ShapeBorderRef

Creates a copy of this border, scaled by the factor t.

Source

fn get_outer_path( &self, rect: Rect, text_direction: Option<TextDirection>, ) -> Path

Create a Path that describes the outer edge of the border.

Source

fn get_inner_path( &self, rect: Rect, text_direction: Option<TextDirection>, ) -> Path

Create a Path that describes the inner edge of the border.

Source

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

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

Source

fn as_any(&self) -> &(dyn Any + 'static)

Downcast support for is / as in Dart.

Provided Methods§

Source

fn add(&self, other: &ShapeBorderRef, reversed: bool) -> Option<ShapeBorderRef>

Attempts to create a new object that represents the amalgamation of this border and the other border.

If the type of the other border isn’t known, or the given instance cannot be reasonably added to this instance, then this should return None.

The reversed argument is true if this object was the right operand of plus, and false if it was the left operand.

Source

fn lerp_from( &self, a: Option<&(dyn ShapeBorder + 'static)>, t: f64, ) -> Option<ShapeBorderRef>

Linearly interpolates from another ShapeBorder (possibly of another class) to this.

Return None if this class cannot interpolate from a. If a is None, this must not return None.

Source

fn lerp_to( &self, b: Option<&(dyn ShapeBorder + 'static)>, t: f64, ) -> Option<ShapeBorderRef>

Linearly interpolates from this to another ShapeBorder (possibly of another class).

Return None if this class cannot interpolate to b. If b is None, this must not return None.

Source

fn hit_test( &self, rect: Rect, position: Offset, text_direction: Option<TextDirection>, ) -> bool

Tests whether the outer boundary of this border contains position.

Source

fn paint_interior( &self, canvas: &mut DisplayListBuilder, rect: Rect, paint: &Paint, text_direction: Option<TextDirection>, )

Paint a canvas with the appropriate shape.

On subclasses whose prefer_paint_interior returns true, this should be faster than using Canvas.draw_path with the path provided by get_outer_path.

Source

fn prefer_paint_interior(&self) -> bool

Reports whether paint_interior is implemented.

Source

fn as_outlined_border(&self) -> Option<&(dyn OutlinedBorder + 'static)>

OutlinedBorder downcast for Dart’s is OutlinedBorder.

Source

fn into_outlined_border(self: Rc<Self>) -> Option<Rc<dyn OutlinedBorder>>

OutlinedBorder downcast of the shared border, for Dart’s as OutlinedBorder (ShapeBorderRef::as_outlined_border_ref). An OutlinedBorder answers Some(self), as it answers as_outlined_border.

Source

fn as_box_border(&self) -> Option<&(dyn BoxBorder + 'static)>

BoxBorder downcast for BoxBorderRef::lerp.

Source

fn into_box_border(self: Rc<Self>) -> Option<Rc<dyn BoxBorder>>

BoxBorder downcast of the shared border (ShapeBorderRef::as_box_border_ref). A box border answers Some(self), as it answers as_box_border.

Source

fn eq_shape(&self, other: &(dyn ShapeBorder + 'static)) -> bool

Field equality. Dart’s default == is identity; subclasses that override == implement this.

Trait Implementations§

Source§

impl From<Box<dyn ShapeBorder>> for ShapeBorderRef

Source§

fn from(border: Box<dyn ShapeBorder>) -> ShapeBorderRef

Converts to this type from the input type.
Source§

impl PartialEq for dyn ShapeBorder

Source§

fn eq(&self, other: &(dyn ShapeBorder + 'static)) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§