Package 

Class ImageSource


  • 
    public final class ImageSource
    
                        

    Helper class used to set the source and additional attributes from a variety of sources. Supports use of a bitmap, asset, resource, external file or any other URI. When you are using a preview image, you must set the dimensions of the full size image on the ImageSource object for the full size image using the dimensions method.

    • Method Detail

      • resource

        @NonNull() static ImageSource resource(int resId)

        Create an instance from a resource. The correct resource for the device screen resolution will be used.

        Parameters:
        resId - resource ID.
      • uri

        @NonNull() static ImageSource uri(@NonNull() String uri)

        Create an instance from a URI. If the URI does not start with a scheme, it's assumed to be the URIof a file.

        Parameters:
        uri - image URI.
      • cachedBitmap

        @NonNull() static ImageSource cachedBitmap(@NonNull() Bitmap bitmap)

        Provide a loaded and cached bitmap for display. This bitmap will not be recycled when it is nolonger needed. Use this method if you loaded the bitmap with an image loader such as Picassoor Volley.

        Parameters:
        bitmap - bitmap to be displayed.
      • tilingEnabled

        @NonNull() ImageSource tilingEnabled()

        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.

      • tilingDisabled

        @NonNull() ImageSource tilingDisabled()

        Disable 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.

      • tiling

        @NonNull() ImageSource tiling(boolean tile)

        Enable or disable 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.

        Parameters:
        tile - whether tiling should be enabled.
      • region

        @NonNull() ImageSource region(Rect sRegion)

        Use a region of the source image. Region must be set independently for the full size image and the preview ifyou are using one.

        Parameters:
        sRegion - the region of the source image to be displayed.
      • dimensions

        @NonNull() ImageSource dimensions(int sWidth, int sHeight)

        Declare the dimensions of the image. This is only required for a full size image, when you are specifying a URIand also a preview image. When displaying a bitmap object, or not using a preview, you do not need to declarethe image dimensions. Note if the declared dimensions are found to be incorrect, the view will reset.

        Parameters:
        sWidth - width of the source image.
        sHeight - height of the source image.