public class BitmapFactory extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BitmapFactory.Options |
Constructor and Description |
---|
BitmapFactory() |
Modifier and Type | Method and Description |
---|---|
static Bitmap |
decodeByteArray(byte[] data,
int offset,
int length)
Decode an immutable bitmap from the specified byte array.
|
static Bitmap |
decodeByteArray(byte[] data,
int offset,
int length,
BitmapFactory.Options opts)
Decode an immutable bitmap from the specified byte array.
|
static Bitmap |
decodeFile(String pathName)
Decode a file path into a bitmap.
|
static Bitmap |
decodeFile(String pathName,
BitmapFactory.Options opts)
Decode a file path into a bitmap.
|
static Bitmap |
decodeFileDescriptor(FileDescriptor fd)
Decode a bitmap from the file descriptor.
|
static Bitmap |
decodeFileDescriptor(FileDescriptor fd,
Rect outPadding,
BitmapFactory.Options opts)
Decode a bitmap from the file descriptor.
|
static Bitmap |
decodeResource(Resources res,
int id)
Synonym for
decodeResource(Resources, int, android.graphics.BitmapFactory.Options)
will null Options. |
static Bitmap |
decodeResource(Resources res,
int id,
BitmapFactory.Options opts)
Synonym for opening the given resource and calling
decodeResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options) . |
static Bitmap |
decodeResourceStream(Resources res,
TypedValue value,
InputStream is,
Rect pad,
BitmapFactory.Options opts)
Decode a new Bitmap from an InputStream.
|
static Bitmap |
decodeStream(InputStream is)
Decode an input stream into a bitmap.
|
static Bitmap |
decodeStream(InputStream is,
Rect outPadding,
BitmapFactory.Options opts)
Decode an input stream into a bitmap.
|
public static Bitmap decodeFile(String pathName, BitmapFactory.Options opts)
pathName
- complete path name for the file to be decoded.opts
- null-ok; Options that control downsampling and whether the
image should be completely decoded, or just is size returned.public static Bitmap decodeFile(String pathName)
pathName
- complete path name for the file to be decoded.public static Bitmap decodeResourceStream(Resources res, TypedValue value, InputStream is, Rect pad, BitmapFactory.Options opts)
public static Bitmap decodeResource(Resources res, int id, BitmapFactory.Options opts)
decodeResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory.Options)
.res
- The resources object containing the image dataid
- The resource id of the image dataopts
- null-ok; Options that control downsampling and whether the
image should be completely decoded, or just is size returned.public static Bitmap decodeResource(Resources res, int id)
decodeResource(Resources, int, android.graphics.BitmapFactory.Options)
will null Options.res
- The resources object containing the image dataid
- The resource id of the image datapublic static Bitmap decodeByteArray(byte[] data, int offset, int length, BitmapFactory.Options opts)
data
- byte array of compressed image dataoffset
- offset into imageData for where the decoder should begin
parsing.length
- the number of bytes, beginning at offset, to parseopts
- null-ok; Options that control downsampling and whether the
image should be completely decoded, or just is size returned.public static Bitmap decodeByteArray(byte[] data, int offset, int length)
data
- byte array of compressed image dataoffset
- offset into imageData for where the decoder should begin
parsing.length
- the number of bytes, beginning at offset, to parsepublic static Bitmap decodeStream(InputStream is, Rect outPadding, BitmapFactory.Options opts)
is
- The input stream that holds the raw data to be decoded into a
bitmap.outPadding
- If not null, return the padding rect for the bitmap if
it exists, otherwise set padding to [-1,-1,-1,-1]. If
no bitmap is returned (null) then padding is
unchanged.opts
- null-ok; Options that control downsampling and whether the
image should be completely decoded, or just is size returned.public static Bitmap decodeStream(InputStream is)
is
- The input stream that holds the raw data to be decoded into a
bitmap.public static Bitmap decodeFileDescriptor(FileDescriptor fd, Rect outPadding, BitmapFactory.Options opts)
fd
- The file descriptor containing the bitmap data to decodeoutPadding
- If not null, return the padding rect for the bitmap if
it exists, otherwise set padding to [-1,-1,-1,-1]. If
no bitmap is returned (null) then padding is
unchanged.opts
- null-ok; Options that control downsampling and whether the
image should be completely decoded, or just is size returned.public static Bitmap decodeFileDescriptor(FileDescriptor fd)
fd
- The file descriptor containing the bitmap data to decode