Reference:Android.graphics.BitmapFactory

From Triled Wiki

Jump to: navigation, search


android.graphics
public class android.graphics.BitmapFactory

java.lang.Object
android.graphics.BitmapFactory
Creates Bitmap objects from various sources, including files, streams, and byte-arrays.

Contents

[edit] Nested Classes
BitmapFactory.Options  

[edit] Summary

[edit] Public Constructors

          BitmapFactory ()

[edit] Public Methods

      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, Options opts)
Decode an immutable bitmap from the specified byte array.
      static  Bitmap   decodeFile (String pathName, Options opts)
Decode a file path into a bitmap.
      static  Bitmap   decodeFile (String pathName)
Decode a file path into a bitmap.
      static  Bitmap   decodeResource (Resources res, int id, Options opts)
Decode an image referenced by a resource ID.
      static  Bitmap   decodeResource (Resources res, int id)
Decode an image referenced by a resource ID.
      static  Bitmap   decodeStream (InputStream is)
Decode an input stream into a bitmap.
      static  Bitmap   decodeStream (InputStream is, Rect outPadding, Options opts)
Decode an input stream into a bitmap.

[edit] Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

[edit] Details

[edit] Public Constructors

[edit] public BitmapFactory()

[edit] Public Methods

[edit] public static Bitmap decodeByteArray(byte[] data, int offset, int length)

Decode an immutable bitmap from the specified byte array.

Parameters

data byte array of compressed image data
offset offset into imageData for where the decoder should begin parsing.
length the number of bytes, beginning at offset, to parse

Returns

  • The decoded bitmap, or null if the image could not be decode.

[edit] public static Bitmap decodeByteArray(byte[] data, int offset, int length, Options opts)

Decode an immutable bitmap from the specified byte array.

Parameters

data byte array of compressed image data
offset offset into imageData for where the decoder should begin parsing.
length the number of bytes, beginning at offset, to parse
opts null-ok; Options that control downsampling and whether the image should be completely decoded, or just is size returned.

Returns

  • The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)

[edit] public static Bitmap decodeFile(String pathName, Options opts)

Decode a file path into a bitmap. If the specified file name is null, or cannot be decoded into a bitmap, the function returns null.

Parameters

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.

Returns

  • The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)

[edit] public static Bitmap decodeFile(String pathName)

Decode a file path into a bitmap. If the specified file name is null, or cannot be decoded into a bitmap, the function returns null.

Parameters

pathName complete path name for the file to be decoded.

Returns

  • the resulting decoded bitmap, or null if it could not be decoded.

[edit] public static Bitmap decodeResource(Resources res, int id, Options opts)

Decode an image referenced by a resource ID.

Parameters

res The resources object containing the image data
id The resource id of the image data
opts null-ok; Options that control downsampling and whether the image should be completely decoded, or just is size returned.

Returns

  • The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)

[edit] public static Bitmap decodeResource(Resources res, int id)

Decode an image referenced by a resource ID.

Parameters

res The resources object containing the image data
id The resource id of the image data

Returns

  • The decoded bitmap, or null if the image could not be decode.

[edit] public static Bitmap decodeStream(InputStream is)

Decode an input stream into a bitmap. If the input stream is null, or cannot be used to decode a bitmap, the function returns null.

Parameters

is The input stream that holds the raw data to be decoded into a bitmap.

Returns

  • The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)

[edit] public static Bitmap decodeStream(InputStream is, Rect outPadding, Options opts)

Decode an input stream into a bitmap. If the input stream is null, or cannot be used to decode a bitmap, the function returns null.

Parameters

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.

Returns

  • The decoded bitmap, or null if the image data could not be decoded, or, if opts is non-null, if opts requested only the size be returned (in opts.outWidth and opts.outHeight)

[edit] References

Personal tools