Geometry
struct · ferroui-base · v0.5.0
struct Geometry
Defines a geometric shape.
Members
TYPEto_refclone_geometrytransform_propertyconstructchanged_subscriber_countchangedboundstransformset_transformparsefrom_commandstry_get_path_dataget_render_boundsfill_containsget_fill_intersection_resultstroke_containsget_widened_geometryaffects_geometryinvalidate_geometrycontour_lengthcombinetry_get_point_at_distancetry_get_point_and_tangent_at_distancetry_get_segment
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<Geometry>
Returns a strong reference to this object.
clone_geometry
fn clone_geometry(self: &Self) -> Ref<Geometry>
Clones the geometry.
transform_property
fn transform_property() -> &'static StyledProperty<Option<Ref<Transform>>>
construct
fn construct() -> Self
Creates the class data of a geometry whose platform implementation is created on demand.
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).
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.
bounds
fn bounds(self: &Self) -> Rect
The geometry's bounding rectangle.
transform
fn transform(self: &Self) -> Option<Ref<Transform>>
A transform to apply to the geometry.
set_transform
fn set_transform(self: &Self, value: impl Into<Nullable<Transform>>)
parse
fn parse(s: &str) -> Result<Ref<Geometry>, FormatError>
Creates a geometry from a string of path data.
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).
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.
get_render_bounds
fn get_render_bounds(self: &Self, pen: &dyn IPen) -> Rect
Gets the geometry's bounding rectangle with the specified pen.
fill_contains
fn fill_contains(self: &Self, point: Point) -> bool
Indicates whether the geometry's fill contains the specified point.
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.
stroke_contains
fn stroke_contains(self: &Self, pen: &dyn IPen, point: Point) -> bool
Indicates whether the geometry's stroke contains the specified point.
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.
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.
invalidate_geometry
fn invalidate_geometry(self: &Self)
Invalidates the platform implementation of the geometry.
contour_length
fn contour_length(self: &Self) -> f64
The geometry's total length as if all its contours are placed in a straight line.
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.
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.
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.
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeGeometryImplExtFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<Geometry>StaticTypeObjectTypeSubclassable<T>FerroObjectImplGeometryImplICompositionRenderResourceIAffectsRender
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.