summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2020-01-15 04:26:44 -0500
committer Leon Scroggins III <scroggo@google.com> 2020-01-15 05:34:45 -0500
commit1be112f2af35ea040d0203c765f7e229ba793a08 (patch)
treec7a48413020bebef8336cce88838810b55249c1e /include
parentf157a263991ab9367d50b82cf7dd854035196cf6 (diff)
Rename setAlphaFlags to setUnpremultipliedRequired
Bug: 135133301 Test: I48e49ee08ab1954eddf62ecae87942aeb128c10d There is never any reason to request OPAQUE. If the image is already opaque, using PREMUL or UNPREMUL has no effect. If the image is not opaque, the requesting OPAQUE is an error. This behavior is not helpful. In addition, this matches the Java API for android.graphics.ImageDecoder. Lastly, the old API was confusing for animated images. It is possible for the first frame to be opaque, while a later frame is not. Requesting OPAQUE seems reasonable for this image, until decoding the non-opaque frame, at which point the inconsistency shows. Having a setting of unpremul or not makes it obvious what will happen for the later frame. Change-Id: I3381582e27894e1072db9b8635f3762b801f5d69
Diffstat (limited to 'include')
-rw-r--r--include/android/imagedecoder.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/include/android/imagedecoder.h b/include/android/imagedecoder.h
index 50daabaaff..4b6446c33d 100644
--- a/include/android/imagedecoder.h
+++ b/include/android/imagedecoder.h
@@ -143,23 +143,20 @@ void AImageDecoder_delete(AImageDecoder* decoder) __INTRODUCED_IN(30);
int AImageDecoder_setAndroidBitmapFormat(AImageDecoder*,
int32_t format) __INTRODUCED_IN(30);
-/*
- * Choose the desired output format.
- *
- * Must be one of:
- * {@link ANDROID_BITMAP_FLAGS_ALPHA_PREMUL}
- * {@link ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE}
- * {@link ANDROID_BITMAP_FLAGS_ALPHA_UNPREMUL}
+/**
+ * Specify whether the output's pixels should be unpremultiplied.
*
- * Note: An OPAQUE image may be set to any of them.
- * A non-OPAQUE image may not be set to OPAQUE
+ * By default, the decoder will premultiply the pixels, if they have alpha. Pass
+ * false to this method to leave them unpremultiplied. This has no effect on an
+ * opaque image.
*
+ * @param required Pass true to leave the pixels unpremultiplied.
* @return - {@link ANDROID_IMAGE_DECODER_SUCCESS} on success
* - {@link ANDROID_IMAGE_DECODER_INVALID_CONVERSION} if the conversion
* is not possible
* - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER} for bad parameters
*/
-int AImageDecoder_setAlphaFlags(AImageDecoder*, int alphaFlags) __INTRODUCED_IN(30);
+int AImageDecoder_setUnpremultipliedRequired(AImageDecoder*, bool required) __INTRODUCED_IN(30);
/**
* Specify the output size for a decoded image.