public class

PlatformBitmapFactory

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory

Class Overview

Bitmap factory optimized for the platform.

Summary

Public Constructors
PlatformBitmapFactory(GingerbreadBitmapFactory gingerbreadBitmapFactory, DalvikBitmapFactory dalvikBitmapFactory, ArtBitmapFactory artBitmapFactory)
Public Methods
synchronized List<CloseableReference<Bitmap>> associateBitmapsWithBitmapCounter(List<Bitmap> bitmaps)
Associates bitmaps with the bitmap counter.
CloseableReference<Bitmap> createBitmap(int width, int height)
Creates a bitmap of the specified width and height.
CloseableReference<Bitmap> decodeFromPooledByteBuffer(CloseableReference<PooledByteBuffer> pooledByteBufferRef)
Creates a bitmap from encoded bytes.
CloseableReference<Bitmap> decodeJPEGFromPooledByteBuffer(CloseableReference<PooledByteBuffer> pooledByteBufferRef, int length)
Creates a bitmap from encoded JPEG bytes.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PlatformBitmapFactory (GingerbreadBitmapFactory gingerbreadBitmapFactory, DalvikBitmapFactory dalvikBitmapFactory, ArtBitmapFactory artBitmapFactory)

Public Methods

public synchronized List<CloseableReference<Bitmap>> associateBitmapsWithBitmapCounter (List<Bitmap> bitmaps)

Associates bitmaps with the bitmap counter.

If this method throws TooManyBitmapsException, the code will have called recycle() on the bitmaps.

Parameters
bitmaps the bitmaps to associate
Returns
  • the references to the bitmaps that are now tied to the bitmap pool
Throws
if the pool is full

public CloseableReference<Bitmap> createBitmap (int width, int height)

Creates a bitmap of the specified width and height.

Parameters
width the width of the bitmap
height the height of the bitmap
Returns
  • a reference to the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> decodeFromPooledByteBuffer (CloseableReference<PooledByteBuffer> pooledByteBufferRef)

Creates a bitmap from encoded bytes. Supports JPEG but callers should use decodeJPEGFromPooledByteBuffer(CloseableReference, int) for partial JPEGs.

Parameters
pooledByteBufferRef the reference to the encoded bytes
Returns
  • the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> decodeJPEGFromPooledByteBuffer (CloseableReference<PooledByteBuffer> pooledByteBufferRef, int length)

Creates a bitmap from encoded JPEG bytes. Supports a partial JPEG image.

Parameters
pooledByteBufferRef the reference to the encoded bytes
length the number of encoded bytes in the buffer
Returns
  • the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated