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.Picker
-
-
Constructor Summary
Constructors Constructor Description ShadowLegacyBitmap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendDescription(String s)protected BitmapasShared()protected booleancompress(Bitmap.CompressFormat format, int quality, OutputStream stream)protected Bitmapcopy(Bitmap.Config config, boolean isMutable)protected voidcopyPixelsFromBuffer(Buffer dst)protected voidcopyPixelsToBuffer(Buffer dst)protected BitmapcreateAshmemBitmap()protected static BitmapcreateBitmap(int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)protected static BitmapcreateBitmap(int width, int height, Bitmap.Config config)protected static BitmapcreateBitmap(int width, int height, Bitmap.Config config, boolean hasAlpha, ColorSpace colorSpace)protected static BitmapcreateBitmap(Bitmap src, int x, int y, int width, int height, Matrix matrix, boolean filter)protected static BitmapcreateBitmap(DisplayMetrics displayMetrics, int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)protected static BitmapcreateBitmap(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config)protected static BitmapcreateBitmap(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config, boolean hasAlpha)protected static BitmapcreateScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter)protected voideraseColor(int color)protected BitmapextractAlpha()protected BitmapextractAlpha(Paint paint, int[] offsetXY)This shadow implementation ignores the given paint and offsetXY and simply callsextractAlpha().protected intgetAllocationByteCount()protected intgetByteCount()protected ColorSpacegetColorSpace()protected Bitmap.ConfiggetConfig()BitmapgetCreatedFromBitmap()Reference to original Bitmap from which this Bitmap was created.byte[]getCreatedFromBytes()Bytes from which this Bitmap was created.int[]getCreatedFromColors()Color array from which this Bitmap was created.booleangetCreatedFromFilter()trueif this Bitmap was created with filtering.intgetCreatedFromHeight()Height fromgetCreatedFromX()withingetCreatedFromBitmap()of this Bitmap's content, or -1.MatrixgetCreatedFromMatrix()Matrix from which this Bitmap's content was transformed, ornull.StringgetCreatedFromPath()Path from which this Bitmap was created.intgetCreatedFromResId()Resource ID from which this Bitmap was created.InputStreamgetCreatedFromStream()InputStreamfrom which this Bitmap was created.intgetCreatedFromWidth()Width fromgetCreatedFromX()withingetCreatedFromBitmap()of this Bitmap's content, or -1.intgetCreatedFromX()Horizontal offset withingetCreatedFromBitmap()of this Bitmap's content, or -1.intgetCreatedFromY()Vertical offset withingetCreatedFromBitmap()of this Bitmap's content, or -1.StringgetDescription()protected intgetGenerationId()protected intgetHeight()protected intgetPixel(int x, int y)protected voidgetPixels(int[] pixels, int offset, int stride, int x, int y, int width, int height)Note that this method will return a RuntimeException unless: -pixelshas the same length as the number of pixels of the bitmap.protected intgetRowBytes()protected intgetWidth()protected booleanhasAlpha()protected booleanhasMipMap()protected booleanisMutable()protected booleanisPremultiplied()protected booleanisRecycled()protected static BitmapnativeCreateFromParcel(Parcel p)protected voidreconfigure(int width, int height, Bitmap.Config config)protected voidrecycle()protected booleansameAs(Bitmap other)protected voidsetColorSpace(ColorSpace colorSpace)protected voidsetConfig(Bitmap.Config config)voidsetDescription(String s)protected voidsetHasAlpha(boolean hasAlpha)protected voidsetHasMipMap(boolean hasMipMap)protected voidsetHeight(int height)voidsetMutable(boolean mutable)protected voidsetPixel(int x, int y, int color)protected voidsetPixels(int[] pixels, int offset, int stride, int x, int y, int width, int height)protected voidsetPremultiplied(boolean isPremultiplied)protected voidsetWidth(int width)protected voidwriteToParcel(Parcel p, int flags)-
Methods inherited from class org.robolectric.shadows.ShadowBitmap
visualize
-
-
-
-
Method Detail
-
createBitmap
@Implementation protected static Bitmap createBitmap(int width, int height, Bitmap.Config config)
-
createBitmap
@Implementation(minSdk=17) protected static Bitmap createBitmap(DisplayMetrics displayMetrics, int width, int height, Bitmap.Config config)
-
createBitmap
@Implementation(minSdk=17) 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(minSdk=17) 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)
-
getCreatedFromBitmap
public Bitmap getCreatedFromBitmap()
Reference to original Bitmap from which this Bitmap was created.nullif this Bitmap was not copied from another instance.- Specified by:
getCreatedFromBitmapin classShadowBitmap- Returns:
- Original Bitmap from which this Bitmap was created.
-
getCreatedFromResId
public int getCreatedFromResId()
Resource ID from which this Bitmap was created.0if this Bitmap was not created from a resource.- Specified by:
getCreatedFromResIdin classShadowBitmap- Returns:
- Resource ID from which this Bitmap was created.
-
getCreatedFromPath
public String getCreatedFromPath()
Path from which this Bitmap was created.nullif this Bitmap was not create from a path.- Specified by:
getCreatedFromPathin classShadowBitmap- Returns:
- Path from which this Bitmap was created.
-
getCreatedFromStream
public InputStream getCreatedFromStream()
InputStreamfrom which this Bitmap was created.nullif this Bitmap was not created from a stream.- Specified by:
getCreatedFromStreamin classShadowBitmap- Returns:
- InputStream from which this Bitmap was created.
-
getCreatedFromBytes
public byte[] getCreatedFromBytes()
Bytes from which this Bitmap was created.nullif this Bitmap was not created from bytes.- Specified by:
getCreatedFromBytesin 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:
getCreatedFromXin classShadowBitmap- Returns:
- Horizontal offset within
getCreatedFromBitmap().
-
getCreatedFromY
public int getCreatedFromY()
Vertical offset withingetCreatedFromBitmap()of this Bitmap's content, or -1.- Specified by:
getCreatedFromYin 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:
getCreatedFromWidthin 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:
getCreatedFromHeightin 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.nullif this Bitmap was not created from a color array.- Specified by:
getCreatedFromColorsin classShadowBitmap- Returns:
- Color array from which this Bitmap was created.
-
getCreatedFromMatrix
public Matrix getCreatedFromMatrix()
Matrix from which this Bitmap's content was transformed, ornull.- Specified by:
getCreatedFromMatrixin classShadowBitmap- Returns:
- Matrix from which this Bitmap's content was transformed, or
null.
-
getCreatedFromFilter
public boolean getCreatedFromFilter()
trueif this Bitmap was created with filtering.- Specified by:
getCreatedFromFilterin classShadowBitmap- Returns:
trueif this Bitmap was created with filtering.
-
asShared
@Implementation(minSdk=31) protected Bitmap asShared()
-
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
@Implementation protected int getPixel(int x, int y)
-
setPixel
@Implementation protected void setPixel(int x, int y, int color)
-
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: -pixelshas the same length as the number of pixels of the bitmap. -x = 0-y = 0-widthandheightheight match the current bitmap's dimensions.
-
getRowBytes
@Implementation protected int getRowBytes()
-
getByteCount
@Implementation protected int getByteCount()
-
recycle
@Implementation protected void recycle()
-
isRecycled
@Implementation protected final boolean isRecycled()
-
copy
@Implementation protected Bitmap copy(Bitmap.Config config, boolean isMutable)
-
getAllocationByteCount
@Implementation(minSdk=19) protected final int getAllocationByteCount()
-
getConfig
@Implementation protected final Bitmap.Config getConfig()
-
setConfig
@Implementation(minSdk=19) protected void setConfig(Bitmap.Config config)
-
isMutable
@Implementation protected final boolean isMutable()
-
setMutable
public void setMutable(boolean mutable)
- Specified by:
setMutablein classShadowBitmap
-
appendDescription
public void appendDescription(String s)
- Specified by:
appendDescriptionin classShadowBitmap
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin classShadowBitmap
-
setDescription
public void setDescription(String s)
- Specified by:
setDescriptionin classShadowBitmap
-
hasAlpha
@Implementation protected final boolean hasAlpha()
-
setHasAlpha
@Implementation protected void setHasAlpha(boolean hasAlpha)
-
extractAlpha
@Implementation protected Bitmap extractAlpha()
-
extractAlpha
@Implementation protected Bitmap extractAlpha(Paint paint, int[] offsetXY)
This shadow implementation ignores the given paint and offsetXY and simply callsextractAlpha().
-
hasMipMap
@Implementation(minSdk=17) protected final boolean hasMipMap()
-
setHasMipMap
@Implementation(minSdk=17) protected final void setHasMipMap(boolean hasMipMap)
-
getWidth
@Implementation protected int getWidth()
-
setWidth
@Implementation(minSdk=19) protected void setWidth(int width)
-
getHeight
@Implementation protected int getHeight()
-
setHeight
@Implementation(minSdk=19) protected void setHeight(int height)
-
getGenerationId
@Implementation protected int getGenerationId()
-
createAshmemBitmap
@Implementation(minSdk=23) protected Bitmap createAshmemBitmap()
-
eraseColor
@Implementation protected void eraseColor(int color)
-
writeToParcel
@Implementation protected void writeToParcel(Parcel p, int flags)
-
copyPixelsFromBuffer
@Implementation protected void copyPixelsFromBuffer(Buffer dst)
-
copyPixelsToBuffer
@Implementation protected void copyPixelsToBuffer(Buffer dst)
-
reconfigure
@Implementation(minSdk=19) protected void reconfigure(int width, int height, Bitmap.Config config)
-
isPremultiplied
@Implementation(minSdk=19) protected boolean isPremultiplied()
-
setPremultiplied
@Implementation(minSdk=19) protected void setPremultiplied(boolean isPremultiplied)
-
getColorSpace
@Implementation(minSdk=26) protected ColorSpace getColorSpace()
-
setColorSpace
@Implementation(minSdk=29) protected void setColorSpace(ColorSpace colorSpace)
-
sameAs
@Implementation protected boolean sameAs(Bitmap other)
-
-