DrawingImage
struct · ferroui-base · v0.5.0
struct DrawingImage
An image that uses a Drawing for content.
Members
TYPEto_refdrawing_propertyviewbox_propertyconstructnewwith_drawinginvalidatedraise_invalidateddrawingset_drawingviewboxset_viewboxsizedraw
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<DrawingImage>
Returns a strong reference to this object.
drawing_property
fn drawing_property() -> &'static StyledProperty<Option<Ref<Drawing>>>
Defines the Drawing property.
viewbox_property
fn viewbox_property() -> &'static StyledProperty<Option<Rect>>
Defines the Viewbox property.
construct
fn construct() -> Self
Creates the class data.
new
fn new() -> Ref<Self>
with_drawing
fn with_drawing(drawing: impl Into<Nullable<Drawing>>) -> Ref<Self>
Creates an image showing drawing.
invalidated
fn invalidated(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Raised when the image changes. Dropping the returned guard removes the
handler; Subscription::detach keeps it for the life of the image.
raise_invalidated
fn raise_invalidated(self: &Self)
Raises the invalidated notification.
drawing
fn drawing(self: &Self) -> Option<Ref<Drawing>>
The drawing content.
set_drawing
fn set_drawing(self: &Self, value: impl Into<Nullable<Drawing>>)
viewbox
fn viewbox(self: &Self) -> Option<Rect>
A rectangular region of the drawing, in device independent pixels, to display when rendering this image.
This value can be used to display only part of the drawing, or to
surround it with empty space. If None, the bounds of the drawing
are used.
set_viewbox
fn set_viewbox(self: &Self, value: Option<Rect>)
size
fn size(self: &Self) -> Size
The size of the image, in device independent pixels.
draw
fn draw(self: &Self, context: &mut DrawingContext<'_>, source_rect: Rect, dest_rect: Rect)
Draws the part of the drawing inside source_rect into dest_rect.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<DrawingImage>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplIAffectsRender
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.