public interface URLImage.ImageAdapter
Allows applying resize logic to downloaded images you can use constant resize behaviors defined in this class. This class allows masking and various other effects to be applied to downloaded images.
Notice: adapters happen before the image is saved so they will only happen once and the image will be saved as “adapted” which can be great for performance but is also permanent. E.g. If you mask an image it will remain masked.
Methods
public abstract EncodedImage adaptImage(EncodedImage downloadedImage, EncodedImage placeholderImage) | Allows the downloaded image to be adapted e.g if it isn’t the same size of the placeholder image. |
public abstract boolean isAsyncAdapter() | Return true if the adapter should work on a separate thread to avoid blocking the EDT this is especially important for image masks and heavy image manipulation |
Method details
adaptImage
public abstract EncodedImage adaptImage(EncodedImage downloadedImage, EncodedImage placeholderImage)Allows the downloaded image to be adapted e.g if it isn’t the same size of the placeholder image.
Parameters
downloadedImageEncodedImage- the downloaded image
placeholderImageEncodedImage- the placeholder image
Returns
the adapted image or the same image
isAsyncAdapter
public abstract boolean isAsyncAdapter()Return true if the adapter should work on a separate thread to avoid blocking the EDT
this is especially important for image masks and heavy image manipulation
Returns
true to run off the EDT