### start
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html
Initiates the animation defined by the AnimationBuilder.
```APIDOC
## start
### Description
Starts the animation.
### Method Signature
public void start()
```
--------------------------------
### SubsamplingScaleImageView.AnimationBuilder.start()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Starts an animation defined by the AnimationBuilder.
```APIDOC
## start()
### Description
Starts the scale animation configured by the `AnimationBuilder`.
### Method
`public final void start()`
```
--------------------------------
### init
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.html
Initializes the decoder with application context and image URI. It performs initial setup and returns the image dimensions. Supported URI formats include file, asset, and resource.
```APIDOC
## init(Context context, Uri uri)
### Description
Initialise the decoder. When possible, perform initial setup work once in this method. The dimensions of the image must be returned. The URI can be in one of the following formats:
File: `file:///scard/picture.jpg`
Asset: `file:///android_asset/picture.png`
Resource: `android.resource://com.example.app/drawable/picture`
### Parameters
- **context** (Context) - Application context. A reference may be held, but must be cleared on recycle.
- **uri** (Uri) - URI of the image.
### Returns
Dimensions of the image.
### Throws
- Exception - if initialisation fails.
```
--------------------------------
### initialize
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html
Initializes the decoder, performing any necessary setup work once. It returns the dimensions of the image. The URI can be in various formats including file, asset, or resource.
```APIDOC
## initialize
### Description
Initialise the decoder. When possible, perform initial setup work once in this method. The dimensions of the image must be returned. The URI can be in one of the following formats:
File: `file:///scard/picture.jpg`
Asset: `file:///android_asset/picture.png`
Resource: `android.resource://com.example.app/drawable/picture`
### Parameters
* **context** - Application context. A reference may be held, but must be cleared on recycle.
* **uri** - URI of the image.
### Returns
Dimensions of the image.
### Throws
* **Exception** - if initialisation fails.
```
--------------------------------
### ImageSource.uri()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageSource.html
Creates an ImageSource instance from a URI. If the provided URI does not start with a scheme, it is treated as a file URI.
```APIDOC
## ImageSource.uri(String uri)
### Description
Creates an instance from a URI. If the URI does not start with a scheme, it's assumed to be the URI of a file.
### Parameters
#### Path Parameters
- **uri** (String) - Required - image URI.
### Returns
- **ImageSource** - an ImageSource instance.
```
--------------------------------
### setImage with preview and ImageViewState
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Set the image source from a bitmap, resource, asset, file or other URI, providing a preview image to be displayed until the full size image is loaded, starting with a given orientation setting, scale and center.
```APIDOC
## setImage(ImageSource imageSource, ImageSource previewImageSource, ImageViewState state)
### Description
Set the image source from a bitmap, resource, asset, file or other URI, providing a preview image to be displayed until the full size image is loaded, starting with a given orientation setting, scale and center.
### Method
`setImage`
### Parameters
#### Path Parameters
- **imageSource** (ImageSource) - Description of the parameter
- **previewImageSource** (ImageSource) - Description of the parameter
- **state** (ImageViewState) - Description of the parameter
```
--------------------------------
### getSWidth
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Get source width, ignoring orientation.
```APIDOC
## getSWidth
### Description
Get source width, ignoring orientation.
### Method
`int getSWidth()`
### Returns
- **int** - The source width.
```
--------------------------------
### AnimationBuilder Methods
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html
Methods available on the AnimationBuilder to configure and start animations.
```APIDOC
## start()
### Description
Starts the animation.
### Method
`void start()`
## withDuration(long duration)
### Description
Desired duration of the anim in milliseconds.
### Method
`SubsamplingScaleImageView.AnimationBuilder withDuration(long duration)`
## withEasing(int easing)
### Description
Set the easing style.
### Method
`SubsamplingScaleImageView.AnimationBuilder withEasing(int easing)`
## withInterruptible(boolean interruptible)
### Description
Whether the animation can be interrupted with a touch.
### Method
`SubsamplingScaleImageView.AnimationBuilder withInterruptible(boolean interruptible)`
```
--------------------------------
### Animate Scale and Center - Java
Source: https://github.com/davemorrissey/subsampling-scale-image-view/wiki/08.-Animation
Starts an animation to zoom and pan the image to a specific scale and center point. Use this to create animated transitions for image tours or interactive elements. Customize duration, easing, and interruptibility.
```java
pinView.animateScaleAndCenter(2f, new PointF(1500, 1000))
.withDuration(2000)
.withEasing(SubsamplingScaleImageView.EASE_OUT_QUAD)
.withInterruptible(false)
.start();
```
--------------------------------
### Layout XML Setup for SubsamplingScaleImageView
Source: https://context7.com/davemorrissey/subsampling-scale-image-view/llms.txt
Include the SubsamplingScaleImageView in your layout XML. It can be configured in code or directly via custom attributes like ssiv:assetName.
```xml
```
```xml
```
--------------------------------
### Animate Scale and Center for ImageView
Source: https://context7.com/davemorrissey/subsampling-scale-image-view/llms.txt
Utilize the `AnimationBuilder` API to create smooth animations for scale, center, or both. Configure animation properties like duration, easing, and interruptibility before starting the animation. Listen for animation completion or interruption events.
```java
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
// Animate zoom only (centered on the current center point)
imageView.animateScale(2.5f)
.withDuration(800)
.withEasing(SubsamplingScaleImageView.EASE_IN_OUT_QUAD)
.withInterruptible(true)
.start();
// Animate pan only (preserves current scale)
imageView.animateCenter(new PointF(1500, 1000))
.withDuration(600)
.start();
// Animate scale and center simultaneously
imageView.animateScaleAndCenter(2f, new PointF(1500, 1000))
.withDuration(2000)
.withEasing(SubsamplingScaleImageView.EASE_OUT_QUAD)
.withInterruptible(false) // ignore touch until complete
.withOnAnimationEventListener(new SubsamplingScaleImageView.DefaultOnAnimationEventListener() {
@Override
public void onComplete() {
Log.d("SSIV", "Animation finished");
}
@Override
public void onInterruptedByUser() {
Log.d("SSIV", "User interrupted animation");
}
})
.start();
// Allow any point to be animated to the center (needed for edge points)
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_CENTER);
imageView.animateCenter(new PointF(50, 50)).withDuration(1000).start();
```
--------------------------------
### Save and Restore ImageView State in a Fragment
Source: https://context7.com/davemorrissey/subsampling-scale-image-view/llms.txt
Implement `onCreateView` and `onSaveInstanceState` to persist and restore the `ImageViewState` when the fragment is recreated, for example, during screen rotation. Ensure the `ImageViewState` is retrieved from the saved instance state and passed to the `setImage` method.
```java
// --- In a Fragment ---
private static final String BUNDLE_STATE = "ImageViewState";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.my_fragment, container, false);
ImageViewState imageViewState = null;
if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_STATE)) {
imageViewState = (ImageViewState) savedInstanceState.getSerializable(BUNDLE_STATE);
}
SubsamplingScaleImageView imageView = rootView.findViewById(R.id.imageView);
// Pass the restored state as the second argument
imageView.setImage(ImageSource.asset("map.png"), imageViewState);
return rootView;
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
SubsamplingScaleImageView imageView = getView().findViewById(R.id.imageView);
ImageViewState state = imageView.getState(); // null if image not yet loaded
if (state != null) {
outState.putSerializable(BUNDLE_STATE, state);
}
}
```
--------------------------------
### OnAnimationEventListener
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.OnAnimationEventListener.html
An event listener for animations, allowing events to be triggered when an animation completes, is aborted by another animation starting, or is aborted by a touch event. Note that none of these events are triggered if the activity is paused, the image is swapped, or in other cases where the view's internal state gets wiped or draw events stop.
```APIDOC
## Interface: SubsamplingScaleImageView.OnAnimationEventListener
### Description
An event listener for animations, allowing events to be triggered when an animation completes, is aborted by another animation starting, or is aborted by a touch event. Note that none of these events are triggered if the activity is paused, the image is swapped, or in other cases where the view's internal state gets wiped or draw events stop.
### Methods
* **onComplete**()
* Description: The animation has completed, having reached its endpoint.
* **onInterruptedByUser**()
* Description: The animation has been aborted before reaching its endpoint because the user touched the screen.
* **onInterruptedByNewAnim**()
* Description: The animation has been aborted before reaching its endpoint because a new animation has been started.
```
--------------------------------
### init
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html
Initializes the decoder pool with the provided context and image URI.
```APIDOC
## init(Context context, Uri uri)
### Description
Initialises the decoder pool using the provided Android context and image URI.
### Parameters
#### Path Parameters
- **context** (Context) - The Android context.
- **uri** (Uri) - The URI of the image to be decoded.
```
--------------------------------
### isReady()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/wiki/06.-State
Checks if the view is initialized and ready to display an image.
```APIDOC
## isReady()
### Description
Call to find whether the view is initialised, has dimensions, and will display an image on the next draw. If a preview has been provided, it may be the preview that will be displayed and the full size image may still be loading. If no preview was provided, this is called once the base layer tiles of the full size image are loaded.
### Method
GET
### Endpoint
N/A (Method Call)
### Parameters
None
### Response
#### Success Response (200)
- **boolean** - True if the view is ready, false otherwise.
```
--------------------------------
### getSHeight
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Get source height, ignoring orientation.
```APIDOC
## getSHeight
### Description
Get source height, ignoring orientation.
### Method
`int getSHeight()`
### Returns
- **int** - The source height.
```
--------------------------------
### getSWidth() / getSHeight()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/wiki/06.-State
Gets the dimensions of the source image.
```APIDOC
## getSWidth() / getSHeight()
### Description
Returns the dimensions of the source image, without taking the applied rotation into account.
### Method
GET
### Endpoint
N/A (Method Call)
### Parameters
None
### Response
#### Success Response (200)
- **int** - The width or height of the source image.
```
--------------------------------
### Configuration - Scale, Pan, and Zoom Settings
Source: https://context7.com/davemorrissey/subsampling-scale-image-view/llms.txt
Configuration methods tune how the view handles scale limits, panning boundaries, double-tap behavior, and gesture enablement.
```APIDOC
## Configuration — Scale, Pan, and Zoom Settings
Configuration methods tune how the view handles scale limits, panning boundaries, double-tap behavior, and gesture enablement.
```java
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
imageView.setImage(ImageSource.asset("map.png"));
// --- Scale limits ---
// Density-aware max zoom (lower dpi = more zoom allowed). Default: 160.
imageView.setMinimumDpi(120);
// Density-aware min zoom. Use with SCALE_TYPE_CUSTOM.
imageView.setMaximumDpi(400);
// Raw scale ratios (source px / view px). Less common.
imageView.setMaxScale(4f);
imageView.setMinScale(0.5f);
// --- Minimum scale type ---
// SCALE_TYPE_CENTER_INSIDE: whole image visible (default, best for galleries)
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE);
// SCALE_TYPE_CENTER_CROP: no borders, image fills view
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
// SCALE_TYPE_CUSTOM: use setMinScale / setMaximumDpi to define the minimum
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
// --- Pan limits ---
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE); // default
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_CENTER); // any point can be centered
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_OUTSIDE); // image can go just off-screen
// --- Double tap zoom ---
imageView.setDoubleTapZoomDpi(160); // density-aware zoom target
imageView.setDoubleTapZoomScale(2f); // raw scale ratio
imageView.setDoubleTapZoomDuration(300); // animation duration in ms
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED); // default
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER); // pan to center
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER_IMMEDIATE); // no anim
// --- Gesture toggle ---
imageView.setPanEnabled(true); // default true
imageView.setZoomEnabled(true); // default true
imageView.setQuickScaleEnabled(true); // default true
// --- Visual extras ---
imageView.setTileBackgroundColor(Color.WHITE); // useful for transparent PNGs
imageView.setMinimumTileDpi(220); // trade memory for tile quality
imageView.setDebug(true); // show tile boundaries (development only)
imageView.setEagerLoadingEnabled(true); // load tiles during gestures (default true)
```
```
--------------------------------
### isReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Determines if the view is initialized, has dimensions, and is ready to display an image.
```APIDOC
## isReady
### Description
Call to find whether the view is initialised, has dimensions, and will display an image on the next draw.
### Method
boolean
### Signature
`isReady()`
```
--------------------------------
### getScale()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/wiki/06.-State
Gets the current scale of the image view.
```APIDOC
## getScale()
### Description
Returns the current scale, expressed as a source image to screen image ratio.
### Method
GET
### Endpoint
N/A (Method Call)
### Parameters
None
### Response
#### Success Response (200)
- **float** - The current scale factor.
```
--------------------------------
### getPreferredBitmapConfig
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Get the current preferred configuration for decoding bitmaps.
```APIDOC
## getPreferredBitmapConfig
### Description
Get the current preferred configuration for decoding bitmaps.
### Method
`static Bitmap.Config getPreferredBitmapConfig()`
### Returns
- **Bitmap.Config** - The preferred bitmap configuration.
```
--------------------------------
### Configure Scale, Pan, and Zoom Settings
Source: https://context7.com/davemorrissey/subsampling-scale-image-view/llms.txt
Tune the view's behavior for scale limits, panning boundaries, double-tap zoom, and gesture enablement. Adjust density-aware settings for optimal display across devices.
```java
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
imageView.setImage(ImageSource.asset("map.png"));
// --- Scale limits ---
// Density-aware max zoom (lower dpi = more zoom allowed). Default: 160.
imageView.setMinimumDpi(120);
// Density-aware min zoom. Use with SCALE_TYPE_CUSTOM.
imageView.setMaximumDpi(400);
// Raw scale ratios (source px / view px). Less common.
imageView.setMaxScale(4f);
imageView.setMinScale(0.5f);
```
```java
// --- Minimum scale type ---
// SCALE_TYPE_CENTER_INSIDE: whole image visible (default, best for galleries)
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_INSIDE);
// SCALE_TYPE_CENTER_CROP: no borders, image fills view
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP);
// SCALE_TYPE_CUSTOM: use setMinScale / setMaximumDpi to define the minimum
imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
```
```java
// --- Pan limits ---
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE); // default
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_CENTER); // any point can be centered
imageView.setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_OUTSIDE); // image can go just off-screen
```
```java
// --- Double tap zoom ---
imageView.setDoubleTapZoomDpi(160); // density-aware zoom target
imageView.setDoubleTapZoomScale(2f); // raw scale ratio
imageView.setDoubleTapZoomDuration(300); // animation duration in ms
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED); // default
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER); // pan to center
imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER_IMMEDIATE); // no anim
```
```java
// --- Gesture toggle ---
imageView.setPanEnabled(true); // default true
imageView.setZoomEnabled(true); // default true
imageView.setQuickScaleEnabled(true); // default true
```
```java
// --- Visual extras ---
imageView.setTileBackgroundColor(Color.WHITE); // useful for transparent PNGs
imageView.setMinimumTileDpi(220); // trade memory for tile quality
imageView.setDebug(true); // show tile boundaries (development only)
imageView.setEagerLoadingEnabled(true); // load tiles during gestures (default true)
```
--------------------------------
### onReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Callback method invoked once when the view is initialized and ready to display an image.
```APIDOC
## onReady
### Description
Called once when the view is initialised, has dimensions, and will display an image on the next draw. This is triggered at the same time as SubsamplingScaleImageView.OnImageEventListener.onReady() but allows a subclass to receive this event without using a listener.
### Method
protected void onReady()
```
--------------------------------
### onInterruptedByNewAnim()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.DefaultOnAnimationEventListener.html
The animation has been aborted before reaching its endpoint because a new animation has been started.
```APIDOC
## onInterruptedByNewAnim()
### Description
The animation has been aborted before reaching its endpoint because a new animation has been started.
### Method
```java
public void onInterruptedByNewAnim()
```
### Implements
`SubsamplingScaleImageView.OnAnimationEventListener.onInterruptedByNewAnim`
```
--------------------------------
### CompatDecoderFactory Constructors
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/CompatDecoderFactory.html
Details on how to instantiate CompatDecoderFactory with different configurations.
```APIDOC
## CompatDecoderFactory Constructors
### CompatDecoderFactory(Class extends T> clazz)
**Description**: Constructs a factory for the given class. This class must have a default constructor.
**Parameters**:
- `clazz` (Class extends T>) - Required - A class that implements `ImageDecoder` or `ImageRegionDecoder`.
### CompatDecoderFactory(Class extends T> clazz, Bitmap.Config bitmapConfig)
**Description**: Constructs a factory for the given class. This class must have a constructor that accepts a `Bitmap.Config` instance.
**Parameters**:
- `clazz` (Class extends T>) - Required - A class that implements `ImageDecoder` or `ImageRegionDecoder`.
- `bitmapConfig` (Bitmap.Config) - Required - Bitmap configuration to be used when loading images.
```
--------------------------------
### onInterruptedByNewAnim
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.DefaultOnAnimationEventListener.html
The animation has been aborted before reaching its endpoint because a new animation has been started.
```APIDOC
## void onInterruptedByNewAnim()
### Description
The animation has been aborted before reaching its endpoint because a new animation has been started.
### Method
void
### Endpoint
N/A (Method Call)
### Parameters
None
### Request Example
N/A
### Response
N/A
```
--------------------------------
### ImageSource Instance Methods
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageSource.html
Instance methods to configure the ImageSource.
```APIDOC
## Instance Methods for ImageSource Configuration
### `dimensions(int sWidth, int sHeight)`
**Description:** Declares the dimensions of the image. This is required when using a preview image to specify the dimensions of the full-size image.
**Parameters:**
- `sWidth` (int) - The width of the image.
- `sHeight` (int) - The height of the image.
**Returns:** An `ImageSource` object with the specified dimensions.
```
--------------------------------
### getState
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Get the current state of the view (scale, center, orientation) for restoration after rotate.
```APIDOC
## getState
### Description
Get the current state of the view (scale, center, orientation) for restoration after rotate.
### Method
`ImageViewState getState()`
### Returns
- **ImageViewState** - The current state of the view.
```
--------------------------------
### Constructors
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Constructors for initializing the SubsamplingScaleImageView.
```APIDOC
## Constructor
### `SubsamplingScaleImageView(Context context)`
**Description**: Initializes a new instance of the `SubsamplingScaleImageView` class with the given context.
### `SubsamplingScaleImageView(Context context, AttributeSet attr)`
**Description**: Initializes a new instance of the `SubsamplingScaleImageView` class with the given context and attributes.
```
--------------------------------
### onReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.OnImageEventListener.html
Called when the dimensions of the image and view are known, and either a preview image, the full size image, or base layer tiles are loaded.
```APIDOC
## onReady
### Description
Called when the dimensions of the image and view are known, and either a preview image, the full size image, or base layer tiles are loaded.
### Method
void
### Signature
`onReady()`
```
--------------------------------
### withOnAnimationEventListener
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html
Adds an animation event listener to the AnimationBuilder. This allows you to hook into animation start and end events.
```APIDOC
## withOnAnimationEventListener
### Description
Adds an animation event listener. This listener will be notified when the animation starts and ends.
### Method Signature
public SubsamplingScaleImageView.AnimationBuilder withOnAnimationEventListener(SubsamplingScaleImageView.OnAnimationEventListener listener)
### Parameters
* **listener** (SubsamplingScaleImageView.OnAnimationEventListener) - The listener to add.
### Returns
* this builder for method chaining.
```
--------------------------------
### setImage with ImageViewState
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orientation setting, scale and center.
```APIDOC
## setImage(ImageSource imageSource, ImageViewState state)
### Description
Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orientation setting, scale and center.
### Method
`setImage`
### Parameters
#### Path Parameters
- **imageSource** (ImageSource) - Description of the parameter
- **state** (ImageViewState) - Description of the parameter
```
--------------------------------
### init
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html
Initializes the decoder pool with the provided image URI. This method prepares the decoder by creating an initial decoder on the current thread and populating a pool on a separate thread.
```APIDOC
## init(Context context, Uri uri)
### Description
Initialises the decoder pool. This method creates one decoder on the current thread and uses it to decode the bounds, then spawns an independent thread to populate the pool with an additional three decoders. The thread will abort if recycle() is called.
Specified by:
`init(Context, Uri)` in interface `ImageRegionDecoder`
### Method
`public Point init(Context context, Uri uri) throws Exception`
### Parameters
* **context** (Context) - Application context. A reference may be held, but must be cleared on recycle.
* **uri** (Uri) - URI of the image.
### Returns
Dimensions of the image.
### Throws
* Exception - if initialisation fails.
```
--------------------------------
### SubsamplingScaleImageView.OnAnimationEventListener
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/package-summary.html
An event listener for animations, allows events to be triggered when an animation completes, is aborted by another animation starting, or is aborted by a touch event.
```APIDOC
## Interface: SubsamplingScaleImageView.OnAnimationEventListener
### Description
An event listener for animations, allows events to be triggered when an animation completes, is aborted by another animation starting, or is aborted by a touch event.
### Usage
Implement this interface and set it on the `SubsamplingScaleImageView` to receive callbacks related to animation events.
```
--------------------------------
### CompatDecoderFactory.make()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Creates a new instance of a decoder using the CompatDecoderFactory.
```APIDOC
## make()
### Description
Produces a new instance of a decoder.
### Method
(Not specified, likely a factory method)
### Returns
- **Decoder** - A new decoder instance.
```
--------------------------------
### SubsamplingScaleImageView.isReady()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Checks if the SubsamplingScaleImageView is initialized, has dimensions, and is ready to display an image.
```APIDOC
## isReady()
### Description
Call to find whether the view is initialised, has dimensions, and will display an image on the next draw.
### Method
(Not specified, likely a getter method)
### Returns
- **boolean** - True if the view is ready, false otherwise.
```
--------------------------------
### SubsamplingScaleImageView Methods
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Provides access to various properties and functionalities of the SubsamplingScaleImageView, such as getting the current scale, center, orientation, and maximum/minimum allowed scales.
```APIDOC
## getAppliedOrientation()
### Description
Returns the actual orientation of the image relative to the source file.
### Method
`getAppliedOrientation()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
```APIDOC
## getCenter()
### Description
Returns the source point at the center of the view.
### Method
`getCenter()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
```APIDOC
## getMaxScale()
### Description
Returns the maximum allowed scale.
### Method
`getMaxScale()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
```APIDOC
## getMinScale()
### Description
Returns the minimum allowed scale.
### Method
`getMinScale()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
```APIDOC
## getOrientation()
### Description
Returns the orientation setting.
### Method
`getOrientation()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
```APIDOC
## getPanRemaining(RectF)
### Description
Calculate how much further the image can be panned in each direction.
### Method
`getPanRemaining(RectF)`
### Parameters
#### Path Parameters
- **rectF** (RectF) - Description not available
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
```APIDOC
## getScale()
### Description
Returns the current scale value.
### Method
`getScale()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
--------------------------------
### ImageViewState Constructor
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Constructor for creating an ImageViewState object to store and restore view properties.
```APIDOC
## ImageViewState(float scale, PointF center, int orientation)
### Description
Constructs an `ImageViewState` object with the specified scale, center point, and orientation.
### Constructor
`ImageViewState(float scale, PointF center, int orientation)`
### Class
`com.davemorrissey.labs.subscaleview.ImageViewState`
```
--------------------------------
### onReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Called when the dimensions of the image and view are known, and either a preview image, the full size image, or base layer tiles are loaded. Also called once when the view is initialised, has dimensions, and will display an image on the next draw.
```APIDOC
## onReady()
### Description
Called when the dimensions of the image and view are known, and either a preview image, the full size image, or base layer tiles are loaded. Also called once when the view is initialised, has dimensions, and will display an image on the next draw.
### Method
void
### Interface
com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.OnImageEventListener
### Class
com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
```
--------------------------------
### ImageSource Creation Methods
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageSource.html
Static methods to create an ImageSource instance from different sources.
```APIDOC
## Static Methods for ImageSource Creation
### `asset(String assetName)`
**Description:** Creates an `ImageSource` instance from an asset name.
**Parameters:**
- `assetName` (String) - The name of the asset file.
### `bitmap(Bitmap bitmap)`
**Description:** Provides a loaded `Bitmap` for display.
**Parameters:**
- `bitmap` (Bitmap) - The Bitmap object to display.
### `cachedBitmap(Bitmap bitmap)`
**Description:** Provides a loaded and cached `Bitmap` for display.
**Parameters:**
- `bitmap` (Bitmap) - The Bitmap object to display.
### `resource(int resourceId)`
**Description:** Creates an `ImageSource` instance from a resource ID.
**Parameters:**
- `resourceId` (int) - The resource ID of the image.
### `uri(String uri)`
**Description:** Creates an `ImageSource` instance from a URI string.
**Parameters:**
- `uri` (String) - The URI of the image.
### `uri(Uri uri)`
**Description:** Creates an `ImageSource` instance from a `Uri` object.
**Parameters:**
- `uri` (Uri) - The Uri object representing the image.
### `url(String url)`
**Description:** Creates an `ImageSource` instance from a URL string.
**Parameters:**
- `url` (String) - The URL of the image.
### `url(URL url)`
**Description:** Creates an `ImageSource` instance from a `URL` object.
**Parameters:**
- `url` (URL) - The URL object representing the image.
```
--------------------------------
### onDraw
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html
Draw method. Should not be called until the view has dimensions. The first calls are used as triggers to calculate the scaling and tiling required. Once the view is setup, tiles are displayed as they are loaded. Overrides the default View.onDraw behavior.
```APIDOC
## onDraw
### Description
Draw method should not be called until the view has dimensions so the first calls are used as triggers to calculate the scaling and tiling required. Once the view is setup, tiles are displayed as they are loaded.
### Parameters
- **canvas** (Canvas) - The canvas to draw on.
### Overrides
`[onDraw](https://developer.android.com/reference/android/view/View.html?is-external=true#onDraw-android.graphics.Canvas- "class or interface in android.view")` in class `[View](https://developer.android.com/reference/android/view/View.html?is-external=true "class or interface in android.view")`
```
--------------------------------
### SkiaImageRegionDecoder.init(Context, Uri)
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Initializes the Skia image region decoder. This is a concrete implementation of the ImageRegionDecoder interface.
```APIDOC
## init(Context, Uri)
### Description
Initialises the Skia image region decoder.
### Method
(Not specified, likely a constructor or initialization method)
### Parameters
- **Context** (android.content.Context) - Description not provided.
- **Uri** (android.net.Uri) - Description not provided.
```
--------------------------------
### Check if Image is Ready (v3+)
Source: https://github.com/davemorrissey/subsampling-scale-image-view/wiki/X.--Migration-guides
Replaces `isImageReady()` with `isReady()` for checking image loading status.
```java
view.isReady();
```
--------------------------------
### ImageViewState Constructor
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageViewState.html
Constructs an ImageViewState object with the specified scale, center point, and orientation.
```APIDOC
## ImageViewState(float scale, PointF center, int orientation)
### Description
Constructs an ImageViewState object with the specified scale, center point, and orientation.
### Parameters
* **scale** (float) - The scale of the image.
* **center** (PointF) - The center point of the image.
* **orientation** (int) - The orientation of the image.
```
--------------------------------
### ImageViewState Constructor
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageViewState.html
Constructs an ImageViewState object with the specified scale, center point, and orientation.
```APIDOC
## ImageViewState Constructor
### Description
Constructs an ImageViewState object with the specified scale, center point, and orientation.
### Parameters
* **scale** (float) - The zoom scale.
* **center** ([PointF](https://developer.android.com/reference/android/graphics/PointF.html?is-external=true "class or interface in android.graphics")) - The center point of the view.
* **orientation** (int) - The orientation of the image.
```
--------------------------------
### SkiaImageDecoder Constructors
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.html
Details on how to instantiate the SkiaImageDecoder class.
```APIDOC
## SkiaImageDecoder Constructors
### Description
Provides information on the constructors available for the SkiaImageDecoder class.
### Constructor Detail
#### SkiaImageDecoder()
##### Description
Default constructor for SkiaImageDecoder.
#### SkiaImageDecoder(boolean supportAnimateExif)
##### Description
Constructor for SkiaImageDecoder with support for animated EXIF.
##### Parameters
* **supportAnimateExif** (boolean) - Whether to support animated EXIF.
```
--------------------------------
### Display Images with setImage()
Source: https://context7.com/davemorrissey/subsampling-scale-image-view/llms.txt
Use setImage() to load and display images. It supports basic image loading, low-resolution previews while the full image loads, and restoring the view's state.
```java
SubsamplingScaleImageView imageView = findViewById(R.id.imageView);
// Basic: load a single image
imageView.setImage(ImageSource.asset("photo.jpg"));
```
```java
// With a low-resolution preview displayed while the full image loads.
// Full image dimensions MUST be declared when using a preview.
imageView.setImage(
ImageSource.asset("huge_map.png").dimensions(7557, 5669),
ImageSource.asset("huge_map_preview.png") // max ~1000px, same aspect ratio
);
```
```java
// With saved state (e.g., after screen rotation) — restores scale, center, orientation
ImageViewState savedState = ...; // retrieved from getState() before rotation
imageView.setImage(ImageSource.asset("map.png"), savedState);
```
```java
// Full overload: preview + saved state
imageView.setImage(
ImageSource.asset("huge_map.png").dimensions(7557, 5669),
ImageSource.asset("huge_map_preview.png"),
savedState
);
```
--------------------------------
### SkiaImageDecoder Constructors
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.html
Provides information on how to instantiate the SkiaImageDecoder class.
```APIDOC
## Constructors
### SkiaImageDecoder()
Default constructor for SkiaImageDecoder.
### SkiaImageDecoder(Bitmap.Config bitmapConfig)
Constructor for SkiaImageDecoder with a specified Bitmap.Config.
```
--------------------------------
### SkiaImageDecoder Constructors
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.html
Provides information on how to instantiate the SkiaImageDecoder class.
```APIDOC
## Constructors
### SkiaImageDecoder()
Default constructor for SkiaImageDecoder.
### SkiaImageDecoder(Bitmap.Config bitmapConfig)
Constructor for SkiaImageDecoder that allows specifying a Bitmap.Config.
```
--------------------------------
### SubsamplingScaleImageView Static Methods
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Provides static methods for configuring the SubsamplingScaleImageView, such as setting the preferred bitmap configuration.
```APIDOC
## getPreferredBitmapConfig()
### Description
Get the current preferred configuration for decoding bitmaps.
### Method
`getPreferredBitmapConfig()`
### Class
`com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView`
```
--------------------------------
### Set Image with Preview - Kotlin
Source: https://github.com/davemorrissey/subsampling-scale-image-view/wiki/03.-Preview-images
Use this to set both the full-size image and its corresponding preview image. Ensure the full-size image's dimensions are declared on its ImageSource.
```kotlin
view.setImage(
ImageSource.asset("map.png").dimensions(7557, 5669),
ImageSource.asset("map_preview.png")
);
```
--------------------------------
### Add Dependency to Gradle
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/README.md
Include the library as an implementation dependency in your app's build.gradle file. Use the '-androidx' version if your project uses AndroidX.
```gradle
dependencies {
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
}
```
```gradle
dependencies {
implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0'
}
```
--------------------------------
### CompatDecoderFactory Constructor
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Constructor for creating a CompatDecoderFactory.
```APIDOC
## CompatDecoderFactory
### Description
Construct a factory for the given decoder class.
### Constructor
`CompatDecoderFactory(Class extends T>)`
### Parameters
- **decoderClass** (Class extends T>) - The decoder class to create a factory for.
```
--------------------------------
### Enable Tiling
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageSource.html
Enables tiling of the image. This does not apply to preview images.
```APIDOC
## ImageSource.tilingEnabled
### Description
Enable tiling of the image. This does not apply to preview images which are always loaded as a single bitmap., and tiling cannot be disabled when displaying a region of the source image.
### Returns
- this instance for chaining.
```
--------------------------------
### SkiaImageRegionDecoder.isReady()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Checks the readiness status of the Skia image region decoder.
```APIDOC
## isReady()
### Description
Checks the readiness status of the Skia image region decoder.
### Method
(Not specified, likely a getter method)
### Returns
- **boolean** - True if the decoder is ready, false otherwise.
```
--------------------------------
### isReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/ImageRegionDecoder.html
Checks the current status of the decoder. It should return false before initialization and after recycling.
```APIDOC
## isReady
### Description
Status check. Should return false before initialisation and after recycle.
### Returns
true if the decoder is ready to be used.
```
--------------------------------
### onReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.OnImageEventListener.html
Called when the dimensions of the image and view are known, and either a preview image, the full size image, or base layer tiles are loaded. This indicates the scale and translate are known and the next draw will display an image. This event can be used to hide a loading graphic, or inform a subclass that it is safe to draw overlays.
```APIDOC
## onReady
### Description
Called when the dimensions of the image and view are known, and either a preview image, the full size image, or base layer tiles are loaded. This indicates the scale and translate are known and the next draw will display an image. This event can be used to hide a loading graphic, or inform a subclass that it is safe to draw overlays.
### Method
void onReady()
```
--------------------------------
### ImageSource.resource()
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/ImageSource.html
Creates an ImageSource instance from a resource ID. The system will select the appropriate resource for the device's screen resolution.
```APIDOC
## ImageSource.resource(int resId)
### Description
Creates an instance from a resource. The correct resource for the device screen resolution will be used.
### Parameters
#### Path Parameters
- **resId** (int) - Required - resource ID.
### Returns
- **ImageSource** - an ImageSource instance.
```
--------------------------------
### ImageRegionDecoder.init(Context, Uri)
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Initializes the image region decoder. This method is part of the ImageRegionDecoder interface.
```APIDOC
## init(Context, Uri)
### Description
Initialises the decoder.
### Method
(Not specified, likely a constructor or initialization method)
### Parameters
- **Context** (android.content.Context) - Description not provided.
- **Uri** (android.net.Uri) - Description not provided.
```
--------------------------------
### isReady
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.html
Checks if the decoder pool is ready and has at least one decoder available.
```APIDOC
## isReady()
### Description
Holding a read lock to avoid returning true while the pool is being recycled, this returns true if the pool has at least one decoder available.
### Returns
- **boolean** - True if the decoder pool is ready, false otherwise.
```
--------------------------------
### withEasing
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.AnimationBuilder.html
Sets the easing style for the animation. EASE_IN_OUT_QUAD is recommended and the default.
```APIDOC
## withEasing
### Description
Set the easing style. See static fields. SubsamplingScaleImageView.EASE_IN_OUT_QUAD is recommended, and the default.
### Method
public SubsamplingScaleImageView.AnimationBuilder withEasing(int easing)
### Parameters
#### Path Parameters
- **easing** (int) - easing style.
### Returns
- this builder for method chaining.
```
--------------------------------
### setImage with preview
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Set the image source from a bitmap, resource, asset, file or other URI, providing a preview image to be displayed until the full size image is loaded.
```APIDOC
## setImage(ImageSource imageSource, ImageSource previewImageSource)
### Description
Set the image source from a bitmap, resource, asset, file or other URI, providing a preview image to be displayed until the full size image is loaded.
### Method
`setImage`
### Parameters
#### Path Parameters
- **imageSource** (ImageSource) - Description of the parameter
- **previewImageSource** (ImageSource) - Description of the parameter
```
--------------------------------
### SkiaImageRegionDecoder Constructors
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.html
Provides constructors for initializing SkiaImageRegionDecoder. The default constructor uses a default Bitmap.Config, while the parameterized constructor allows specifying a custom Bitmap.Config.
```APIDOC
## Constructors
### SkiaImageRegionDecoder()
Default constructor.
### SkiaImageRegionDecoder(Bitmap.Config bitmapConfig)
Constructor allowing specification of Bitmap.Config.
```
--------------------------------
### SkiaPooledImageRegionDecoder.init(Context, Uri)
Source: https://github.com/davemorrissey/subsampling-scale-image-view/blob/master/docs/javadoc/index-all.html
Initializes the Skia pooled image region decoder and its pool. This method is responsible for setting up the decoder pool.
```APIDOC
## init(Context, Uri)
### Description
Initialises the decoder pool.
### Method
(Not specified, likely a constructor or initialization method)
### Parameters
- **Context** (android.content.Context) - Description not provided.
- **Uri** (android.net.Uri) - Description not provided.
```