Package org.robolectric.shadows
Class ShadowBitmapFactory
java.lang.Object
org.robolectric.shadows.ShadowBitmapFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static Bitmap
decodeByteArray
(byte[] data, int offset, int length) protected static Bitmap
decodeByteArray
(byte[] data, int offset, int length, BitmapFactory.Options opts) protected static Bitmap
decodeFile
(String pathName) protected static Bitmap
decodeFile
(String pathName, BitmapFactory.Options options) protected static Bitmap
decodeFileDescriptor
(FileDescriptor fd, Rect outPadding, BitmapFactory.Options opts) protected static Bitmap
decodeResource
(Resources res, int id, BitmapFactory.Options options) protected static Bitmap
decodeResourceStream
(Resources res, TypedValue value, InputStream is, Rect pad, BitmapFactory.Options opts) protected static Bitmap
protected static Bitmap
decodeStream
(InputStream is, Rect outPadding, BitmapFactory.Options opts) static void
provideWidthAndHeightHints
(int resourceId, int width, int height) Deprecated.Use any of the BitmapFactory.decode methods with real image data.static void
provideWidthAndHeightHints
(Uri uri, int width, int height) Deprecated.Use any of the BitmapFactory.decode methods with real image data.static void
provideWidthAndHeightHints
(FileDescriptor fd, int width, int height) Deprecated.Use any of the BitmapFactory.decode methods with real image data.static void
provideWidthAndHeightHints
(String file, int width, int height) Deprecated.Use any of the BitmapFactory.decode methods with real image data.static void
reset()
static void
setAllowInvalidImageData
(boolean allowInvalidImageData) Whether the BitmapFactory.decode methods, such asBitmapFactory.decodeStream(InputStream, Rect, Options)
should allow invalid image data and always return Bitmap objects.
-
Constructor Details
-
ShadowBitmapFactory
public ShadowBitmapFactory()
-
-
Method Details
-
decodeResourceStream
@Implementation protected static Bitmap decodeResourceStream(Resources res, TypedValue value, InputStream is, Rect pad, BitmapFactory.Options opts) -
decodeResource
@Implementation protected static Bitmap decodeResource(Resources res, int id, BitmapFactory.Options options) -
decodeFile
-
decodeFile
-
decodeFileDescriptor
@Implementation protected static Bitmap decodeFileDescriptor(FileDescriptor fd, Rect outPadding, BitmapFactory.Options opts) -
decodeStream
-
decodeStream
@Implementation protected static Bitmap decodeStream(InputStream is, Rect outPadding, BitmapFactory.Options opts) -
decodeByteArray
-
decodeByteArray
@Implementation protected static Bitmap decodeByteArray(byte[] data, int offset, int length, BitmapFactory.Options opts) -
provideWidthAndHeightHints
Deprecated.Use any of the BitmapFactory.decode methods with real image data. -
provideWidthAndHeightHints
Deprecated.Use any of the BitmapFactory.decode methods with real image data. -
provideWidthAndHeightHints
Deprecated.Use any of the BitmapFactory.decode methods with real image data. -
provideWidthAndHeightHints
Deprecated.Use any of the BitmapFactory.decode methods with real image data. -
reset
-
setAllowInvalidImageData
public static void setAllowInvalidImageData(boolean allowInvalidImageData) Whether the BitmapFactory.decode methods, such asBitmapFactory.decodeStream(InputStream, Rect, Options)
should allow invalid image data and always return Bitmap objects. If set to false, BitmapFactory.decode methods will be consistent with real Android, and return null Bitmap values and setBitmapFactory.Options.outWidth
andBitmapFactory.Options.outHeight
to -1.- Parameters:
allowInvalidImageData
- whether invalid bitmap data is allowed and BitmapFactory should always return Bitmap objects.
-