public abstract class

PlatformBitmapFactory

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory
Known Direct Subclasses

Class Overview

Bitmap factory optimized for the platform.

Summary

Public Constructors
PlatformBitmapFactory()
Public Methods
CloseableReference<Bitmap> createBitmap(int[] colors, int width, int height, Bitmap.Config config, Object callerContext)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(Bitmap source, Object callerContext)
Creates a bitmap from the specified source bitmap.
CloseableReference<Bitmap> createBitmap(int width, int height, Object callerContext)
Creates a bitmap of the specified width and height.
CloseableReference<Bitmap> createBitmap(DisplayMetrics display, int[] colors, int width, int height, Bitmap.Config config, Object callerContext)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(int width, int height)
Creates a bitmap of the specified width and height.
CloseableReference<Bitmap> createBitmap(Bitmap source, int x, int y, int width, int height, Matrix matrix, boolean filter, Object callerContext)
Creates a bitmap from subset of the source bitmap, transformed by the optional matrix.
CloseableReference<Bitmap> createBitmap(Bitmap source, int x, int y, int width, int height, Matrix matrix, boolean filter)
Creates a bitmap from subset of the source bitmap, transformed by the optional matrix.
CloseableReference<Bitmap> createBitmap(DisplayMetrics display, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(DisplayMetrics display, int[] colors, int width, int height, Bitmap.Config config)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(Bitmap source, int x, int y, int width, int height, Object callerContext)
Creates a bitmap from the specified subset of the source bitmap.
CloseableReference<Bitmap> createBitmap(Bitmap source, int x, int y, int width, int height)
Creates a bitmap from the specified subset of the source bitmap.
CloseableReference<Bitmap> createBitmap(int width, int height, Bitmap.Config bitmapConfig)
Creates a bitmap of the specified width and height.
CloseableReference<Bitmap> createBitmap(Bitmap source)
Creates a bitmap from the specified source bitmap.
CloseableReference<Bitmap> createBitmap(int width, int height, Bitmap.Config bitmapConfig, Object callerContext)
Creates a bitmap of the specified width and height.
CloseableReference<Bitmap> createBitmap(DisplayMetrics display, int width, int height, Bitmap.Config config, Object callerContext)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(DisplayMetrics display, int width, int height, Bitmap.Config config)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(int[] colors, int width, int height, Bitmap.Config config)
Creates a bitmap with the specified width and height.
CloseableReference<Bitmap> createBitmap(DisplayMetrics display, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config, Object callerContext)
Creates a bitmap with the specified width and height.
abstract CloseableReference<Bitmap> createBitmapInternal(int width, int height, Bitmap.Config bitmapConfig)
Creates a bitmap of the specified width and height.
CloseableReference<Bitmap> createScaledBitmap(Bitmap source, int destinationWidth, int destinationHeight, boolean filter)
Creates a bitmap from the specified source scaled to have the height and width as specified.
CloseableReference<Bitmap> createScaledBitmap(Bitmap source, int destinationWidth, int destinationHeight, boolean filter, Object callerContext)
Creates a bitmap from the specified source scaled to have the height and width as specified.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PlatformBitmapFactory ()

Public Methods

public CloseableReference<Bitmap> createBitmap (int[] colors, int width, int height, Bitmap.Config config, Object callerContext)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
colors The colors to write to the bitmap
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (Bitmap source, Object callerContext)

Creates a bitmap from the specified source bitmap. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are copying
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

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

Creates a bitmap of the specified width and height. The bitmap will be created with the default ARGB_8888 configuration

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

public CloseableReference<Bitmap> createBitmap (DisplayMetrics display, int[] colors, int width, int height, Bitmap.Config config, Object callerContext)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
display Display metrics for the display this bitmap will be drawn on
colors The colors to write to the bitmap
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the width or height are <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

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

Creates a bitmap of the specified width and height. The bitmap will be created with the default ARGB_8888 configuration

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> createBitmap (Bitmap source, int x, int y, int width, int height, Matrix matrix, boolean filter, Object callerContext)

Creates a bitmap from subset of the source bitmap, transformed by the optional matrix. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are subsetting
x The x coordinate of the first pixel in source
y The y coordinate of the first pixel in source
width The number of pixels in each row
height The number of rows
matrix Optional matrix to be applied to the pixels
filter true if the source should be filtered. Only applies if the matrix contains more than just translation.
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (Bitmap source, int x, int y, int width, int height, Matrix matrix, boolean filter)

Creates a bitmap from subset of the source bitmap, transformed by the optional matrix. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are subsetting
x The x coordinate of the first pixel in source
y The y coordinate of the first pixel in source
width The number of pixels in each row
height The number of rows
matrix Optional matrix to be applied to the pixels
filter true if the source should be filtered. Only applies if the matrix contains more than just translation.
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (DisplayMetrics display, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
display Display metrics for the display this bitmap will be drawn on
colors The colors to write to the bitmap
offset The index of the first color to read from colors[]
stride The number of colors in pixels[] to skip between rows.
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the width or height are <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (DisplayMetrics display, int[] colors, int width, int height, Bitmap.Config config)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
display Display metrics for the display this bitmap will be drawn on
colors The colors to write to the bitmap
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the width or height are <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (Bitmap source, int x, int y, int width, int height, Object callerContext)

Creates a bitmap from the specified subset of the source bitmap. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are subsetting
x The x coordinate of the first pixel in source
y The y coordinate of the first pixel in source
width The number of pixels in each row
height The number of rows
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

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

Creates a bitmap from the specified subset of the source bitmap. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are subsetting
x The x coordinate of the first pixel in source
y The y coordinate of the first pixel in source
width The number of pixels in each row
height The number of rows
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

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

Creates a bitmap of the specified width and height.

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

public CloseableReference<Bitmap> createBitmap (Bitmap source)

Creates a bitmap from the specified source bitmap. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are copying
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (int width, int height, Bitmap.Config bitmapConfig, Object callerContext)

Creates a bitmap of the specified width and height.

Parameters
width the width of the bitmap
height the height of the bitmap
bitmapConfig the Bitmap.Config used to create the Bitmap
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (DisplayMetrics display, int width, int height, Bitmap.Config config, Object callerContext)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
display Display metrics for the display this bitmap will be drawn on.
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create.
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the width or height are <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (DisplayMetrics display, int width, int height, Bitmap.Config config)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
display Display metrics for the display this bitmap will be drawn on.
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create.
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the width or height are <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createBitmap (int[] colors, int width, int height, Bitmap.Config config)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

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

public CloseableReference<Bitmap> createBitmap (DisplayMetrics display, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config, Object callerContext)

Creates a bitmap with the specified width and height. Its initial density is determined from the given DisplayMetrics.

Parameters
display Display metrics for the display this bitmap will be drawn on
colors The colors to write to the bitmap
offset The index of the first color to read from colors[]
stride The number of colors in pixels[] to skip between rows.
width The width of the bitmap
height The height of the bitmap
config The bitmap config to create
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the width or height are <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public abstract CloseableReference<Bitmap> createBitmapInternal (int width, int height, Bitmap.Config bitmapConfig)

Creates a bitmap of the specified width and height. This is intended for ImagePipeline's internal use only.

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

public CloseableReference<Bitmap> createScaledBitmap (Bitmap source, int destinationWidth, int destinationHeight, boolean filter)

Creates a bitmap from the specified source scaled to have the height and width as specified. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are subsetting
destinationWidth The number of pixels in each row of the final bitmap
destinationHeight The number of rows in the final bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the destinationWidth is <= 0, or destinationHeight is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated

public CloseableReference<Bitmap> createScaledBitmap (Bitmap source, int destinationWidth, int destinationHeight, boolean filter, Object callerContext)

Creates a bitmap from the specified source scaled to have the height and width as specified. It is initialized with the same density as the original bitmap.

Parameters
source The bitmap we are subsetting
destinationWidth The number of pixels in each row of the final bitmap
destinationHeight The number of rows in the final bitmap
callerContext the Tag to track who create the Bitmap
Returns
  • a reference to the bitmap
Throws
IllegalArgumentException if the destinationWidth is <= 0, or destinationHeight is <= 0
if the pool is full
OutOfMemoryError if the Bitmap cannot be allocated