Bitmap
Summary
Typedefs |
|
|---|---|
AHardwareBuffer
|
typedefstruct AHardwareBuffer
|
AndroidBitmap_CompressWriteFunc)(void *userContext, const void *data, size_t size)
|
typedefbool(*
User-defined function for writing the output of compression. |
Functions |
|
|---|---|
AndroidBitmap_compress(const AndroidBitmapInfo *info, int32_t dataspace, const void *pixels, int32_t format, int32_t quality, void *userContext, AndroidBitmap_CompressWriteFunc fn)
|
int
Compress
pixels as described by info. |
AndroidBitmap_getDataSpace(JNIEnv *env, jobject jbitmap)
|
int32_t
Given a java bitmap object, return its ADataSpace.
|
AndroidBitmap_getHardwareBuffer(JNIEnv *env, jobject bitmap, AHardwareBuffer **outBuffer)
|
int
Retrieve the native object associated with a HARDWARE Bitmap.
|
AndroidBitmap_getInfo(JNIEnv *env, jobject jbitmap, AndroidBitmapInfo *info)
|
int
Given a java bitmap object, fill out the AndroidBitmapInfo struct for it.
|
AndroidBitmap_lockPixels(JNIEnv *env, jobject jbitmap, void **addrPtr)
|
int
Given a java bitmap object, attempt to lock the pixel address.
|
AndroidBitmap_unlockPixels(JNIEnv *env, jobject jbitmap)
|
int
Call this to balance a successful call to AndroidBitmap_lockPixels.
|
Structs |
|
|---|---|
| AndroidBitmapInfo |
Bitmap info, see AndroidBitmap_getInfo(). |
Enumerations
Anonymous Enum 22
Declared inandroid/bitmap.h
Anonymous Enum 22
Anonymous Enum 23
Declared inandroid/bitmap.h
Anonymous Enum 23
Bitmap alpha format.
Anonymous Enum 24
Declared inandroid/bitmap.h
Anonymous Enum 24
| Properties | |
|---|---|
ANDROID_BITMAP_FLAGS_IS_HARDWARE
|
If this bit is set in AndroidBitmapInfo.flags, the Bitmap uses the HARDWARE Config, and its AHardwareBuffer can be retrieved via AndroidBitmap_getHardwareBuffer. |
AndroidBitmapCompressFormat
Declared inandroid/bitmap.h
AndroidBitmapCompressFormat
Specifies the formats that can be compressed to with AndroidBitmap_compress.
AndroidBitmapFormat
Declared inandroid/bitmap.h
AndroidBitmapFormat
Bitmap pixel format.
Typedefs
AHardwareBuffer
Declared inandroid/bitmap.h
struct AHardwareBuffer AHardwareBuffer
AndroidBitmap_CompressWriteFunc
Declared inandroid/bitmap.h
bool(*AndroidBitmap_CompressWriteFunc)(void*userContext,constvoid*data,size_tsize)
User-defined function for writing the output of compression.
Available since API level 30.
| Details | |
|---|---|
| Parameters |
userContext
Pointer to user-defined data passed to AndroidBitmap_compress.
data
Compressed data of
size bytes to write. size
Length in bytes of data to write.
|
| Returns |
Whether the operation succeeded.
|
Functions
AndroidBitmap_compress
Declared inandroid/bitmap.h
intAndroidBitmap_compress( constAndroidBitmapInfo *info, int32_tdataspace, constvoid*pixels, int32_tformat, int32_tquality, void*userContext, AndroidBitmap_CompressWriteFunc fn )
Compress pixels as described by info.
Available since API level 30.
| Details | |
|---|---|
| Parameters |
info
Description of the pixels to compress.
dataspace
ADataSpace describing the color space of the pixels.
pixels
Pointer to pixels to compress.
format
AndroidBitmapCompressFormat to compress to.
quality
Hint to the compressor, 0-100. The value is interpreted differently depending on the AndroidBitmapCompressFormat.
userContext
User-defined data which will be passed to the supplied AndroidBitmap_CompressWriteFunc each time it is called. May be null.
fn
Function that writes the compressed data. Will be called each time the compressor has compressed more data that is ready to be written. May be called more than once for each call to this method. May not be null.
|
| Returns |
AndroidBitmap functions result code.
|
AndroidBitmap_getDataSpace
Declared inandroid/bitmap.h
int32_t AndroidBitmap_getDataSpace( JNIEnv *env, jobject jbitmap )
Given a java bitmap object, return its ADataSpace.
Note that ADataSpace only exposes a few values. This may return ADATASPACE_UNKNOWN, even for Named ColorSpaces, if they have no corresponding ADataSpace.
Available since API level 30.
AndroidBitmap_getHardwareBuffer
Declared inandroid/bitmap.h
int AndroidBitmap_getHardwareBuffer( JNIEnv *env, jobject bitmap, AHardwareBuffer **outBuffer )
Retrieve the native object associated with a HARDWARE Bitmap.
Client must not modify it while a Bitmap is wrapping it.
Available since API level 30.
| Details | |
|---|---|
| Parameters |
env
Handle to the JNI environment pointer.
bitmap
Handle to an android.graphics.Bitmap.
outBuffer
On success, is set to a pointer to the AHardwareBuffer associated with bitmap. This acquires a reference on the buffer, and the client must call AHardwareBuffer_release when finished with it.
|
| Returns |
AndroidBitmap functions result code. ANDROID_BITMAP_RESULT_BAD_PARAMETER if bitmap is not a HARDWARE Bitmap.
|
AndroidBitmap_getInfo
Declared inandroid/bitmap.h
int AndroidBitmap_getInfo( JNIEnv *env, jobject jbitmap, AndroidBitmapInfo *info )
Given a java bitmap object, fill out the AndroidBitmapInfo struct for it.
If the call fails, the info parameter will be ignored.
AndroidBitmap_lockPixels
Declared inandroid/bitmap.h
intAndroidBitmap_lockPixels( JNIEnv*env, jobjectjbitmap, void**addrPtr )
Given a java bitmap object, attempt to lock the pixel address.
Locking will ensure that the memory for the pixels will not move until the unlockPixels call, and ensure that, if the pixels had been previously purged, they will have been restored.
If this call succeeds, it must be balanced by a call to AndroidBitmap_unlockPixels, after which time the address of the pixels should no longer be used.
If this succeeds, *addrPtr will be set to the pixel address. If the call fails, addrPtr will be ignored.
AndroidBitmap_unlockPixels
Declared inandroid/bitmap.h
int AndroidBitmap_unlockPixels( JNIEnv *env, jobject jbitmap )
Call this to balance a successful call to AndroidBitmap_lockPixels.