Package org.robolectric.shadows
Class ShadowLegacyBitmap
java.lang.Object
org.robolectric.shadows.ShadowBitmap
org.robolectric.shadows.ShadowLegacyBitmap
@Implements(value=android.graphics.Bitmap.class,
isInAndroidSdk=false)
public class ShadowLegacyBitmap
extends ShadowBitmap
-
Nested Class Summary
Nested classes/interfaces inherited from class org.robolectric.shadows.ShadowBitmap
ShadowBitmap.BitmapReflector, ShadowBitmap.Picker
-
Field Summary
Fields inherited from class org.robolectric.shadows.ShadowBitmap
realBitmap
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected Bitmap
asShared()
protected boolean
compress
(Bitmap.CompressFormat format, int quality, OutputStream stream) protected Bitmap
copy
(Bitmap.Config config, boolean isMutable) protected void
protected void
copyPixelsToBuffer
(Buffer dst) protected Bitmap
protected static Bitmap
createBitmap
(int[] colors, int offset, int stride, int width, int height, Bitmap.Config config) protected static Bitmap
createBitmap
(int width, int height, Bitmap.Config config) protected static Bitmap
createBitmap
(int width, int height, Bitmap.Config config, boolean hasAlpha, ColorSpace colorSpace) protected static Bitmap
createBitmap
(Bitmap src, int x, int y, int width, int height, Matrix matrix, boolean filter) protected static Bitmap
createBitmap
(DisplayMetrics displayMetrics, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config) protected static Bitmap
createBitmap
(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config) protected static Bitmap
createBitmap
(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config, boolean hasAlpha) protected static Bitmap
createScaledBitmap
(Bitmap src, int dstWidth, int dstHeight, boolean filter) protected void
eraseColor
(int color) protected Bitmap
protected Bitmap
extractAlpha
(Paint paint, int[] offsetXY) This shadow implementation ignores the given paint and offsetXY and simply callsextractAlpha()
.protected int
protected int
protected ColorSpace
protected Bitmap.Config
Reference to original Bitmap from which this Bitmap was created.byte[]
Bytes from which this Bitmap was created.int[]
Color array from which this Bitmap was created.boolean
true
if this Bitmap was created with filtering.int
Height fromgetCreatedFromX()
withingetCreatedFromBitmap()
of this Bitmap's content, or -1.Matrix from which this Bitmap's content was transformed, ornull
.Path from which this Bitmap was created.int
Resource ID from which this Bitmap was created.InputStream
from which this Bitmap was created.int
Width fromgetCreatedFromX()
withingetCreatedFromBitmap()
of this Bitmap's content, or -1.int
Horizontal offset withingetCreatedFromBitmap()
of this Bitmap's content, or -1.int
Vertical offset withingetCreatedFromBitmap()
of this Bitmap's content, or -1.protected int
protected int
protected int
getPixel
(int x, int y) protected void
getPixels
(int[] pixels, int offset, int stride, int x, int y, int width, int height) Note that this method will return a RuntimeException unless: -pixels
has the same length as the number of pixels of the bitmap.protected int
protected int
getWidth()
protected boolean
hasAlpha()
protected boolean
protected boolean
protected boolean
protected boolean
protected static Bitmap
protected void
reconfigure
(int width, int height, Bitmap.Config config) protected void
recycle()
protected boolean
protected void
setColorSpace
(ColorSpace colorSpace) protected void
setConfig
(Bitmap.Config config) void
protected void
setHasAlpha
(boolean hasAlpha) protected void
setHasMipMap
(boolean hasMipMap) protected void
setHeight
(int height) void
setMutable
(boolean mutable) protected void
setPixel
(int x, int y, int color) protected void
setPixels
(int[] pixels, int offset, int stride, int x, int y, int width, int height) protected void
setPremultiplied
(boolean isPremultiplied) protected void
setWidth
(int width) protected void
writeToParcel
(Parcel p, int flags) Methods inherited from class org.robolectric.shadows.ShadowBitmap
hasGainmap, setGainmap, visualize
-
Constructor Details
-
ShadowLegacyBitmap
public ShadowLegacyBitmap()
-
-
Method Details
-
createBitmap
-
createBitmap
@Implementation protected static Bitmap createBitmap(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config) -
createBitmap
@Implementation protected static Bitmap createBitmap(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config, boolean hasAlpha) -
createBitmap
@Implementation(minSdk=26) protected static Bitmap createBitmap(int width, int height, Bitmap.Config config, boolean hasAlpha, ColorSpace colorSpace) -
createBitmap
@Implementation protected static Bitmap createBitmap(Bitmap src, int x, int y, int width, int height, Matrix matrix, boolean filter) -
createBitmap
@Implementation protected static Bitmap createBitmap(int[] colors, int offset, int stride, int width, int height, Bitmap.Config config) -
createBitmap
@Implementation protected static Bitmap createBitmap(DisplayMetrics displayMetrics, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config) -
createScaledBitmap
@Implementation protected static Bitmap createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter) -
nativeCreateFromParcel
-
getCreatedFromBitmap
Reference to original Bitmap from which this Bitmap was created.null
if this Bitmap was not copied from another instance.- Specified by:
getCreatedFromBitmap
in classShadowBitmap
- Returns:
- Original Bitmap from which this Bitmap was created.
-
getCreatedFromResId
public int getCreatedFromResId()Resource ID from which this Bitmap was created.0
if this Bitmap was not created from a resource.- Specified by:
getCreatedFromResId
in classShadowBitmap
- Returns:
- Resource ID from which this Bitmap was created.
-
getCreatedFromPath
Path from which this Bitmap was created.null
if this Bitmap was not create from a path.- Specified by:
getCreatedFromPath
in classShadowBitmap
- Returns:
- Path from which this Bitmap was created.
-
getCreatedFromStream
InputStream
from which this Bitmap was created.null
if this Bitmap was not created from a stream.- Specified by:
getCreatedFromStream
in classShadowBitmap
- Returns:
- InputStream from which this Bitmap was created.
-
getCreatedFromBytes
public byte[] getCreatedFromBytes()Bytes from which this Bitmap was created.null
if this Bitmap was not created from bytes.- Specified by:
getCreatedFromBytes
in classShadowBitmap
- Returns:
- Bytes from which this Bitmap was created.
-
getCreatedFromX
public int getCreatedFromX()Horizontal offset withingetCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromX
in classShadowBitmap
- Returns:
- Horizontal offset within
getCreatedFromBitmap()
.
-
getCreatedFromY
public int getCreatedFromY()Vertical offset withingetCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromY
in classShadowBitmap
- Returns:
- Vertical offset within
getCreatedFromBitmap()
of this Bitmap's content, or -1.
-
getCreatedFromWidth
public int getCreatedFromWidth()Width fromgetCreatedFromX()
withingetCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromWidth
in classShadowBitmap
- Returns:
- Width from
getCreatedFromX()
withingetCreatedFromBitmap()
of this Bitmap's content, or -1.
-
getCreatedFromHeight
public int getCreatedFromHeight()Height fromgetCreatedFromX()
withingetCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromHeight
in classShadowBitmap
- Returns:
- Height from
getCreatedFromX()
withingetCreatedFromBitmap()
of this Bitmap's content, or -1.
-
getCreatedFromColors
public int[] getCreatedFromColors()Color array from which this Bitmap was created.null
if this Bitmap was not created from a color array.- Specified by:
getCreatedFromColors
in classShadowBitmap
- Returns:
- Color array from which this Bitmap was created.
-
getCreatedFromMatrix
Matrix from which this Bitmap's content was transformed, ornull
.- Specified by:
getCreatedFromMatrix
in classShadowBitmap
- Returns:
- Matrix from which this Bitmap's content was transformed, or
null
.
-
getCreatedFromFilter
public boolean getCreatedFromFilter()true
if this Bitmap was created with filtering.- Specified by:
getCreatedFromFilter
in classShadowBitmap
- Returns:
true
if this Bitmap was created with filtering.
-
compress
@Implementation protected boolean compress(Bitmap.CompressFormat format, int quality, OutputStream stream) -
setPixels
@Implementation protected void setPixels(int[] pixels, int offset, int stride, int x, int y, int width, int height) -
getPixel
-
setPixel
-
getPixels
@Implementation protected void getPixels(int[] pixels, int offset, int stride, int x, int y, int width, int height) Note that this method will return a RuntimeException unless: -pixels
has the same length as the number of pixels of the bitmap. -x = 0
-y = 0
-width
andheight
height match the current bitmap's dimensions. -
getRowBytes
-
getByteCount
-
recycle
-
isRecycled
-
copy
-
getAllocationByteCount
-
getConfig
-
setConfig
-
isMutable
-
setMutable
public void setMutable(boolean mutable) - Specified by:
setMutable
in classShadowBitmap
-
appendDescription
- Specified by:
appendDescription
in classShadowBitmap
-
getDescription
- Specified by:
getDescription
in classShadowBitmap
-
setDescription
- Specified by:
setDescription
in classShadowBitmap
-
hasAlpha
-
setHasAlpha
-
extractAlpha
-
extractAlpha
This shadow implementation ignores the given paint and offsetXY and simply callsextractAlpha()
. -
hasMipMap
-
setHasMipMap
-
getWidth
-
setWidth
-
getHeight
-
setHeight
-
getGenerationId
-
createAshmemBitmap
-
eraseColor
-
writeToParcel
-
copyPixelsFromBuffer
-
copyPixelsToBuffer
-
reconfigure
-
isPremultiplied
-
setPremultiplied
-
getColorSpace
-
setColorSpace
-
sameAs
-