FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Pen

    struct · ferroui-base · v0.5.0

    struct Pen
    

    Describes how a stroke is drawn.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<Pen>
    

    Returns a strong reference to this object.

    Source

    brush_property

    fn brush_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
    

    Source

    thickness_property

    fn thickness_property() -> &'static StyledProperty<f64>
    

    Source

    dash_style_property

    fn dash_style_property() -> &'static StyledProperty<Option<Rc<dyn IDashStyle>>>
    

    Source

    line_cap_property

    fn line_cap_property() -> &'static StyledProperty<PenLineCap>
    

    Source

    line_join_property

    fn line_join_property() -> &'static StyledProperty<PenLineJoin>
    

    Source

    miter_limit_property

    fn miter_limit_property() -> &'static StyledProperty<f64>
    

    Source

    construct

    fn construct() -> Self
    

    Creates the class data.

    Source

    new

    fn new() -> Ref<Self>
    

    Creates a pen with default values.

    Source

    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.

    Source

    from_uint32

    fn from_uint32(color: u32, thickness: f64) -> Ref<Self>
    

    Creates a solid pen with the color given as an 0xAARRGGBB value.

    Source

    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.

    Source

    brush

    fn brush(self: &Self) -> Option<Rc<dyn IBrush>>
    

    The brush used to draw the stroke.

    Source

    set_brush

    fn set_brush(self: &Self, value: Option<Rc<dyn IBrush>>)
    

    Source

    thickness

    fn thickness(self: &Self) -> f64
    

    The stroke thickness.

    Source

    set_thickness

    fn set_thickness(self: &Self, value: f64)
    

    Source

    dash_style

    fn dash_style(self: &Self) -> Option<Rc<dyn IDashStyle>>
    

    The style of dashed lines drawn with the pen.

    Source

    set_dash_style

    fn set_dash_style(self: &Self, value: Option<Rc<dyn IDashStyle>>)
    

    Source

    line_cap

    fn line_cap(self: &Self) -> PenLineCap
    

    The type of shape to use on both ends of a line.

    Source

    set_line_cap

    fn set_line_cap(self: &Self, value: PenLineCap)
    

    Source

    line_join

    fn line_join(self: &Self) -> PenLineJoin
    

    A value describing how to join consecutive line or curve segments.

    Source

    set_line_join

    fn set_line_join(self: &Self, value: PenLineJoin)
    

    Source

    miter_limit

    fn miter_limit(self: &Self) -> f64
    

    The limit of the ratio of the miter length to half this pen's thickness.

    Source

    set_miter_limit

    fn set_miter_limit(self: &Self, value: f64)
    

    Source

    to_immutable

    fn to_immutable(self: &Self) -> ImmutablePen
    

    Creates an immutable clone of the pen.

    Source

    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.

    Source

    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.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.