public class

Bitmaps

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.nativecode.Bitmaps

Class Overview

Utility methods for handling Bitmaps.

Native code used by this class is shipped as part of libimagepipeline.so

Summary

Public Constructors
Bitmaps()
Public Methods
static void copyBitmap(Bitmap dest, Bitmap src)
This blits the pixel data from src to dest.
static ByteBuffer getByteBuffer(Bitmap bitmap, long start, long size)
static void pinBitmap(Bitmap bitmap)
Pin the bitmap so that it cannot be 'purged'.
static void reconfigureBitmap(Bitmap bitmap, int width, int height, Bitmap.Config bitmapConfig)
Reconfigures bitmap after checking its allocation size.
static void releaseByteBuffer(Bitmap bitmap)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Bitmaps ()

Public Methods

public static void copyBitmap (Bitmap dest, Bitmap src)

This blits the pixel data from src to dest.

The destination bitmap must have both a height and a width equal to the source. For maximum speed stride should be equal as well.

Both bitmaps must use the same android.graphics.Bitmap.Config format.

If the src is purgeable, it will be decoded as part of this operation if it was purged. The dest should not be purgeable. If it is, the copy will still take place, but will be lost the next time the dest gets purged, without warning.

The dest must be mutable.

Parameters
dest Bitmap to copy into
src Bitmap to copy out of

public static ByteBuffer getByteBuffer (Bitmap bitmap, long start, long size)

public static void pinBitmap (Bitmap bitmap)

Pin the bitmap so that it cannot be 'purged'. Only makes sense for purgeable bitmaps WARNING: Use with caution. Make sure that the pinned bitmap is recycled eventually. Otherwise, this will simply eat up ashmem memory and eventually lead to unfortunate crashes. We *may* eventually provide an unpin method - but we don't yet have a compelling use case for that.

Parameters
bitmap the purgeable bitmap to pin

public static void reconfigureBitmap (Bitmap bitmap, int width, int height, Bitmap.Config bitmapConfig)

Reconfigures bitmap after checking its allocation size.

This method is here to overcome our testing framework limit. Robolectric does not provide KitKat specific APIs: reconfigure(int, int, Bitmap.Config) and getAllocationByteCount() are part of that.

public static void releaseByteBuffer (Bitmap bitmap)