Interface URLImage.ImageAdapter

Enclosing class:
URLImage

public static 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.

  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    boolean
    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

      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
      • downloadedImage: the downloaded image

      • placeholderImage: the placeholder image

      Returns

      the adapted image or the same image

    • isAsyncAdapter

      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