Class ShadowNativeBitmap

java.lang.Object
org.robolectric.shadows.ShadowBitmap
org.robolectric.shadows.ShadowNativeBitmap

@Implements(value=android.graphics.Bitmap.class, looseSignatures=true, minSdk=26, isInAndroidSdk=false, callNativeMethodsByDefault=true) public class ShadowNativeBitmap extends ShadowBitmap
Shadow for Bitmap that is backed by native code
  • 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

      @Implementation(minSdk=24, maxSdk=34) protected static long nativeGetNativeFinalizer()
    • nativeRecycle

      @Implementation(maxSdk=34) protected static Object nativeRecycle(Object nativeBitmap)
    • 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

      @Implementation(maxSdk=34) protected static void nativeErase(long nativeBitmap, int color)
    • nativeErase

      @Implementation(minSdk=29, maxSdk=34) protected static void nativeErase(long nativeBitmap, long colorSpacePtr, long color)
    • nativeRowBytes

      @Implementation(maxSdk=34) protected static int nativeRowBytes(long nativeBitmap)
    • nativeConfig

      @Implementation(maxSdk=34) protected static int nativeConfig(long nativeBitmap)
    • nativeGetPixel

      @Implementation(maxSdk=34) protected static int nativeGetPixel(long nativeBitmap, int x, int y)
    • 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

      @Implementation(maxSdk=34) protected static int nativeGenerationId(long nativeBitmap)
    • nativeExtractAlpha

      @Implementation(maxSdk=34) protected static Bitmap nativeExtractAlpha(long nativeBitmap, long nativePaint, int[] offsetXY)
    • nativeHasAlpha

      @Implementation(maxSdk=34) protected static boolean nativeHasAlpha(long nativeBitmap)
    • nativeIsPremultiplied

      @Implementation(maxSdk=34) protected static boolean nativeIsPremultiplied(long nativeBitmap)
    • 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

      @Implementation(maxSdk=34) protected static boolean nativeHasMipMap(long nativeBitmap)
    • 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

      @Implementation(minSdk=25, maxSdk=34) protected static void nativePrepareToDraw(long nativeBitmap)
    • 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

      @Implementation(minSdk=26, maxSdk=34) protected static boolean nativeIsSRGB(long nativePtr)
    • nativeIsSRGBLinear

      @Implementation(minSdk=28, maxSdk=34) protected static boolean nativeIsSRGBLinear(long nativePtr)
    • nativeSetImmutable

      @Implementation(minSdk=29, maxSdk=34) protected static void nativeSetImmutable(long nativePtr)
    • nativeIsImmutable

      @Implementation(minSdk=29, maxSdk=34) protected static boolean nativeIsImmutable(long nativePtr)
    • nativeIsBackedByAshmem

      @Implementation(minSdk=31, maxSdk=34) protected static boolean nativeIsBackedByAshmem(long nativePtr)
    • nativeExtractGainmap

      @Implementation(minSdk=34) protected static Object nativeExtractGainmap(Object nativePtr)
      This is called by Bitmap.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

      @Implementation protected void writeToParcel(Parcel p, int flags)
    • nativeCreateFromParcel

      @Implementation protected static Bitmap nativeCreateFromParcel(Parcel p)
    • nativeCopyColorSpace

      @Implementation(minSdk=26, maxSdk=28) protected static void nativeCopyColorSpace(long srcBitmap, long dstBitmap)
    • getCreatedFromBitmap

      public Bitmap 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 class ShadowBitmap
      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 class ShadowBitmap
      Returns:
      Resource ID from which this Bitmap was created, or 0 if this Bitmap was not created from a resource.
    • getCreatedFromPath

      public String 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 class ShadowBitmap
      Returns:
      Path from which this Bitmap was created.
    • getCreatedFromStream

      public InputStream 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 class ShadowBitmap
      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 class ShadowBitmap
      Returns:
      Bytes from which this Bitmap was created.
    • getCreatedFromX

      public int getCreatedFromX()
      Description copied from class: ShadowBitmap
      Horizontal offset within ShadowBitmap.getCreatedFromBitmap() of this Bitmap's content, or -1.
      Specified by:
      getCreatedFromX in class ShadowBitmap
      Returns:
      Horizontal offset within ShadowBitmap.getCreatedFromBitmap().
    • getCreatedFromY

      public int getCreatedFromY()
      Description copied from class: ShadowBitmap
      Vertical offset within ShadowBitmap.getCreatedFromBitmap() of this Bitmap's content, or -1.
      Specified by:
      getCreatedFromY in class ShadowBitmap
      Returns:
      Vertical offset within ShadowBitmap.getCreatedFromBitmap() of this Bitmap's content, or -1.
    • getCreatedFromWidth

      public int getCreatedFromWidth()
      Description copied from class: ShadowBitmap
      Width from ShadowBitmap.getCreatedFromX() within ShadowBitmap.getCreatedFromBitmap() of this Bitmap's content, or -1.
      Specified by:
      getCreatedFromWidth in class ShadowBitmap
      Returns:
      Width from ShadowBitmap.getCreatedFromX() within ShadowBitmap.getCreatedFromBitmap() of this Bitmap's content, or -1.
    • getCreatedFromHeight

      public int getCreatedFromHeight()
      Description copied from class: ShadowBitmap
      Height from ShadowBitmap.getCreatedFromX() within ShadowBitmap.getCreatedFromBitmap() of this Bitmap's content, or -1.
      Specified by:
      getCreatedFromHeight in class ShadowBitmap
      Returns:
      Height from ShadowBitmap.getCreatedFromX() within ShadowBitmap.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 class ShadowBitmap
      Returns:
      Color array from which this Bitmap was created.
    • getCreatedFromMatrix

      public Matrix getCreatedFromMatrix()
      Description copied from class: ShadowBitmap
      Matrix from which this Bitmap's content was transformed, or null.
      Specified by:
      getCreatedFromMatrix in class ShadowBitmap
      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 class ShadowBitmap
      Returns:
      true if this Bitmap was created with filtering.
    • setMutable

      public void setMutable(boolean mutable)
      Specified by:
      setMutable in class ShadowBitmap
    • appendDescription

      public void appendDescription(String s)
      Specified by:
      appendDescription in class ShadowBitmap
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in class ShadowBitmap
    • setDescription

      public void setDescription(String s)
      Specified by:
      setDescription in class ShadowBitmap
    • reset

      @Resetter public static void reset()