| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2019 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
|  | 15 | */ | 
|  | 16 |  | 
|  | 17 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 18 | * @defgroup ImageDecoder | 
|  | 19 | * | 
|  | 20 | * Functions for converting encoded images into RGBA pixels. | 
|  | 21 | * | 
|  | 22 | * Similar to the Java counterpart android.graphics.ImageDecoder, it can be used | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 23 | * to decode images in the following formats: | 
|  | 24 | * - JPEG | 
|  | 25 | * - PNG | 
|  | 26 | * - GIF | 
|  | 27 | * - WebP | 
|  | 28 | * - BMP | 
|  | 29 | * - ICO | 
|  | 30 | * - WBMP | 
|  | 31 | * - HEIF | 
|  | 32 | * - Digital negatives (via the DNG SDK) | 
|  | 33 | * <p>It has similar options for scaling, cropping, and choosing the output format. | 
|  | 34 | * Unlike the Java API, which can create an android.graphics.Bitmap or | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 35 | * android.graphics.drawable.Drawable object, AImageDecoder decodes directly | 
|  | 36 | * into memory provided by the client. For more information, see the | 
|  | 37 | * <a href="https://developer.android.com/ndk/guides/image-decoder">Image decoder</a> | 
|  | 38 | * developer guide. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 39 | * @{ | 
|  | 40 | */ | 
|  | 41 |  | 
|  | 42 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 43 | * @file imagedecoder.h | 
|  | 44 | * @brief API for decoding images. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 45 | */ | 
|  | 46 |  | 
|  | 47 | #ifndef ANDROID_IMAGE_DECODER_H | 
|  | 48 | #define ANDROID_IMAGE_DECODER_H | 
|  | 49 |  | 
|  | 50 | #include "bitmap.h" | 
| Leon Scroggins III | a9f397b | 2020-01-27 12:42:56 -0500 | [diff] [blame] | 51 | #include <android/rect.h> | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 52 | #include <stdint.h> | 
|  | 53 |  | 
|  | 54 | #ifdef __cplusplus | 
|  | 55 | extern "C" { | 
|  | 56 | #endif | 
|  | 57 |  | 
|  | 58 | struct AAsset; | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 59 |  | 
|  | 60 | #if __ANDROID_API__ >= 30 | 
|  | 61 |  | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 62 | /** | 
|  | 63 | *  {@link AImageDecoder} functions result code. Many functions will return one of these | 
|  | 64 | *  to indicate success ({@link ANDROID_IMAGE_DECODER_SUCCESS}) or the reason | 
|  | 65 | *  for the failure. On failure, any out-parameters should be considered | 
|  | 66 | *  uninitialized, except where specified. | 
|  | 67 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 68 | enum { | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 69 | /** | 
|  | 70 | * Decoding was successful and complete. | 
|  | 71 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 72 | ANDROID_IMAGE_DECODER_SUCCESS = 0, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 73 | /** | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 74 | * The input is incomplete. | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 75 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 76 | ANDROID_IMAGE_DECODER_INCOMPLETE = -1, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 77 | /** | 
|  | 78 | * The input contained an error after decoding some lines. | 
|  | 79 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 80 | ANDROID_IMAGE_DECODER_ERROR = -2, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 81 | /** | 
|  | 82 | * Could not convert. For example, attempting to decode an image with | 
|  | 83 | * alpha to an opaque format. | 
|  | 84 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 85 | ANDROID_IMAGE_DECODER_INVALID_CONVERSION = -3, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 86 | /** | 
|  | 87 | * The scale is invalid. It may have overflowed, or it may be incompatible | 
|  | 88 | * with the current alpha setting. | 
|  | 89 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 90 | ANDROID_IMAGE_DECODER_INVALID_SCALE = -4, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 91 | /** | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 92 | * Some other parameter is invalid. | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 93 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 94 | ANDROID_IMAGE_DECODER_BAD_PARAMETER = -5, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 95 | /** | 
|  | 96 | * Input was invalid before decoding any pixels. | 
|  | 97 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 98 | ANDROID_IMAGE_DECODER_INVALID_INPUT = -6, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 99 | /** | 
|  | 100 | * A seek was required and it failed. | 
|  | 101 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 102 | ANDROID_IMAGE_DECODER_SEEK_ERROR = -7, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 103 | /** | 
|  | 104 | * Some other error. For example, an internal allocation failed. | 
|  | 105 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 106 | ANDROID_IMAGE_DECODER_INTERNAL_ERROR = -8, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 107 | /** | 
|  | 108 | * AImageDecoder did not recognize the format. | 
|  | 109 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 110 | ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT = -9 | 
|  | 111 | }; | 
|  | 112 |  | 
|  | 113 | struct AImageDecoder; | 
|  | 114 |  | 
|  | 115 | /** | 
|  | 116 | * Opaque handle for decoding images. | 
|  | 117 | * | 
|  | 118 | * Create using one of the following: | 
|  | 119 | * - {@link AImageDecoder_createFromAAsset} | 
|  | 120 | * - {@link AImageDecoder_createFromFd} | 
|  | 121 | * - {@link AImageDecoder_createFromBuffer} | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 122 | * | 
|  | 123 | * After creation, {@link AImageDecoder_getHeaderInfo} can be used to retrieve | 
|  | 124 | * information about the encoded image. Other functions, like | 
|  | 125 | * {@link AImageDecoder_setTargetSize}, can be used to specify how to decode, and | 
|  | 126 | * {@link AImageDecoder_decode} will decode into client provided memory. | 
|  | 127 | * | 
|  | 128 | * {@link AImageDecoder} objects are NOT thread-safe, and should not be shared across | 
|  | 129 | * threads. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 130 | */ | 
|  | 131 | typedef struct AImageDecoder AImageDecoder; | 
|  | 132 |  | 
|  | 133 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 134 | * Create a new {@link AImageDecoder} from an {@link AAsset}. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 135 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 136 | * Available since API level 30. | 
|  | 137 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 138 | * @param asset {@link AAsset} containing encoded image data. Client is still | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 139 | *              responsible for calling {@link AAsset_close} on it, which may be | 
|  | 140 | *              done after deleting the returned {@link AImageDecoder}. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 141 | * @param outDecoder On success (i.e. return value is | 
|  | 142 | *                   {@link ANDROID_IMAGE_DECODER_SUCCESS}), this will be set to | 
|  | 143 | *                   a newly created {@link AImageDecoder}. Caller is | 
|  | 144 | *                   responsible for calling {@link AImageDecoder_delete} on it. | 
|  | 145 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 146 | *         indicating the reason for the failure. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 147 | * | 
|  | 148 | * Errors: | 
|  | 149 | * - {@link ANDROID_IMAGE_DECODER_INCOMPLETE}: The asset was truncated before | 
|  | 150 | *   reading the image header. | 
|  | 151 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: One of the parameters is | 
|  | 152 | *   null. | 
|  | 153 | * - {@link ANDROID_IMAGE_DECODER_INVALID_INPUT}: There is an error in the | 
|  | 154 | *   header. | 
|  | 155 | * - {@link ANDROID_IMAGE_DECODER_SEEK_ERROR}: The asset failed to seek. | 
|  | 156 | * - {@link ANDROID_IMAGE_DECODER_INTERNAL_ERROR}: Some other error, like a | 
|  | 157 | *   failure to allocate memory. | 
|  | 158 | * - {@link ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT}: The format is not | 
|  | 159 | *   supported. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 160 | */ | 
| Leon Scroggins III | a9f397b | 2020-01-27 12:42:56 -0500 | [diff] [blame] | 161 | int AImageDecoder_createFromAAsset(struct AAsset* asset, AImageDecoder** outDecoder) | 
|  | 162 | __INTRODUCED_IN(30); | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 163 |  | 
|  | 164 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 165 | * Create a new {@link AImageDecoder} from a file descriptor. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 166 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 167 | * Available since API level 30. | 
|  | 168 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 169 | * @param fd Seekable, readable, open file descriptor for encoded data. | 
|  | 170 | *           Client is still responsible for closing it, which may be done | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 171 | *           after deleting the returned {@link AImageDecoder}. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 172 | * @param outDecoder On success (i.e. return value is | 
|  | 173 | *                   {@link ANDROID_IMAGE_DECODER_SUCCESS}), this will be set to | 
|  | 174 | *                   a newly created {@link AImageDecoder}. Caller is | 
|  | 175 | *                   responsible for calling {@link AImageDecoder_delete} on it. | 
|  | 176 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 177 | *         indicating the reason for the failure. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 178 | * | 
|  | 179 | * Errors: | 
|  | 180 | * - {@link ANDROID_IMAGE_DECODER_INCOMPLETE}: The file was truncated before | 
|  | 181 | *   reading the image header. | 
|  | 182 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The {@link AImageDecoder} is | 
|  | 183 | *   null, or |fd| does not represent a valid, seekable file descriptor. | 
|  | 184 | * - {@link ANDROID_IMAGE_DECODER_INVALID_INPUT}: There is an error in the | 
|  | 185 | *   header. | 
|  | 186 | * - {@link ANDROID_IMAGE_DECODER_SEEK_ERROR}: The descriptor failed to seek. | 
|  | 187 | * - {@link ANDROID_IMAGE_DECODER_INTERNAL_ERROR}: Some other error, like a | 
|  | 188 | *   failure to allocate memory. | 
|  | 189 | * - {@link ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT}: The format is not | 
|  | 190 | *   supported. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 191 | */ | 
|  | 192 | int AImageDecoder_createFromFd(int fd, AImageDecoder** outDecoder) __INTRODUCED_IN(30); | 
|  | 193 |  | 
|  | 194 | /** | 
|  | 195 | * Create a new AImageDecoder from a buffer. | 
|  | 196 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 197 | * Available since API level 30. | 
|  | 198 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 199 | * @param buffer Pointer to encoded data. Must be valid for the entire time | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 200 | *               the {@link AImageDecoder} is used. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 201 | * @param length Byte length of buffer. | 
|  | 202 | * @param outDecoder On success (i.e. return value is | 
|  | 203 | *                   {@link ANDROID_IMAGE_DECODER_SUCCESS}), this will be set to | 
|  | 204 | *                   a newly created {@link AImageDecoder}. Caller is | 
|  | 205 | *                   responsible for calling {@link AImageDecoder_delete} on it. | 
|  | 206 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 207 | *         indicating the reason for the failure. | 
|  | 208 | * | 
|  | 209 | * Errors: | 
|  | 210 | * - {@link ANDROID_IMAGE_DECODER_INCOMPLETE}: The encoded image was truncated before | 
|  | 211 | *   reading the image header. | 
|  | 212 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: One of the parameters is | 
|  | 213 | *   invalid. | 
|  | 214 | * - {@link ANDROID_IMAGE_DECODER_INVALID_INPUT}: There is an error in the | 
|  | 215 | *   header. | 
|  | 216 | * - {@link ANDROID_IMAGE_DECODER_INTERNAL_ERROR}: Some other error, like a | 
|  | 217 | *   failure to allocate memory. | 
|  | 218 | * - {@link ANDROID_IMAGE_DECODER_UNSUPPORTED_FORMAT}: The format is not | 
|  | 219 | *   supported. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 220 | */ | 
|  | 221 | int AImageDecoder_createFromBuffer(const void* buffer, size_t length, | 
|  | 222 | AImageDecoder** outDecoder) __INTRODUCED_IN(30); | 
|  | 223 |  | 
|  | 224 | /** | 
|  | 225 | * Delete the AImageDecoder. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 226 | * | 
|  | 227 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 228 | */ | 
|  | 229 | void AImageDecoder_delete(AImageDecoder* decoder) __INTRODUCED_IN(30); | 
|  | 230 |  | 
|  | 231 | /** | 
|  | 232 | * Choose the desired output format. | 
|  | 233 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 234 | * Available since API level 30. | 
|  | 235 | * | 
| Leon Scroggins III | 5d0445c | 2020-01-23 09:43:43 -0500 | [diff] [blame] | 236 | * @param format {@link AndroidBitmapFormat} to use for the output. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 237 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 238 | *         indicating the reason for the failure. On failure, the | 
|  | 239 | *         {@link AImageDecoder} uses the format it was already planning | 
|  | 240 | *         to use (either its default or a previously successful setting | 
|  | 241 | *         from this function). | 
|  | 242 | * | 
|  | 243 | * Errors: | 
|  | 244 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The | 
|  | 245 | *   {@link AImageDecoder} is null or |format| does not correspond to an | 
|  | 246 | *   {@link AndroidBitmapFormat}. | 
|  | 247 | * - {@link ANDROID_IMAGE_DECODER_INVALID_CONVERSION}: The | 
|  | 248 | *   {@link AndroidBitmapFormat} is incompatible with the image. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 249 | */ | 
|  | 250 | int AImageDecoder_setAndroidBitmapFormat(AImageDecoder*, | 
|  | 251 | int32_t format) __INTRODUCED_IN(30); | 
|  | 252 |  | 
| Leon Scroggins III | 1be112f | 2020-01-15 04:26:44 -0500 | [diff] [blame] | 253 | /** | 
|  | 254 | * Specify whether the output's pixels should be unpremultiplied. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 255 | * | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 256 | * By default, {@link AImageDecoder_decodeImage} will premultiply the pixels, if they have alpha. | 
|  | 257 | * Pass true to this method to leave them unpremultiplied. This has no effect on an | 
| Leon Scroggins III | 1be112f | 2020-01-15 04:26:44 -0500 | [diff] [blame] | 258 | * opaque image. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 259 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 260 | * Available since API level 30. | 
|  | 261 | * | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 262 | * @param unpremultipliedRequired Pass true to leave the pixels unpremultiplied. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 263 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 264 | *         indicating the reason for the failure. | 
|  | 265 | * | 
|  | 266 | * Errors: | 
|  | 267 | * - {@link ANDROID_IMAGE_DECODER_INVALID_CONVERSION}: Unpremultiplied is not | 
|  | 268 | *   possible due to an existing scale set by | 
|  | 269 | *   {@link AImageDecoder_setTargetSize}. | 
|  | 270 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The | 
|  | 271 | *   {@link AImageDecoder} is null. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 272 | */ | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 273 | int AImageDecoder_setUnpremultipliedRequired(AImageDecoder*, | 
|  | 274 | bool unpremultipliedRequired) __INTRODUCED_IN(30); | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 275 |  | 
|  | 276 | /** | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 277 | * Choose the dataspace for the output. | 
|  | 278 | * | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 279 | * Ignored by {@link ANDROID_BITMAP_FORMAT_A_8}, which does not support | 
|  | 280 | * an {@link ADataSpace}. | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 281 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 282 | * Available since API level 30. | 
|  | 283 | * | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 284 | * @param dataspace The {@link ADataSpace} to decode into. An ADataSpace | 
|  | 285 | *                  specifies how to interpret the colors. By default, | 
|  | 286 | *                  AImageDecoder will decode into the ADataSpace specified by | 
|  | 287 | *                  {@link AImageDecoderHeaderInfo_getDataSpace}. If this | 
|  | 288 | *                  parameter is set to a different ADataSpace, AImageDecoder | 
|  | 289 | *                  will transform the output into the specified ADataSpace. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 290 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 291 | *         indicating the reason for the failure. | 
|  | 292 | * | 
|  | 293 | * Errors: | 
|  | 294 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The | 
|  | 295 | *   {@link AImageDecoder} is null or |dataspace| does not correspond to an | 
|  | 296 | *   {@link ADataSpace} value. | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 297 | */ | 
|  | 298 | int AImageDecoder_setDataSpace(AImageDecoder*, int32_t dataspace) __INTRODUCED_IN(30); | 
|  | 299 |  | 
|  | 300 | /** | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 301 | * Specify the output size for a decoded image. | 
|  | 302 | * | 
|  | 303 | * Future calls to {@link AImageDecoder_decodeImage} will sample or scale the | 
|  | 304 | * encoded image to reach the desired size. If a crop rect is set (via | 
|  | 305 | * {@link AImageDecoder_setCrop}), it must be contained within the dimensions | 
|  | 306 | * specified by width and height, and the output image will be the size of the | 
|  | 307 | * crop rect. | 
|  | 308 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 309 | * Available since API level 30. | 
|  | 310 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 311 | * @param width Width of the output (prior to cropping). | 
|  | 312 | *              This will affect future calls to | 
|  | 313 | *              {@link AImageDecoder_getMinimumStride}, which will now return | 
|  | 314 | *              a value based on this width. | 
|  | 315 | * @param height Height of the output (prior to cropping). | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 316 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 317 | *         indicating the reason for the failure. | 
|  | 318 | * | 
|  | 319 | * Errors: | 
|  | 320 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The | 
|  | 321 | *   {@link AImageDecoder} is null. | 
|  | 322 | * - {@link ANDROID_IMAGE_DECODER_INVALID_SCALE}: |width| or |height| is <= 0, | 
|  | 323 | *   the size is too big, any existing crop is not contained by the new image dimensions, | 
|  | 324 | *   or the scale is incompatible with a previous call to | 
|  | 325 | *   {@link AImageDecoder_setUnpremultipliedRequired}(true). | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 326 | */ | 
| Leon Scroggins III | 5d0445c | 2020-01-23 09:43:43 -0500 | [diff] [blame] | 327 | int AImageDecoder_setTargetSize(AImageDecoder*, int32_t width, int32_t height) __INTRODUCED_IN(30); | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 328 |  | 
| Leon Scroggins III | f27256b | 2020-01-19 21:13:04 -0500 | [diff] [blame] | 329 |  | 
|  | 330 | /** | 
|  | 331 | * Compute the dimensions to use for a given sampleSize. | 
|  | 332 | * | 
|  | 333 | * Although AImageDecoder can scale to an arbitrary target size (see | 
|  | 334 | * {@link AImageDecoder_setTargetSize}), some sizes may be more efficient than | 
|  | 335 | * others. This computes the most efficient target size to use to reach a | 
|  | 336 | * particular sampleSize. | 
|  | 337 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 338 | * Available since API level 30. | 
|  | 339 | * | 
| Leon Scroggins III | f27256b | 2020-01-19 21:13:04 -0500 | [diff] [blame] | 340 | * @param sampleSize A subsampling rate of the original image. Must be greater | 
|  | 341 | *                   than or equal to 1. A sampleSize of 2 means to skip every | 
|  | 342 | *                   other pixel/line, resulting in a width and height that are | 
|  | 343 | *                   1/2 of the original dimensions, with 1/4 the number of | 
|  | 344 | *                   pixels. | 
|  | 345 | * @param width Out parameter for the width sampled by sampleSize, and rounded | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 346 | *              in the direction that the decoder can do most efficiently. | 
| Leon Scroggins III | f27256b | 2020-01-19 21:13:04 -0500 | [diff] [blame] | 347 | * @param height Out parameter for the height sampled by sampleSize, and rounded | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 348 | *               in the direction that the decoder can do most efficiently. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 349 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 350 | *         indicating the reason for the failure. | 
|  | 351 | * | 
|  | 352 | * Errors: | 
|  | 353 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The | 
|  | 354 | *   {@link AImageDecoder}, |width| or |height| is null or |sampleSize| is < 1. | 
| Leon Scroggins III | f27256b | 2020-01-19 21:13:04 -0500 | [diff] [blame] | 355 | */ | 
|  | 356 | int AImageDecoder_computeSampledSize(const AImageDecoder*, int sampleSize, | 
| Leon Scroggins III | 5d0445c | 2020-01-23 09:43:43 -0500 | [diff] [blame] | 357 | int32_t* width, int32_t* height) __INTRODUCED_IN(30); | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 358 | /** | 
|  | 359 | * Specify how to crop the output after scaling (if any). | 
|  | 360 | * | 
|  | 361 | * Future calls to {@link AImageDecoder_decodeImage} will crop their output to | 
|  | 362 | * the specified {@link ARect}. Clients will only need to allocate enough memory | 
|  | 363 | * for the cropped ARect. | 
|  | 364 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 365 | * Available since API level 30. | 
|  | 366 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 367 | * @param crop Rectangle describing a crop of the decode. It must be contained inside of | 
|  | 368 | *             the (possibly scaled, by {@link AImageDecoder_setTargetSize}) | 
|  | 369 | *             image dimensions. This will affect future calls to | 
|  | 370 | *             {@link AImageDecoder_getMinimumStride}, which will now return a | 
|  | 371 | *             value based on the width of the crop. An empty ARect - | 
|  | 372 | *             specifically { 0, 0, 0, 0 } - may be used to remove the cropping | 
|  | 373 | *             behavior. Any other empty or unsorted ARects will result in | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 374 | *             returning {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 375 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 376 | *         indicating the reason for the failure. | 
|  | 377 | * | 
|  | 378 | * Errors: | 
|  | 379 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The | 
|  | 380 | *   {@link AImageDecoder} is null or the crop is not contained by the | 
|  | 381 | *   (possibly scaled) image dimensions. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 382 | */ | 
|  | 383 | int AImageDecoder_setCrop(AImageDecoder*, ARect crop) __INTRODUCED_IN(30); | 
|  | 384 |  | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 385 | struct AImageDecoderHeaderInfo; | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 386 | /** | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 387 | * Opaque handle for representing information about the encoded image. Retrieved | 
|  | 388 | * using {@link AImageDecoder_getHeaderInfo} and passed to methods like | 
|  | 389 | * {@link AImageDecoderHeaderInfo_getWidth} and | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 390 | * {@link AImageDecoderHeaderInfo_getHeight}. | 
|  | 391 | */ | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 392 | typedef struct AImageDecoderHeaderInfo AImageDecoderHeaderInfo; | 
|  | 393 |  | 
|  | 394 | /** | 
|  | 395 | * Return an opaque handle for reading header info. | 
|  | 396 | * | 
|  | 397 | * This is owned by the {@link AImageDecoder} and will be destroyed when the | 
|  | 398 | * AImageDecoder is destroyed via {@link AImageDecoder_delete}. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 399 | * | 
|  | 400 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 401 | */ | 
|  | 402 | const AImageDecoderHeaderInfo* AImageDecoder_getHeaderInfo( | 
|  | 403 | const AImageDecoder*) __INTRODUCED_IN(30); | 
|  | 404 |  | 
|  | 405 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 406 | * Report the native width of the encoded image. This is also the logical | 
|  | 407 | * pixel width of the output, unless {@link AImageDecoder_setTargetSize} is | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 408 | * used to choose a different size or {@link AImageDecoder_setCrop} is used to | 
|  | 409 | * set a crop rect. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 410 | * | 
|  | 411 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 412 | */ | 
|  | 413 | int32_t AImageDecoderHeaderInfo_getWidth(const AImageDecoderHeaderInfo*) __INTRODUCED_IN(30); | 
|  | 414 |  | 
|  | 415 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 416 | * Report the native height of the encoded image. This is also the logical | 
|  | 417 | * pixel height of the output, unless {@link AImageDecoder_setTargetSize} is | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 418 | * used to choose a different size or {@link AImageDecoder_setCrop} is used to | 
|  | 419 | * set a crop rect. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 420 | * | 
|  | 421 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 422 | */ | 
|  | 423 | int32_t AImageDecoderHeaderInfo_getHeight(const AImageDecoderHeaderInfo*) __INTRODUCED_IN(30); | 
|  | 424 |  | 
|  | 425 | /** | 
|  | 426 | * Report the mimeType of the encoded image. | 
|  | 427 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 428 | * Available since API level 30. | 
|  | 429 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 430 | * @return a string literal describing the mime type. | 
|  | 431 | */ | 
|  | 432 | const char* AImageDecoderHeaderInfo_getMimeType( | 
|  | 433 | const AImageDecoderHeaderInfo*) __INTRODUCED_IN(30); | 
|  | 434 |  | 
|  | 435 | /** | 
| Leon Scroggins III | 5d0445c | 2020-01-23 09:43:43 -0500 | [diff] [blame] | 436 | * Report the {@link AndroidBitmapFormat} the AImageDecoder will decode to | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 437 | * by default. {@link AImageDecoder} will try to choose one that is sensible | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 438 | * for the image and the system. Note that this does not indicate the | 
|  | 439 | * encoded format of the image. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 440 | * | 
|  | 441 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 442 | */ | 
| Leon Scroggins III | 5d0445c | 2020-01-23 09:43:43 -0500 | [diff] [blame] | 443 | int32_t AImageDecoderHeaderInfo_getAndroidBitmapFormat( | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 444 | const AImageDecoderHeaderInfo*) __INTRODUCED_IN(30); | 
|  | 445 |  | 
|  | 446 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 447 | * Report how the {@link AImageDecoder} will handle alpha by default. If the image | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 448 | * contains no alpha (according to its header), this will return | 
|  | 449 | * {@link ANDROID_BITMAP_FLAGS_ALPHA_OPAQUE}. If the image may contain alpha, | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 450 | * this returns {@link ANDROID_BITMAP_FLAGS_ALPHA_PREMUL}, because | 
|  | 451 | * {@link AImageDecoder_decodeImage} will premultiply pixels by default. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 452 | * | 
|  | 453 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 454 | */ | 
|  | 455 | int AImageDecoderHeaderInfo_getAlphaFlags( | 
|  | 456 | const AImageDecoderHeaderInfo*) __INTRODUCED_IN(30); | 
|  | 457 |  | 
|  | 458 | /** | 
| Leon Scroggins III | 8cee65e | 2020-01-30 14:20:42 -0500 | [diff] [blame] | 459 | * Report the dataspace the AImageDecoder will decode to by default. | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 460 | * | 
| Leon Scroggins III | 8cee65e | 2020-01-30 14:20:42 -0500 | [diff] [blame] | 461 | * By default, {@link AImageDecoder_decodeImage} will not do any color | 
|  | 462 | * conversion. | 
|  | 463 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 464 | * Available since API level 30. | 
|  | 465 | * | 
| Leon Scroggins III | 8cee65e | 2020-01-30 14:20:42 -0500 | [diff] [blame] | 466 | * @return The {@link ADataSpace} representing the way the colors | 
|  | 467 | *         are encoded (or {@link ADATASPACE_UNKNOWN} if there is not a | 
|  | 468 | *         corresponding ADataSpace). This specifies how to interpret the colors | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 469 | *         in the decoded image, unless {@link AImageDecoder_setDataSpace} is | 
|  | 470 | *         called to decode to a different ADataSpace. | 
|  | 471 | * | 
|  | 472 | *         Note that ADataSpace only exposes a few values. This may return | 
| Leon Scroggins III | 8cee65e | 2020-01-30 14:20:42 -0500 | [diff] [blame] | 473 | *         {@link ADATASPACE_UNKNOWN}, even for Named ColorSpaces, if they have | 
|  | 474 | *         no corresponding {@link ADataSpace}. | 
| Leon Scroggins III | 20d480c | 2020-01-15 15:32:59 -0500 | [diff] [blame] | 475 | */ | 
|  | 476 | int32_t AImageDecoderHeaderInfo_getDataSpace( | 
|  | 477 | const AImageDecoderHeaderInfo*) __INTRODUCED_IN(30); | 
|  | 478 |  | 
|  | 479 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 480 | * Return the minimum stride that can be used in | 
|  | 481 | * {@link AImageDecoder_decodeImage). | 
|  | 482 | * | 
|  | 483 | * This stride provides no padding, meaning it will be exactly equal to the | 
|  | 484 | * width times the number of bytes per pixel for the {@link AndroidBitmapFormat} | 
|  | 485 | * being used. | 
|  | 486 | * | 
|  | 487 | * If the output is scaled (via {@link AImageDecoder_setTargetSize}) and/or | 
|  | 488 | * cropped (via {@link AImageDecoder_setCrop}), this takes those into account. | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 489 | * | 
|  | 490 | * Available since API level 30. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 491 | */ | 
|  | 492 | size_t AImageDecoder_getMinimumStride(AImageDecoder*) __INTRODUCED_IN(30); | 
|  | 493 |  | 
|  | 494 | /** | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 495 | * Decode the image into pixels, using the settings of the {@link AImageDecoder}. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 496 | * | 
| Elliott Hughes | 7be0e2d | 2020-06-02 13:05:04 -0700 | [diff] [blame] | 497 | * Available since API level 30. | 
|  | 498 | * | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 499 | * @param decoder Opaque object representing the decoder. | 
|  | 500 | * @param pixels On success, will be filled with the result | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 501 | *               of the decode. Must be large enough to hold |size| bytes. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 502 | * @param stride Width in bytes of a single row. Must be at least | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 503 | *               {@link AImageDecoder_getMinimumStride} and a multiple of the | 
|  | 504 | *               bytes per pixel of the {@link AndroidBitmapFormat}. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 505 | * @param size Size of the pixel buffer in bytes. Must be at least | 
|  | 506 | *             stride * (height - 1) + | 
| Leon Scroggins III | 97fea5f | 2020-01-30 12:18:20 -0500 | [diff] [blame] | 507 | *             {@link AImageDecoder_getMinimumStride}. | 
| Leon Scroggins III | bb5ffd2 | 2020-02-06 11:45:16 -0500 | [diff] [blame] | 508 | * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value | 
|  | 509 | *         indicating the reason for the failure. | 
|  | 510 | * | 
|  | 511 | * Errors: | 
|  | 512 | * - {@link ANDROID_IMAGE_DECODER_INCOMPLETE}: The image was truncated. A | 
|  | 513 | *   partial image was decoded, and undecoded lines have been initialized to all | 
|  | 514 | *   zeroes. | 
|  | 515 | * - {@link ANDROID_IMAGE_DECODER_ERROR}: The image contained an error. A | 
|  | 516 | *   partial image was decoded, and undecoded lines have been initialized to all | 
|  | 517 | *   zeroes. | 
|  | 518 | * - {@link ANDROID_IMAGE_DECODER_BAD_PARAMETER}: The {@link AImageDecoder} or | 
|  | 519 | *   |pixels| is null, the stride is not large enough or not pixel aligned, or | 
|  | 520 | *   |size| is not large enough. | 
|  | 521 | * - {@link ANDROID_IMAGE_DECODER_SEEK_ERROR}: The asset or file descriptor | 
|  | 522 | *   failed to seek. | 
|  | 523 | * - {@link ANDROID_IMAGE_DECODER_INTERNAL_ERROR}: Some other error, like a | 
|  | 524 | *   failure to allocate memory. | 
| Leon Scroggins III | 2f98494 | 2019-11-22 17:02:23 -0500 | [diff] [blame] | 525 | */ | 
|  | 526 | int AImageDecoder_decodeImage(AImageDecoder* decoder, | 
|  | 527 | void* pixels, size_t stride, | 
|  | 528 | size_t size) __INTRODUCED_IN(30); | 
|  | 529 |  | 
|  | 530 | #endif // __ANDROID_API__ >= 30 | 
|  | 531 |  | 
|  | 532 | #ifdef __cplusplus | 
|  | 533 | } | 
|  | 534 | #endif | 
|  | 535 |  | 
|  | 536 | #endif // ANDROID_IMAGE_DECODER_H | 
|  | 537 |  | 
|  | 538 | /** @} */ |