Skip to main content

RectangleGeometry

Struct RectangleGeometry 

Source
pub struct RectangleGeometry { /* private fields */ }
Expand description

Represents the geometry of a rectangle.

Implementations§

Source§

impl RectangleGeometry

Source

pub const TYPE: &'static TypeInfo = <RectangleGeometry as crate::StaticType>::TYPE

The runtime type of this class.

Source

pub fn to_ref(&self) -> Ref<RectangleGeometry>

Returns a strong reference to this object.

Source§

impl RectangleGeometry

Source§

impl RectangleGeometry

Source

pub fn construct() -> Self

Creates the class data.

Source

pub fn new() -> Ref<Self>

Source

pub fn with_rect(rect: Rect) -> Ref<Self>

Creates a rectangle geometry with the given bounds.

Source

pub fn with_rect_and_radii( rect: Rect, radius_x: f64, radius_y: f64, ) -> Ref<Self>

Creates a rectangle geometry with the given bounds and corner radii.

Source

pub fn radius_x(&self) -> f64

The x-axis radius of the ellipse that is used to round the corners of the rectangle. Corner radii are represented by an ellipse so this is the horizontal axis width of the ellipse.

Source

pub fn set_radius_x(&self, value: f64)

Source

pub fn radius_y(&self) -> f64

The y-axis radius of the ellipse that is used to round the corners of the rectangle. Corner radii are represented by an ellipse so this is the vertical axis height of the ellipse.

Source

pub fn set_radius_y(&self, value: f64)

Source

pub fn rect(&self) -> Rect

The bounds of the rectangle.

Source

pub fn set_rect(&self, value: Rect)

Methods from Deref<Target = Geometry>§

Source

pub fn to_ref(&self) -> Ref<Geometry>

Returns a strong reference to this object.

Source

pub fn clone_geometry(&self) -> Ref<Geometry>

Clones the geometry.

Source

pub fn create_defining_geometry(&self) -> Option<Arc<dyn IGeometryImpl>>

Creates the platform implementation of the geometry, without the transform applied.

Source

pub fn changed_subscriber_count(&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

pub fn changed(&self, handler: impl Fn() + 'static) -> Rc<dyn IDisposable>

Subscribes to changes of the geometry. Disposing the returned handle unsubscribes.

Source

pub fn bounds(&self) -> Rect

The geometry’s bounding rectangle.

Source

pub fn platform_impl(&self) -> Option<Arc<dyn IGeometryImpl>>

The platform-specific implementation of the geometry.

Source

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

A transform to apply to the geometry.

Source

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

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

pub fn get_widened_geometry(&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

pub fn invalidate_geometry(&self)

Invalidates the platform implementation of the geometry.

Source

pub fn contour_length(&self) -> f64

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

Source

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

Attempts to get the corresponding point at the specified distance.

Source

pub fn try_get_point_and_tangent_at_distance( &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

pub fn try_get_segment( &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.

Methods from Deref<Target = FerroObject>§

Source

pub fn dispatcher(&self) -> &Arc<Dispatcher> ⓘ

Returns the Dispatcher that this object is associated with: the dispatcher of the thread that owns the object.

Source

pub fn check_access(&self) -> bool

Returns whether the calling thread is the thread that owns this object.

Source

pub fn verify_access(&self)

Checks that the calling thread is the thread that owns this object.

§Panics

Panics when it is not.

Source

pub fn to_ref(&self) -> Ref<FerroObject>

A strong reference to this object.

Source

pub fn to_weak(&self) -> WeakRef<FerroObject>

A weak reference to this object.

Source

pub fn get_type(&self) -> &'static TypeInfo

The runtime type of the object.

Source

pub fn is<T: ObjectType>(&self) -> bool

Whether the object is of class T or a class derived from it.

Source

pub fn downcast_ref<T: ObjectType>(&self) -> Option<&T>

Returns the object viewed as class T if it is one.

Source

pub fn on_property_changed(&self, change: &FerroPropertyChangedEventArgs<'_>)

Invokes the on_property_changed virtual member.

Source

pub fn inheritance_parent(&self) -> Option<Ref<FerroObject>>

The parent object that inherited property values are inherited from.

Source

pub fn set_inheritance_parent(&self, value: impl Into<Nullable<FerroObject>>)

Sets the parent object that inherited property values are inherited from.

Source

pub fn clear_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, )

Clears a property’s local value.

Source

pub fn get_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, ) -> T

Gets a property value.

Source

pub fn get_base_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, ) -> Option<T>

Gets a property’s base value: the value excluding animated values. Returns None if the value comes from inheritance or the default.

Source

pub fn is_animating(&self, property: &FerroProperty) -> bool

Checks whether a property is animating.

Source

pub fn is_set(&self, property: &FerroProperty) -> bool

Checks whether a styled property has a value assigned to it or a binding targeting it.

Source

pub fn set_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, value: T, )

Sets a property value with local value priority.

Source

pub fn set_value_with_priority<T: PropertyValue>( &self, property: &'static StyledProperty<T>, value: T, priority: BindingPriority, ) -> Option<Rc<dyn IDisposable>>

Sets a property value with the given priority. For priorities other than local value, disposing the returned handle removes the value.

Source

pub fn set_current_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, value: T, )

Sets the value of a property without changing its value source.

This is used by a component that programmatically sets the value of one of its own properties without disabling an application’s declared use of the property: the effective value changes, but existing bindings and styles continue to work. The new value has the property’s current priority.

Source

pub fn bind_binding( &self, property: &'static FerroProperty, binding: &dyn BindingBase, ) -> Rc<dyn BindingExpressionBase>

Binds a property to a binding. Returns the binding expression which represents the binding instance on this object.

Source

pub fn bind_binding_with_anchor( &self, property: &'static FerroProperty, binding: &dyn BindingBase, anchor: Option<&Ref<FerroObject>>, ) -> Rc<dyn BindingExpressionBase>

Binds a property to a binding.

Some bindings need context to locate their source: a data context, named elements or resources. If this object is not an element, or is not yet attached to the tree, anchor provides that context.

Source

pub fn indexer(&self, binding: &IndexerDescriptor) -> IndexerBinding

Gets a binding to a property of this object: the indexer taking an IndexerDescriptor (source[!Property] is source.indexer(&Property.bind())).

Source

pub fn bind_indexer( &self, binding: &IndexerDescriptor, value: &dyn BindingBase, ) -> Rc<dyn BindingExpressionBase>

Binds the property of an IndexerDescriptor to a binding: the setter of the indexer (target[!Property] = binding is target.bind_indexer(&Property.bind(), &binding)).

Source

pub fn bind<T: PropertyValue>( &self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<T>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable.

Source

pub fn bind_value<T: PropertyValue>( &self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<BindingValue<T>>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable of binding values.

Source

pub fn bind_untyped<T: PropertyValue>( &self, property: &'static StyledProperty<T>, source: Rc<dyn IObservable<BoxedValue>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable of untyped values.

Source

pub fn coerce_value(&self, property: &'static FerroProperty)

Coerces the specified property.

Source

pub fn get_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, ) -> T

Gets a direct property value.

Source

pub fn set_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, value: T, )

Sets a direct property value.

Source

pub fn clear_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, )

Resets a direct property to its unset value.

Source

pub fn bind_direct<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<T>>, ) -> Rc<dyn IDisposable>

Binds a direct property to an observable.

Source

pub fn bind_direct_value<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<BindingValue<T>>>, ) -> Rc<dyn IDisposable>

Binds a direct property to an observable of binding values.

Source

pub fn bind_direct_untyped<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, source: Rc<dyn IObservable<BoxedValue>>, ) -> Rc<dyn IDisposable>

Binds a direct property to an observable of untyped values.

Source

pub fn set_and_raise<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, field: &RefCell<T>, value: T, ) -> bool

Sets the backing field of a direct property, raising a change notification if the value changed. Returns true if it changed.

Source

pub fn set_and_raise_cell<T: PropertyValue + Copy>( &self, property: &'static DirectPropertyBase<T>, field: &Cell<T>, value: T, ) -> bool

set_and_raise for Copy values stored in a Cell.

Source

pub fn get_value_untyped(&self, property: &'static FerroProperty) -> BoxedValue

Gets a property value as an untyped value.

Source

pub fn set_value_untyped( &self, property: &'static FerroProperty, value: &dyn Any, priority: BindingPriority, ) -> Option<Rc<dyn IDisposable>>

Sets a property from an untyped value, which must hold exactly the property’s value type or the unset marker.

Source

pub fn set_current_value_untyped( &self, property: &'static FerroProperty, value: &dyn Any, )

set_current_value with an untyped value.

Source

pub fn clear_value_untyped(&self, property: &'static FerroProperty)

Clears a property’s local value.

Source

pub fn bind_property_untyped( &self, property: &'static FerroProperty, source: Rc<dyn IObservable<BoxedValue>>, priority: BindingPriority, ) -> Rc<dyn IDisposable>

Binds a property to an observable of untyped values.

Source

pub fn property_changed( &self, handler: impl Fn(&FerroPropertyChangedEventArgs<'_>) + 'static, ) -> Rc<dyn IDisposable>

Subscribes to property changes on this object. Disposing the returned handle unsubscribes.

Source

pub fn add_property_changed_handler( &self, handler: Rc<dyn Fn(&FerroPropertyChangedEventArgs<'_>)>, ) -> u64

Subscribes handler to property changes on this object and returns the token that remove_property_changed_handler takes: property_changed for a subscriber that keeps the object and the token itself, so that no handle is made.

Source

pub fn remove_property_changed_handler(&self, token: u64) -> bool

Ends a subscription of add_property_changed_handler.

Source

pub fn property_changed_subscriber_count(&self) -> usize

The number of subscribers to property changes on this object (a diagnostics member, used by tests to verify that subscriptions are released).

Source

pub fn raise_property_changed<T: PropertyValue>( &self, property: &'static FerroProperty, old_value: Option<&T>, new_value: &T, priority: BindingPriority, is_effective_value: bool, )

Raises a property changed notification.

Source

pub fn raise_direct_property_changed<T: PropertyValue>( &self, property: &'static DirectPropertyBase<T>, old_value: &T, new_value: &T, )

Raises a property changed notification for a direct property.

Trait Implementations§

Source§

impl Deref for RectangleGeometry

Source§

type Target = Geometry

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Geometry

Dereferences the value.
Source§

impl FerroObjectImpl for RectangleGeometry

Source§

fn constructed(this: &Self)

Called once, right after the object has been allocated. This is where constructor logic that needs a reference to the object runs. Overrides must call parent_constructed first.
Source§

fn on_property_changed_core( this: &Self, change: &FerroPropertyChangedEventArgs<'_>, )

Called for every property change on the object, including changes of non-effective (base) values. Overriding this is rarely needed; override on_property_changed instead.
Source§

fn on_property_changed(this: &Self, change: &FerroPropertyChangedEventArgs<'_>)

Called when the effective value of a property changes on the object.
Source§

fn update_data_validation( this: &Self, property: &'static FerroProperty, state: BindingValueType, error: Option<&BindingError>, )

Called to update the validation state for properties for which data validation is enabled.
Source§

impl GeometryImpl for RectangleGeometry

Source§

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

Clones the geometry.
Source§

fn create_defining_geometry(this: &Self) -> Option<Arc<dyn IGeometryImpl>>

Creates the platform implementation of the geometry, without the transform applied.
Source§

impl ObjectType for RectangleGeometry

Source§

type Parent = Geometry

The base class. The root class is its own parent.
Source§

type VTable = <Geometry as ObjectType>::VTable

The virtual table of the class.
Source§

fn vtable() -> &'static Self::VTable

The virtual table used by instances whose most-derived class is Self.
Source§

fn register_class()

The static initialisation of the class. The first call on a thread, after doing the same for the base class: Read more
Source§

impl StaticType for RectangleGeometry

Source§

const TYPE: &'static TypeInfo

The runtime type.
Source§

impl<T> Subclassable<T> for RectangleGeometry

Source§

impl Upcast<RectangleGeometry> for RectangleGeometry

Source§

impl<T: ?Sized> Upcast<T> for RectangleGeometry
where Geometry: Upcast<T>,

Source§

fn upcast(&self) -> &T

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> FerroObjectImplExt for T
where T: FerroObjectImpl,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GeometryImplExt for T
where T: GeometryImpl,

Source§

fn parent_clone_geometry(this: &Self) -> Ref<Geometry>

Calls the base class implementation of the member.
Source§

fn parent_create_defining_geometry( this: &Self, ) -> Option<Arc<dyn IGeometryImpl>>

Calls the base class implementation of the member.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.