Configuration reference
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Every GestureBitmapView setting, its XML attribute (if any), its default value and its constraints. Defaults come
from the constants in GestureBitmapView.Companion and the property initializers.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
|
|
|
Bitmap to display; |
|
|
|
Source of the image, decoded by regions. Setting it replaces any bitmap or source and resets the transformation; the previous source is closed, and so is this one when it is replaced. See Large images. |
|
|
|
Whether images set through an |
|
|
|
Whether decoded images are hardware bitmaps. They are only used when the view is hardware accelerated. Changing it reconfigures the current image. |
|
|
|
Bytes for the decoded resolution levels. The default means 4 times the pixels of the view, 4 bytes each; |
|
|
|
Notified when the preview and details are decoded, or decoding fails. |
|
|
|
Draws on top of the image, on a canvas expressed in upright image pixels and clipped to the image. |
|
|
|
How the bitmap is initially fitted into the view. Changing it keeps the current on-screen display. |
|
|
|
Duration of the scale, scroll and rotate-and-translate animations, in milliseconds. Also used to compute the fling distance. |
|
|
|
Whether scroll and fling gestures move the bitmap. |
|
|
|
Whether scrolling can be done with two fingers. |
|
|
|
When |
|
|
|
Whether pinch gestures scale the bitmap. |
|
|
|
Whether a double tap jumps in scale. |
|
|
|
Whether two-finger rotation gestures rotate the bitmap. |
|
|
|
Whether a rotation gesture that ends while still rotating makes the bitmap keep rotating, decelerating until it stops.
Only applies when |
|
|
|
Minimum scale, relative to the initial display. Must be greater than 0, otherwise |
|
|
|
Maximum scale, relative to the initial display. Must be greater than 0, otherwise |
|
|
|
Amount added to the scale on each double tap. Must be at least 1, otherwise |
|
|
|
How far below |
|
|
|
How far above |
|
|
|
Overshoot allowed past the left limit while scrolling, in pixels. Must not be negative, otherwise
|
|
|
|
Overshoot allowed past the top limit, in pixels. Must not be negative. |
|
|
|
Overshoot allowed past the right limit, in pixels. Must not be negative. |
|
|
|
Overshoot allowed past the bottom limit, in pixels. Must not be negative. |
|
|
|
Whether dragging past a scroll limit is progressively slowed down, approaching the margin asymptotically, instead of following the finger 1:1 until a hard stop at the margin. |
|
|
|
Amount of tension when |
|
|
|
Whether the bitmap is drawn with antialiasing. |
|
|
identity |
Scale, rotation and translation applied on top of the base transformation. Setting it enforces no limits. |
Read-only properties
| Property | Type | Description |
|---|---|---|
|
|
Copy of the matrix form of |
|
|
Transformation applied by |
|
|
Copy of the matrix form of |
|
|
Overall transformation from bitmap to view coordinates (base and gesture transformations combined). |
|
|
Copy of the matrix form of |
|
|
Rectangle occupied by the bitmap in view coordinates, or |
Listener properties
topBoundReachedListener, bottomBoundReachedListener, leftBoundReachedListener, rightBoundReachedListener,
minScaleReachedListener, maxScaleReachedListener, scaleAnimationCompletedListener,
scrollAnimationCompletedListener, rotateAndTranslateAnimationCompletedListener and doubleTapListener, all
null by default. See Listeners. imageLoadListener (OnImageLoadListener:
onPreviewLoaded(view), onDetailLoaded(view) and onImageLoadFailed(view, error)) and imageOverlayDrawer
(ImageOverlayDrawer.onDrawOverImage(view, canvas)) are also null by default.
Methods
| Method | Description |
|---|---|
|
Sets the bitmap, recycling the previous one. With |
|
Sets the bitmap from a drawable at its intrinsic size; bitmap drawables are never scaled up by screen density. |
|
Sets the source of the image, decoded by regions. The view owns the source and closes it when replaced. |
|
Sets a raster drawable resource, decoded by regions. Throws |
|
Sets a content URI, decoded by regions. Throws |
|
Sets a file, decoded by regions. Throws |
|
Notifies that the image contents changed. |
|
Maps a view point into upright image pixels. Returns |
|
Cancels animations and resets the gesture transformation, returning to the initial display. |
XML attributes
Declared in lib/src/main/res/values/attrs.xml (styleable GestureBitmapView). Use them with the app: namespace
(xmlns:app="http://schemas.android.com/apk/res-auto"). Each one sets the property of the same name.
| Attribute | Format | Property / values |
|---|---|---|
|
reference |
Drawable passed to |
|
enum |
|
|
integer |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
boolean |
|
|
float |
|
|
float |
|
|
float |
|
|
float |
|
|
float |
|
|
float |
|
|
float |
|
|
float |
|
|
float |
|
|
boolean |
|
|
float |
|
|
boolean |
|
|
boolean |
|
|
integer |
|
bitmap (other than through app:src), imageSource, isAntialiasingEnabled, transformationParameters, the
listeners and imageOverlayDrawer can only be set from code.
Default constants
GestureBitmapView exposes its defaults as public constants in its companion object:
| Constant | Value |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MetricTransformationParameters
data class MetricTransformationParameters(var scale: Double = 1.0, var rotationAngle: Double = 0.0,
var horizontalTranslation: Double = 0.0, var verticalTranslation: Double = 0.0) : Serializable
rotationAngle is expressed in radians.
| Member | Description |
|---|---|
|
Fills this instance from a |
|
Writes this instance into a matrix, or returns a new one. |
|
Static form writing into |
|
Static form returning a new instance. |
|
Static forms of |
|
|
val params = MetricTransformationParameters.fromMatrix(view.displayTransformationMatrix)
val matrix = MetricTransformationParameters(scale = 2.0).toMatrix()
InvalidMatrixException
class InvalidMatrixException : RuntimeException(). Thrown by MetricTransformationParameters.fromMatrix when the
matrix has perspective terms, unequal scale on both axes, shear, or a zero homogeneous scale.
Image sources
| Type | Description |
|---|---|
|
Interface extending |
|
Source decoding regions with |
|
Factories |
|
Source backed by a caller-owned bitmap held whole in memory, never recycled by the source. Synchronize on the bitmap while drawing on it. |