FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Geometry

    struct · ferroui-base · v0.5.0

    struct Geometry
    

    Defines a geometric shape.

    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<Geometry>
    

    Returns a strong reference to this object.

    Source

    clone_geometry

    fn clone_geometry(self: &Self) -> Ref<Geometry>
    

    Clones the geometry.

    Source

    transform_property

    fn transform_property() -> &'static StyledProperty<Option<Ref<Transform>>>
    

    Source

    construct

    fn construct() -> Self
    

    Creates the class data of a geometry whose platform implementation is created on demand.

    Source

    changed_subscriber_count

    fn changed_subscriber_count(self: &Self) -> usize
    

    The number of subscribers to the changes of the geometry (a diagnostics member, used by tests to verify that subscriptions are released).

    Source

    changed

    fn changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
    

    Subscribes to changes of the geometry. Dropping the returned guard removes the handler; Subscription::detach keeps it for the life of the geometry.

    Source

    bounds

    fn bounds(self: &Self) -> Rect
    

    The geometry's bounding rectangle.

    Source

    transform

    fn transform(self: &Self) -> Option<Ref<Transform>>
    

    A transform to apply to the geometry.

    Source

    set_transform

    fn set_transform(self: &Self, value: impl Into<Nullable<Transform>>)
    

    Source

    parse

    fn parse(s: &str) -> Result<Ref<Geometry>, FormatError>
    

    Creates a geometry from a string of path data.

    Source

    from_commands

    fn from_commands(commands: &[crate::media::PathCommand]) -> Ref<Geometry>
    

    Creates a geometry from path data the compiler of the markup parsed (PathCommand::record): the geometry parse makes of the same text (#603).

    Source

    try_get_path_data

    fn try_get_path_data(self: &Self) -> Option<crate::media::GeometryPathData>
    

    Exports the backend's actual fill and stroke curves, including this geometry's transform, without flattening Beziers into line segments. Returns None when the active backend cannot expose its path data.

    Source

    get_render_bounds

    fn get_render_bounds(self: &Self, pen: &dyn IPen) -> Rect
    

    Gets the geometry's bounding rectangle with the specified pen.

    Source

    fill_contains

    fn fill_contains(self: &Self, point: Point) -> bool
    

    Indicates whether the geometry's fill contains the specified point.

    Source

    get_fill_intersection_result

    fn get_fill_intersection_result(self: &Self, geometry: &Geometry) -> Option<IntersectionResult>
    

    Gets the relation between this geometry's fill and another one's.

    Source

    stroke_contains

    fn stroke_contains(self: &Self, pen: &dyn IPen, point: Point) -> bool
    

    Indicates whether the geometry's stroke contains the specified point.

    Source

    get_widened_geometry

    fn get_widened_geometry(self: &Self, pen: &dyn IPen) -> Ref<Geometry>
    

    Gets a geometry that is the shape defined by the stroke on the geometry produced by the specified pen.

    Source

    affects_geometry

    fn affects_geometry(properties: &[&'static FerroProperty])
    

    Marks the given properties as affecting the geometry's platform implementation: after a change to any of them, the implementation is recreated and the changed notification is raised.

    Source

    invalidate_geometry

    fn invalidate_geometry(self: &Self)
    

    Invalidates the platform implementation of the geometry.

    Source

    contour_length

    fn contour_length(self: &Self) -> f64
    

    The geometry's total length as if all its contours are placed in a straight line.

    Source

    combine

    fn combine(geometry1: impl IntoRef<Geometry>, geometry2: &Ref<RectangleGeometry>, combine_mode: GeometryCombineMode, transform: impl Into<Nullable<Transform>>) -> Ref<Geometry>
    

    Combines the two geometries using the specified combine mode and applies the specified transform to the resulting geometry.

    Source

    try_get_point_at_distance

    fn try_get_point_at_distance(self: &Self, distance: f64) -> Option<Point>
    

    Attempts to get the corresponding point at the specified distance.

    Source

    try_get_point_and_tangent_at_distance

    fn try_get_point_and_tangent_at_distance(self: &Self, distance: f64) -> Option<(Point, Point)>
    

    Attempts to get the corresponding point and tangent from the specified distance along the contour of the geometry.

    Source

    try_get_segment

    fn try_get_segment(self: &Self, start_distance: f64, stop_distance: f64, start_on_begin_figure: bool) -> Option<Ref<Geometry>>
    

    Attempts to get the corresponding path segment given by the two distances specified. Imagine it like snipping a part of the current geometry.

    Source

    Trait implementations

    Availability

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