Package org.robolectric.shadows
Class ShadowNativeBitmap
java.lang.Object
org.robolectric.shadows.ShadowBitmap
org.robolectric.shadows.ShadowNativeBitmap
@Implements(value=android.graphics.Bitmap.class,
minSdk=26,
isInAndroidSdk=false,
callNativeMethodsByDefault=true)
public class ShadowNativeBitmap
extends ShadowBitmap
Shadow for
Bitmap
that is backed by native code-
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
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 fromShadowBitmap.getCreatedFromX()
withinShadowBitmap.getCreatedFromBitmap()
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 fromShadowBitmap.getCreatedFromX()
withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.int
Horizontal offset withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.int
Vertical offset withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.protected static boolean
nativeCompress
(long nativeBitmap, int format, int quality, OutputStream stream, byte[] tempStorage) protected static ColorSpace
nativeComputeColorSpace
(long nativePtr) protected static int
nativeConfig
(long nativeBitmap) protected static Bitmap
nativeCopy
(long nativeSrcBitmap, int nativeConfig, boolean isMutable) protected static Bitmap
nativeCopyAshmem
(long nativeSrcBitmap) protected static Bitmap
nativeCopyAshmemConfig
(long nativeSrcBitmap, int nativeConfig) protected static void
nativeCopyColorSpace
(long srcBitmap, long dstBitmap) protected static void
nativeCopyPixelsFromBuffer
(long nativeBitmap, Buffer src) protected static void
nativeCopyPixelsToBuffer
(long nativeBitmap, Buffer dst) protected static Bitmap
nativeCopyPreserveInternalConfig
(long nativeBitmap) protected static Bitmap
nativeCreate
(int[] colors, int offset, int stride, int width, int height, int nativeConfig, boolean mutable, float[] xyzD50, ColorSpace.Rgb.TransferParameters p) protected static Bitmap
nativeCreate
(int[] colors, int offset, int stride, int width, int height, int nativeConfig, boolean mutable, long nativeColorSpace) protected static Bitmap
protected static void
nativeErase
(long nativeBitmap, int color) protected static void
nativeErase
(long nativeBitmap, long colorSpacePtr, long color) protected static Bitmap
nativeExtractAlpha
(long nativeBitmap, long nativePaint, int[] offsetXY) protected static Object
nativeExtractGainmap
(long nativePtr) This is called byBitmap.getGainmap()
to check if a Gainmap exists for the Bitmap.protected static int
nativeGenerationId
(long nativeBitmap) protected static int
nativeGetAllocationByteCount
(long nativeBitmap) protected static long
nativeGetColor
(long nativeBitmap, int x, int y) protected static boolean
nativeGetColorSpace
(long nativePtr, float[] xyz, float[] params) protected static HardwareBuffer
nativeGetHardwareBuffer
(long nativeBitmap) protected static long
protected static int
nativeGetPixel
(long nativeBitmap, int x, int y) protected static void
nativeGetPixels
(long nativeBitmap, int[] pixels, int offset, int stride, int x, int y, int width, int height) protected static boolean
nativeHasAlpha
(long nativeBitmap) protected static boolean
nativeHasMipMap
(long nativeBitmap) protected static boolean
nativeIsBackedByAshmem
(long nativePtr) protected static boolean
nativeIsImmutable
(long nativePtr) protected static boolean
nativeIsPremultiplied
(long nativeBitmap) protected static boolean
nativeIsSRGB
(long nativePtr) protected static boolean
nativeIsSRGBLinear
(long nativePtr) protected static void
nativePrepareToDraw
(long nativeBitmap) protected static void
nativeReconfigure
(long nativeBitmap, int width, int height, int config, boolean isPremultiplied) protected static void
nativeRecycle
(long nativeBitmap) protected static boolean
nativeRecyclePreQ
(long nativeBitmap) protected static int
nativeRowBytes
(long nativeBitmap) protected static boolean
nativeSameAs
(long nativeBitmap0, long nativeBitmap1) protected static void
nativeSetColorSpace
(long nativePtr, long nativeColorSpace) protected static void
nativeSetHasAlpha
(long nativeBitmap, boolean hasAlpha, boolean requestPremul) protected static void
nativeSetHasMipMap
(long nativeBitmap, boolean hasMipMap) protected static void
nativeSetImmutable
(long nativePtr) protected static void
nativeSetPixel
(long nativeBitmap, int x, int y, int color) protected static void
nativeSetPixels
(long nativeBitmap, int[] colors, int offset, int stride, int x, int y, int width, int height) protected static void
nativeSetPremultiplied
(long nativeBitmap, boolean isPremul) protected static Bitmap
nativeWrapHardwareBufferBitmap
(HardwareBuffer buffer, long nativeColorSpace) static void
reset()
void
void
setMutable
(boolean mutable) protected void
writeToParcel
(Parcel p, int flags) Methods inherited from class org.robolectric.shadows.ShadowBitmap
hasGainmap, setGainmap, visualize
-
Constructor Details
-
ShadowNativeBitmap
public ShadowNativeBitmap()
-
-
Method Details
-
nativeCreate
@Implementation(minSdk=29, maxSdk=34) protected static Bitmap nativeCreate(int[] colors, int offset, int stride, int width, int height, int nativeConfig, boolean mutable, long nativeColorSpace) -
nativeCreate
@Implementation(minSdk=26, maxSdk=28) protected static Bitmap nativeCreate(int[] colors, int offset, int stride, int width, int height, int nativeConfig, boolean mutable, float[] xyzD50, ColorSpace.Rgb.TransferParameters p) -
nativeCopy
@Implementation(maxSdk=34) protected static Bitmap nativeCopy(long nativeSrcBitmap, int nativeConfig, boolean isMutable) -
nativeCopyAshmem
@Implementation(minSdk=23, maxSdk=34) protected static Bitmap nativeCopyAshmem(long nativeSrcBitmap) -
nativeCopyAshmemConfig
@Implementation(minSdk=24, maxSdk=34) protected static Bitmap nativeCopyAshmemConfig(long nativeSrcBitmap, int nativeConfig) -
nativeGetNativeFinalizer
-
nativeRecyclePreQ
@Implementation(maxSdk=28, methodName="nativeRecycle") protected static boolean nativeRecyclePreQ(long nativeBitmap) -
nativeRecycle
-
nativeReconfigure
@Implementation(minSdk=26, maxSdk=34) protected static void nativeReconfigure(long nativeBitmap, int width, int height, int config, boolean isPremultiplied) -
nativeCompress
@Implementation(maxSdk=34) protected static boolean nativeCompress(long nativeBitmap, int format, int quality, OutputStream stream, byte[] tempStorage) -
nativeErase
-
nativeErase
@Implementation(minSdk=29, maxSdk=34) protected static void nativeErase(long nativeBitmap, long colorSpacePtr, long color) -
nativeRowBytes
-
nativeConfig
-
nativeGetPixel
-
nativeGetColor
@Implementation(minSdk=29, maxSdk=34) protected static long nativeGetColor(long nativeBitmap, int x, int y) -
nativeGetPixels
@Implementation(maxSdk=34) protected static void nativeGetPixels(long nativeBitmap, int[] pixels, int offset, int stride, int x, int y, int width, int height) -
nativeSetPixel
@Implementation(maxSdk=34) protected static void nativeSetPixel(long nativeBitmap, int x, int y, int color) -
nativeSetPixels
@Implementation(maxSdk=34) protected static void nativeSetPixels(long nativeBitmap, int[] colors, int offset, int stride, int x, int y, int width, int height) -
nativeCopyPixelsToBuffer
@Implementation(maxSdk=34) protected static void nativeCopyPixelsToBuffer(long nativeBitmap, Buffer dst) -
nativeCopyPixelsFromBuffer
@Implementation(maxSdk=34) protected static void nativeCopyPixelsFromBuffer(long nativeBitmap, Buffer src) -
nativeGenerationId
-
nativeExtractAlpha
@Implementation(maxSdk=34) protected static Bitmap nativeExtractAlpha(long nativeBitmap, long nativePaint, int[] offsetXY) -
nativeHasAlpha
-
nativeIsPremultiplied
-
nativeSetPremultiplied
@Implementation(maxSdk=34) protected static void nativeSetPremultiplied(long nativeBitmap, boolean isPremul) -
nativeSetHasAlpha
@Implementation(maxSdk=34) protected static void nativeSetHasAlpha(long nativeBitmap, boolean hasAlpha, boolean requestPremul) -
nativeHasMipMap
-
nativeSetHasMipMap
@Implementation(maxSdk=34) protected static void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap) -
nativeSameAs
@Implementation(maxSdk=34) protected static boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1) -
nativePrepareToDraw
-
nativeGetAllocationByteCount
@Implementation(minSdk=26, maxSdk=34) protected static int nativeGetAllocationByteCount(long nativeBitmap) -
nativeCopyPreserveInternalConfig
@Implementation(minSdk=26, maxSdk=34) protected static Bitmap nativeCopyPreserveInternalConfig(long nativeBitmap) -
nativeWrapHardwareBufferBitmap
@Implementation(minSdk=29, maxSdk=34) protected static Bitmap nativeWrapHardwareBufferBitmap(HardwareBuffer buffer, long nativeColorSpace) -
nativeGetHardwareBuffer
@Implementation(minSdk=30, maxSdk=34) protected static HardwareBuffer nativeGetHardwareBuffer(long nativeBitmap) -
nativeGetColorSpace
@Implementation(minSdk=26, maxSdk=28) protected static boolean nativeGetColorSpace(long nativePtr, float[] xyz, float[] params) -
nativeComputeColorSpace
@Implementation(minSdk=29, maxSdk=34) protected static ColorSpace nativeComputeColorSpace(long nativePtr) -
nativeSetColorSpace
@Implementation(minSdk=29, maxSdk=34) protected static void nativeSetColorSpace(long nativePtr, long nativeColorSpace) -
nativeIsSRGB
-
nativeIsSRGBLinear
-
nativeSetImmutable
-
nativeIsImmutable
-
nativeIsBackedByAshmem
@Implementation(minSdk=31, maxSdk=34) protected static boolean nativeIsBackedByAshmem(long nativePtr) -
nativeExtractGainmap
This is called byBitmap.getGainmap()
to check if a Gainmap exists for the Bitmap. This method must be present in Android U and below to avoid an UnsatisfiedLinkError. -
writeToParcel
-
nativeCreateFromParcel
-
nativeCopyColorSpace
@Implementation(minSdk=26, maxSdk=28) protected static void nativeCopyColorSpace(long srcBitmap, long dstBitmap) -
getCreatedFromBitmap
Description copied from class:ShadowBitmap
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.- Specified by:
getCreatedFromResId
in classShadowBitmap
- Returns:
- Resource ID from which this Bitmap was created, or
0
if this Bitmap was not created from a resource.
-
getCreatedFromPath
Description copied from class:ShadowBitmap
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
Description copied from class:ShadowBitmap
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()Description copied from class:ShadowBitmap
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()Description copied from class:ShadowBitmap
Horizontal offset withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromX
in classShadowBitmap
- Returns:
- Horizontal offset within
ShadowBitmap.getCreatedFromBitmap()
.
-
getCreatedFromY
public int getCreatedFromY()Description copied from class:ShadowBitmap
Vertical offset withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromY
in classShadowBitmap
- Returns:
- Vertical offset within
ShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.
-
getCreatedFromWidth
public int getCreatedFromWidth()Description copied from class:ShadowBitmap
Width fromShadowBitmap.getCreatedFromX()
withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromWidth
in classShadowBitmap
- Returns:
- Width from
ShadowBitmap.getCreatedFromX()
withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.
-
getCreatedFromHeight
public int getCreatedFromHeight()Description copied from class:ShadowBitmap
Height fromShadowBitmap.getCreatedFromX()
withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.- Specified by:
getCreatedFromHeight
in classShadowBitmap
- Returns:
- Height from
ShadowBitmap.getCreatedFromX()
withinShadowBitmap.getCreatedFromBitmap()
of this Bitmap's content, or -1.
-
getCreatedFromColors
public int[] getCreatedFromColors()Description copied from class:ShadowBitmap
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
Description copied from class:ShadowBitmap
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()Description copied from class:ShadowBitmap
true
if this Bitmap was created with filtering.- Specified by:
getCreatedFromFilter
in classShadowBitmap
- Returns:
true
if this Bitmap was created with filtering.
-
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
-
reset
-