CroppedBitmap
struct · ferroui-base · v0.5.0
struct CroppedBitmap
Crops a bitmap.
Members
TYPEto_refdisposesource_propertysource_rect_propertyconstructnewwith_sourceinvalidatedsourceset_sourcesource_rectset_source_rectsizedraw
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<CroppedBitmap>
Returns a strong reference to this object.
dispose
fn dispose(self: &Self)
Releases the source bitmap.
source_property
fn source_property() -> &'static StyledProperty<Option<Rc<dyn IImage>>>
Defines the Source property.
source_rect_property
fn source_rect_property() -> &'static StyledProperty<PixelRect>
Defines the SourceRect property.
construct
fn construct() -> Self
Creates the class data.
new
fn new() -> Ref<Self>
with_source
fn with_source(source: Rc<dyn IImage>, source_rect: PixelRect) -> Ref<Self>
Creates a cropped bitmap showing source_rect of source.
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.
source
fn source(self: &Self) -> Option<Rc<dyn IImage>>
The source for the bitmap.
set_source
fn set_source(self: &Self, value: Option<Rc<dyn IImage>>)
source_rect
fn source_rect(self: &Self) -> PixelRect
The rectangular area that the bitmap is cropped to.
set_source_rect
fn set_source_rect(self: &Self, value: PixelRect)
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 cropped part of the source bitmap: source_rect is
relative to the top left corner of the crop rectangle.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeCroppedBitmapImplExtFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<CroppedBitmap>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplCroppedBitmapImplIAffectsRender
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.