Pen
struct · ferroui-base · v0.5.0
struct Pen
Describes how a stroke is drawn.
Members
TYPEto_refbrush_propertythickness_propertydash_style_propertyline_cap_propertyline_join_propertymiter_limit_propertyconstructnewwith_brushfrom_uint32with_allbrushset_brushthicknessset_thicknessdash_styleset_dash_styleline_capset_line_capline_joinset_line_joinmiter_limitset_miter_limitto_immutabletry_modify_or_createinvalidated
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<Pen>
Returns a strong reference to this object.
brush_property
fn brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
thickness_property
fn thickness_property() -> &'static StyledProperty<f64>
dash_style_property
fn dash_style_property() -> &'static StyledProperty<Option<Rc<dyn IDashStyle>>>
line_cap_property
fn line_cap_property() -> &'static StyledProperty<PenLineCap>
line_join_property
fn line_join_property() -> &'static StyledProperty<PenLineJoin>
miter_limit_property
fn miter_limit_property() -> &'static StyledProperty<f64>
construct
fn construct() -> Self
Creates the class data.
new
fn new() -> Ref<Self>
Creates a pen with default values.
with_brush
fn with_brush(brush: Option<Rc<dyn IBrush>>, thickness: f64) -> Ref<Self>
Creates a solid pen with the given brush and thickness: no dashes, flat caps, miter joins and a miter limit of 10.
from_uint32
fn from_uint32(color: u32, thickness: f64) -> Ref<Self>
Creates a solid pen with the color given as an 0xAARRGGBB value.
with_all
fn with_all(brush: Option<Rc<dyn IBrush>>, thickness: f64, dash_style: Option<Rc<dyn IDashStyle>>, line_cap: PenLineCap, line_join: PenLineJoin, miter_limit: f64) -> Ref<Self>
Creates a pen.
brush
fn brush(self: &Self) -> Option<Rc<dyn IBrush>>
The brush used to draw the stroke.
set_brush
fn set_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
thickness
fn thickness(self: &Self) -> f64
The stroke thickness.
set_thickness
fn set_thickness(self: &Self, value: f64)
dash_style
fn dash_style(self: &Self) -> Option<Rc<dyn IDashStyle>>
The style of dashed lines drawn with the pen.
set_dash_style
fn set_dash_style(self: &Self, value: Option<Rc<dyn IDashStyle>>)
line_cap
fn line_cap(self: &Self) -> PenLineCap
The type of shape to use on both ends of a line.
set_line_cap
fn set_line_cap(self: &Self, value: PenLineCap)
line_join
fn line_join(self: &Self) -> PenLineJoin
A value describing how to join consecutive line or curve segments.
set_line_join
fn set_line_join(self: &Self, value: PenLineJoin)
miter_limit
fn miter_limit(self: &Self) -> f64
The limit of the ratio of the miter length to half this pen's thickness.
set_miter_limit
fn set_miter_limit(self: &Self, value: f64)
to_immutable
fn to_immutable(self: &Self) -> ImmutablePen
Creates an immutable clone of the pen.
try_modify_or_create
fn try_modify_or_create(pen: &mut Option<Rc<dyn IPen>>, brush: Option<Rc<dyn IBrush>>, thickness: f64, stroke_dash_array: Option<StrokeDashArray<'_>>, stroke_dash_offset: f64, line_cap: PenLineCap, line_join: PenLineJoin, miter_limit: f64) -> bool
Smart reuse and update of a pen.
If brush is None, pen is cleared. If the brush and the dashes
are immutable, a new immutable pen is created. Otherwise the existing
mutable pen is updated, or a new mutable pen is created.
Returns true if pen was created or cleared, false if the existing
pen was modified in place.
invalidated
fn invalidated(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Subscribes to invalidation of the pen: raised whenever a change
requires strokes drawn with the pen to be redrawn. Dropping the
returned guard removes the handler; Subscription::detach keeps it
for the life of the pen.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<Pen>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplICompositionRenderResourceIAffectsRender
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.