ImageDrawable class
A drawable of an image as an object.
- Inheritance
-
- Object
- Drawable
- ObjectDrawable
- ImageDrawable
Constructors
-
ImageDrawable({required Offset position, double rotationAngle = 0, double scale = 1, Set<
ObjectDrawableAssist> assists = const <ObjectDrawableAssist>{}, Map<ObjectDrawableAssist, Paint> assistPaints = const <ObjectDrawableAssist, Paint>{}, bool locked = false, required Image image, String? tag, Rect? sourceRect, bool flipped = false, double opacity = 1, double blurSigma = 0, ImageDrawableShape shape = ImageDrawableShape.rectangle, bool erasable = true}) -
Creates an ImageDrawable with the given
image. -
ImageDrawable.fittedToSize({required Offset position, required Size size, double rotationAngle = 0, Set<
ObjectDrawableAssist> assists = const <ObjectDrawableAssist>{}, Map<ObjectDrawableAssist, Paint> assistPaints = const <ObjectDrawableAssist, Paint>{}, bool locked = false, required Image image, String? tag, Rect? sourceRect, bool flipped = false, double opacity = 1, double blurSigma = 0, ImageDrawableShape shape = ImageDrawableShape.rectangle, bool erasable = true}) -
Creates an ImageDrawable with the given
image, and calculates the scale based on the givensize. The scale will be calculated such that the size of the drawable fits into the provided size.
Properties
-
assistPaints
→ Map<
ObjectDrawableAssist, Paint> -
The paint to be used for each assist type.
finalinherited
-
assists
→ Set<
ObjectDrawableAssist> -
The current assist lines the object has.
finalinherited
- blurSigma → double
-
The standard deviation of the image blur in logical pixels.
final
- erasable → bool
-
Whether free-style erasing can affect this image.
final
- flipped → bool
-
Whether the image is flipped or not.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
Whether the drawable is hidden or not.
finalinherited
- image → Image
-
The image to be drawn.
final
- isCropped → bool
-
Whether this drawable renders less than the full source image.
no setter
- isHidden → bool
-
no setterinherited
- isNotHidden → bool
-
no setterinherited
- locked → bool
-
Defines if the object drawable is locked or not.
If it is locked, it won't be movable, scalable or re-sizable using the UI.
finalinherited
- min_scale → double
-
no setterinherited
- opacity → double
-
The opacity used to draw the image, between 0 (transparent) and 1 (opaque).
final
- position → Offset
-
The location of the object to be painted.
finalinherited
- rotationAngle → double
-
The rotation of the object to be painted in radians.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → double
-
The scale of the object to be painted.
finalinherited
- shape → ImageDrawableShape
-
The shape used to clip this image.
final
- sourceRect → Rect
-
The source pixels from image that are drawn.
final
- tag → String?
-
An optional application-defined tag for identifying this image.
final
Methods
-
copyWith(
{Set< ObjectDrawableAssist> ? assists, Map<ObjectDrawableAssist, Paint> ? assistPaints, Offset? position, double? rotation, double? scale, Image? image, String? tag, Rect? sourceRect, bool? flipped, double? opacity, double? blurSigma, ImageDrawableShape? shape, bool? erasable, bool? locked}) → ImageDrawable -
Creates a copy of this but with the given fields replaced with the new values.
override
-
draw(
Canvas canvas, Size size) → void -
Draws the object on the provided
canvasof sizesize.inherited -
drawAssists(
Canvas canvas, Size size) → void -
Draws any assist lines that the object has on
canvaswithsize.inherited -
drawObject(
Canvas canvas, Size size) → void -
Draws the image on the provided
canvasof sizesize.override -
getSize(
{double minWidth = 0.0, double maxWidth = double.infinity}) → Size -
Calculates the size of the rendered object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fullSourceRect(
Image image) → Rect -
Returns the rectangle containing every pixel in
image.