1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup image 18 * @{ 19 * 20 * @brief Provides native APIs for image sources. 21 * 22 * @Syscap SystemCapability.Multimedia.Image 23 * @since 10 24 * @version 4.0 25 */ 26 27 /** 28 * @file image_source_mdk.h 29 * 30 * @brief Declares APIs for decoding an image source into a pixel map. 31 * 32 * @kit ImageKit 33 * @Syscap SystemCapability.Multimedia.Image 34 * @since 10 35 * @version 4.0 36 */ 37 38 #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ 39 #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ 40 #ifdef __cplusplus 41 #include <cstdint> 42 #else 43 #include <stdint.h> 44 #endif 45 #include "napi/native_api.h" 46 #include "image_mdk_common.h" 47 #include "rawfile/raw_file.h" 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 /** 53 * @brief Defines a native image source object for the image source APIs. 54 * 55 * @Syscap SystemCapability.Multimedia.Image 56 * @since 10 57 * @version 4.0 58 */ 59 struct ImageSourceNative_; 60 61 /** 62 * @brief Defines a native image source object for the image source APIs. 63 * 64 * @Syscap SystemCapability.Multimedia.Image 65 * @since 10 66 * @version 4.0 67 */ 68 typedef struct ImageSourceNative_ ImageSourceNative; 69 70 /** 71 * @brief Defines a pointer to bits per sample, one of the image properties. 72 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 73 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 74 * 75 * @Syscap SystemCapability.Multimedia.Image 76 * @since 10 77 * @version 4.0 78 */ 79 static const char* OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE = "BitsPerSample"; 80 81 /** 82 * @brief Defines a pointer to the orientation, one of the image properties. 83 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 84 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 85 * 86 * @Syscap SystemCapability.Multimedia.Image 87 * @since 10 88 * @version 4.0 89 */ 90 static const char* OHOS_IMAGE_PROPERTY_ORIENTATION = "Orientation"; 91 92 /** 93 * @brief Defines a pointer to the image length, one of the image properties. 94 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 95 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 96 * 97 * @Syscap SystemCapability.Multimedia.Image 98 * @since 10 99 * @version 4.0 100 */ 101 static const char* OHOS_IMAGE_PROPERTY_IMAGE_LENGTH = "ImageLength"; 102 103 /** 104 * @brief Defines a pointer to the image width, one of the image properties. 105 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 106 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 107 * 108 * @Syscap SystemCapability.Multimedia.Image 109 * @since 10 110 * @version 4.0 111 */ 112 static const char* OHOS_IMAGE_PROPERTY_IMAGE_WIDTH = "ImageWidth"; 113 114 /** 115 * @brief Defines a pointer to the GPS latitude, one of the image properties. 116 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 117 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 118 * 119 * @Syscap SystemCapability.Multimedia.Image 120 * @since 10 121 * @version 4.0 122 */ 123 static const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE = "GPSLatitude"; 124 125 /** 126 * @brief Defines a pointer to the GPS longitude, one of the image properties. 127 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 128 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 129 * 130 * @Syscap SystemCapability.Multimedia.Image 131 * @since 10 132 * @version 4.0 133 */ 134 static const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE = "GPSLongitude"; 135 136 /** 137 * @brief Defines a pointer to the GPS latitude reference information, one of the image properties. 138 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 139 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 140 * 141 * @Syscap SystemCapability.Multimedia.Image 142 * @since 10 143 * @version 4.0 144 */ 145 static const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF = "GPSLatitudeRef"; 146 147 /** 148 * @brief Defines a pointer to the GPS longitude reference information, one of the image properties. 149 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 150 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 151 * 152 * @Syscap SystemCapability.Multimedia.Image 153 * @since 10 154 * @version 4.0 155 */ 156 static const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF = "GPSLongitudeRef"; 157 158 /** 159 * @brief Defines a pointer to the created date and time, one of the image properties. 160 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 161 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 162 * 163 * @Syscap SystemCapability.Multimedia.Image 164 * @since 10 165 * @version 4.0 166 */ 167 static const char* OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL = "DateTimeOriginal"; 168 169 /** 170 * @brief Defines a pointer to the exposure time, one of the image properties. 171 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 172 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 173 * 174 * @Syscap SystemCapability.Multimedia.Image 175 * @since 10 176 * @version 4.0 177 */ 178 static const char* OHOS_IMAGE_PROPERTY_EXPOSURE_TIME = "ExposureTime"; 179 180 /** 181 * @brief Defines a pointer to the scene type, one of the image properties. 182 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 183 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 184 * 185 * @Syscap SystemCapability.Multimedia.Image 186 * @since 10 187 * @version 4.0 188 */ 189 static const char* OHOS_IMAGE_PROPERTY_SCENE_TYPE = "SceneType"; 190 191 /** 192 * @brief Defines a pointer to the ISO speed ratings, one of the image properties. 193 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 194 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 195 * 196 * @Syscap SystemCapability.Multimedia.Image 197 * @since 10 198 * @version 4.0 199 */ 200 static const char* OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS = "ISOSpeedRatings"; 201 202 /** 203 * @brief Defines a pointer to the f-number of the image, one of the image properties. 204 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 205 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 206 * 207 * @Syscap SystemCapability.Multimedia.Image 208 * @since 10 209 * @version 4.0 210 */ 211 static const char* OHOS_IMAGE_PROPERTY_F_NUMBER = "FNumber"; 212 213 /** 214 * @brief Defines a pointer to the compressed bits per pixel, one of the image properties. 215 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n 216 * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n 217 * 218 * @Syscap SystemCapability.Multimedia.Image 219 * @since 10 220 * @version 4.0 221 */ 222 static const char* OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel"; 223 224 /** 225 * @brief Defines the region of the image source to decode. 226 * It is used in {@link OhosImageDecodingOps}, {@link OH_ImageSource_CreatePixelMap}, and 227 * {@link OH_ImageSource_CreatePixelMapList}. 228 * 229 * @Syscap SystemCapability.Multimedia.Image 230 * @since 10 231 * @version 4.0 232 */ 233 struct OhosImageRegion { 234 /** X coordinate of the start point, in pixels. */ 235 int32_t x; 236 /** Y coordinate of the start point, in pixels. */ 237 int32_t y; 238 /** Width of the region, in pixels. */ 239 int32_t width; 240 /** Height of the region, in pixels. */ 241 int32_t height; 242 }; 243 244 /** 245 * @brief Defines image source options infomation 246 * {@link OH_ImageSource_Create} and {@link OH_ImageSource_CreateIncremental}. 247 * 248 * @Syscap SystemCapability.Multimedia.Image 249 * @since 10 250 * @version 4.0 251 */ 252 struct OhosImageSourceOps { 253 /** Pixel density of the image source. */ 254 int32_t density; 255 /** Image source pixel format, used to describe YUV buffer usually. */ 256 int32_t pixelFormat; 257 /** Image source pixel size of width and height. */ 258 struct OhosImageSize size; 259 }; 260 261 /** 262 * @brief Defines the options for decoding the image source. 263 * It is used in {@link OH_ImageSource_CreatePixelMap} and {@link OH_ImageSource_CreatePixelMapList}. 264 * 265 * @Syscap SystemCapability.Multimedia.Image 266 * @since 10 267 * @version 4.0 268 */ 269 struct OhosImageDecodingOps { 270 /** Defines output pixel map editable. */ 271 int8_t editable; 272 /** Defines output pixel format. */ 273 int32_t pixelFormat; 274 /** Defines decoding target pixel density. */ 275 int32_t fitDensity; 276 /** Defines decoding index of image source. */ 277 uint32_t index; 278 /** Defines decoding sample size option. */ 279 uint32_t sampleSize; 280 /** Defines decoding rotate option. */ 281 uint32_t rotate; 282 /** Defines decoding target pixel size of width and height. */ 283 struct OhosImageSize size; 284 /** Defines image source pixel region for decoding. */ 285 struct OhosImageRegion region; 286 }; 287 288 /** 289 * @brief Defines the image source information, which is obtained by calling {@link OH_ImageSource_GetImageInfo}. 290 * 291 * @Syscap SystemCapability.Multimedia.Image 292 * @since 10 293 * @version 4.0 294 */ 295 struct OhosImageSourceInfo { 296 /** Pixel format of the image source. It is set in {@link OH_ImageSource_Create}. */ 297 int32_t pixelFormat; 298 /** Color space of the image source. */ 299 int32_t colorSpace; 300 /** Alpha type of the image source. */ 301 int32_t alphaType; 302 /** Image density of the image source. It is set in {@link OH_ImageSource_Create}. */ 303 int32_t density; 304 /** Pixel width and height of the image source. */ 305 struct OhosImageSize size; 306 }; 307 308 /** 309 * @brief Defines the input resource of the image source. It is obtained by calling {@link OH_ImageSource_Create}. 310 * Only one type of resource is accepted at a time. 311 * 312 * @Syscap SystemCapability.Multimedia.Image 313 * @since 10 314 * @version 4.0 315 * @deprecated since 11 316 */ 317 struct OhosImageSource { 318 /** Pointer to the image source URI. Only a file URI or Base64 URI is accepted. */ 319 char* uri = nullptr; 320 /** Length of the image source URI. */ 321 size_t uriSize = 0; 322 /** Descriptor of the image source. */ 323 int32_t fd = -1; 324 /** Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted. */ 325 uint8_t* buffer = nullptr; 326 /** Size of the image source buffer. */ 327 size_t bufferSize = 0; 328 }; 329 330 /** 331 * @brief Defines the delay time list of the image source. It is obtained by calling 332 * {@link OH_ImageSource_GetDelayTime}. 333 * 334 * @Syscap SystemCapability.Multimedia.Image 335 * @since 10 336 * @version 4.0 337 */ 338 struct OhosImageSourceDelayTimeList { 339 /** Pointer to the head of the image source delay time list. */ 340 int32_t* delayTimeList; 341 /** Size of the image source delay time list. */ 342 size_t size = 0; 343 }; 344 345 /** 346 * @brief Defines image source supported format string. 347 * {@link OhosImageSourceSupportedFormatList} and {@link OH_ImageSource_GetSupportedFormats} 348 * 349 * @Syscap SystemCapability.Multimedia.Image 350 * @since 10 351 * @version 4.0 352 */ 353 struct OhosImageSourceSupportedFormat { 354 /** Image source supported format string head.*/ 355 char* format = nullptr; 356 /** Image source supported format string size.*/ 357 size_t size = 0; 358 }; 359 360 /** 361 * @brief Defines the format string list supported by the image source. 362 * It is obtained by calling {@link OH_ImageSource_GetSupportedFormats}. 363 * 364 * @Syscap SystemCapability.Multimedia.Image 365 * @since 10 366 * @version 4.0 367 */ 368 struct OhosImageSourceSupportedFormatList { 369 /** Image source supported format string list head.*/ 370 struct OhosImageSourceSupportedFormat** supportedFormatList = nullptr; 371 /** Image source supported format string list size.*/ 372 size_t size = 0; 373 }; 374 375 /** 376 * @brief Defines the property string (in key-value format) of the image source. 377 * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}. 378 * 379 * @Syscap SystemCapability.Multimedia.Image 380 * @since 10 381 * @version 4.0 382 */ 383 struct OhosImageSourceProperty { 384 /** Image source property key and value string head.*/ 385 char* value = nullptr; 386 /** Image source property key and value string size.*/ 387 size_t size = 0; 388 }; 389 390 /** 391 * @brief Defines the update data of the image source. It is obtained by calling {@link OH_ImageSource_UpdateData}. 392 * 393 * @Syscap SystemCapability.Multimedia.Image 394 * @since 10 395 * @version 4.0 396 */ 397 struct OhosImageSourceUpdateData { 398 /** Image source update data buffer.*/ 399 uint8_t* buffer = nullptr; 400 /** Image source update data buffer size.*/ 401 size_t bufferSize = 0; 402 /** Image source offset of update data buffer.*/ 403 uint32_t offset = 0; 404 /** Image source update data length in update data buffer.*/ 405 uint32_t updateLength = 0; 406 /** Image source update data is completed in this session.*/ 407 int8_t isCompleted = 0; 408 }; 409 410 /** 411 * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified 412 * {@link OhosImageSource} and {@link OhosImageSourceOps} structs. 413 * 414 * @param env Indicates a pointer to the Java Native Interface (JNI) environment. 415 * @param src Indicates a pointer to the input resource of the image source. For details, see {@link OhosImageSource}. 416 * @param ops Indicates a pointer to the options for creating the image source. 417 * For details, see {@link OhosImageSourceOps}. 418 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 419 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 420 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 421 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 422 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 423 * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA_INCOMPLETE - if image source data incomplete. 424 * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA - if image source data error. 425 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 426 * returns {@link IRNdkErrCode} IMAGE_RESULT_TOO_LARGE - if image data too large. 427 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 428 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 429 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 430 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 431 * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_DAMAGED - if file damaged. 432 * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_FD_ERROR - if file fd is bad. 433 * returns {@link IRNdkErrCode} IMAGE_RESULT_STREAM_SIZE_ERROR - if stream bad. 434 * returns {@link IRNdkErrCode} IMAGE_RESULT_SEEK_FAILED - if seek file failed. 435 * returns {@link IRNdkErrCode} IMAGE_RESULT_PEEK_FAILED - if peek file failed. 436 * returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed. 437 * @see {@link OhosImageSource}, {@link OhosImageSourceOps} 438 * 439 * @Syscap SystemCapability.Multimedia.Image 440 * @since 10 441 * @version 4.0 442 * @deprecated since 11 443 * @useinstead image#OH_ImageSource_CreateFromUri 444 * @useinstead image#OH_ImageSource_CreateFromFd 445 * @useinstead image#OH_ImageSource_CreateFromData 446 */ 447 int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, 448 struct OhosImageSourceOps* ops, napi_value *res); 449 450 /** 451 * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified 452 * image source URI and {@link OhosImageSourceOps} structs. 453 * 454 * @param env Indicates a pointer to the Java Native Interface (JNI) environment. 455 * @param uri Indicates a pointer to the image source URI. Only a file URI or Base64 URI is accepted. 456 * @param size Indicates the length of the image source URI. 457 * @param ops Indicates a pointer to the options for creating the image source. 458 * For details, see {@link OhosImageSourceOps}. 459 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 460 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 461 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 462 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 463 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 464 * @see {@link OhosImageSourceOps} 465 * 466 * @Syscap SystemCapability.Multimedia.Image 467 * @since 11 468 * @version 4.1 469 */ 470 int32_t OH_ImageSource_CreateFromUri(napi_env env, char* uri, size_t size, 471 struct OhosImageSourceOps* ops, napi_value *res); 472 473 /** 474 * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified 475 * image source file descriptor and {@link OhosImageSourceOps} structs. 476 * 477 * @param env Indicates a pointer to the Java Native Interface (JNI) environment. 478 * @param fd Indicates the image source file descriptor. 479 * @param ops Indicates a pointer to the options for creating the image source. 480 * For details, see {@link OhosImageSourceOps}. 481 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 482 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 483 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 484 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 485 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 486 * @see {@link OhosImageSourceOps} 487 * 488 * @Syscap SystemCapability.Multimedia.Image 489 * @since 11 490 * @version 4.1 491 */ 492 int32_t OH_ImageSource_CreateFromFd(napi_env env, int32_t fd, 493 struct OhosImageSourceOps* ops, napi_value *res); 494 495 /** 496 * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified 497 * image source data and {@link OhosImageSourceOps} structs. 498 * 499 * @param env Indicates a pointer to the Java Native Interface (JNI) environment. 500 * @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted. 501 * @param dataSize Indicates the size of the image source data. 502 * @param ops Indicates a pointer to the options for creating the image source. 503 * For details, see {@link OhosImageSourceOps}. 504 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 505 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 506 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 507 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 508 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 509 * @see {@link OhosImageSourceOps} 510 * 511 * @Syscap SystemCapability.Multimedia.Image 512 * @since 11 513 * @version 4.1 514 */ 515 int32_t OH_ImageSource_CreateFromData(napi_env env, uint8_t* data, size_t dataSize, 516 struct OhosImageSourceOps* ops, napi_value *res); 517 518 /** 519 * @brief Creates an <b>ImageSource</b> object at the JavaScript native layer based on the specified 520 * raw file's file descriptor and {@link OhosImageSourceOps} structs. 521 * 522 * @param env Indicates a pointer to the Java Native Interface (JNI) environment. 523 * @param rawFile Indicates the raw file's file descriptor. 524 * @param ops Indicates a pointer to the options for creating the image source. 525 * For details, see {@link OhosImageSourceOps}. 526 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 527 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 528 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 529 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 530 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 531 * @see {@link OhosImageSourceOps} 532 * 533 * @Syscap SystemCapability.Multimedia.Image 534 * @since 11 535 * @version 4.1 536 */ 537 int32_t OH_ImageSource_CreateFromRawFile(napi_env env, RawFileDescriptor rawFile, 538 struct OhosImageSourceOps* ops, napi_value *res); 539 540 /** 541 * @brief Creates an incremental <b>ImageSource</b> object at the JavaScript native layer based on the specified 542 * {@link OhosImageSource} and {@link OhosImageSourceOps} structs. 543 * The image source data will be updated through {@link OH_ImageSource_UpdateData}. 544 * 545 * @param env Indicates a pointer to the JNI environment. 546 * @param src Indicates a pointer to the input resource of the image source. Only the buffer type is accepted. 547 * For details, see {@link OhosImageSource}. 548 * @param ops Indicates a pointer to the options for creating the image source. 549 * For details, see {@link OhosImageSourceOps}. 550 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 551 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 552 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 553 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 554 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 555 * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA_INCOMPLETE - if image source data incomplete. 556 * returns {@link IRNdkErrCode} IMAGE_RESULT_SOURCE_DATA - if image source data error. 557 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 558 * returns {@link IRNdkErrCode} IMAGE_RESULT_TOO_LARGE - if image data too large. 559 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 560 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 561 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 562 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 563 * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_DAMAGED - if file damaged. 564 * returns {@link IRNdkErrCode} IMAGE_RESULT_FILE_FD_ERROR - if file fd is bad. 565 * returns {@link IRNdkErrCode} IMAGE_RESULT_STREAM_SIZE_ERROR - if stream bad. 566 * returns {@link IRNdkErrCode} IMAGE_RESULT_SEEK_FAILED - if seek file failed. 567 * returns {@link IRNdkErrCode} IMAGE_RESULT_PEEK_FAILED - if peek file failed. 568 * returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed. 569 * @see {@link OhosImageSource}, {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData} 570 * 571 * @Syscap SystemCapability.Multimedia.Image 572 * @since 10 573 * @version 4.0 574 * @deprecated since 11 575 * @useinstead image#OH_ImageSource_CreateIncrementalFromData 576 */ 577 int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* source, 578 struct OhosImageSourceOps* ops, napi_value *res); 579 580 /** 581 * @brief Creates an incremental <b>ImageSource</b> object at the JavaScript native layer based on the specified 582 * image source data and {@link OhosImageSourceOps} structs. 583 * The image source data will be updated through {@link OH_ImageSource_UpdateData}. 584 * 585 * @param env Indicates a pointer to the JNI environment. 586 * @param data Indicates a pointer to the image source data. Only a formatted packet data or Base64 data is accepted. 587 * @param dataSize Indicates the size of the image source data. 588 * @param ops Indicates a pointer to the options for creating the image source. 589 * For details, see {@link OhosImageSourceOps}. 590 * @param res Indicates a pointer to the <b>ImageSource</b> object created at the JavaScript native layer. 591 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 592 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 593 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 594 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 595 * @see {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData} 596 * 597 * @Syscap SystemCapability.Multimedia.Image 598 * @since 11 599 * @version 4.1 600 */ 601 int32_t OH_ImageSource_CreateIncrementalFromData(napi_env env, uint8_t* data, size_t dataSize, 602 struct OhosImageSourceOps* ops, napi_value *res); 603 604 /** 605 * @brief Obtains all supported decoding formats. 606 * 607 * @param res Indicates a pointer to the <b>OhosImageSourceSupportedFormatList</b> struct. 608 * When the input <b>supportedFormatList</b> is a null pointer and <b>size</b> is 0, the size of the supported formats 609 * is returned through <b>size</b> in <b>res</b>. 610 * To obtain all formats, a space larger than <b>size</b> is required. 611 * In addition, sufficient space must be reserved for each format supported. 612 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 613 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 614 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 615 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 616 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 617 * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if decode fail. 618 * @see {@link OhosImageSourceSupportedFormatList}, {@link OhosImageSourceSupportedFormat} 619 * 620 * @Syscap SystemCapability.Multimedia.Image 621 * @since 10 622 * @version 4.0 623 */ 624 int32_t OH_ImageSource_GetSupportedFormats(struct OhosImageSourceSupportedFormatList* res); 625 626 /** 627 * @brief Converts an {@link ImageSource} object at the JavaScript native layer to an <b>ImageSourceNative</b> object 628 * at the C++ native layer. 629 * 630 * @param env Indicates a pointer to the JNI environment. 631 * @param source Indicates a pointer to the <b>ImageSource</b> object at the JavaScript native layer. 632 * @return Returns a pointer to the {@link ImageSourceNative} object if the operation is successful; 633 * returns a null pointer otherwise. 634 * @see {@link ImageSourceNative}, {@link OH_ImageSource_Release} 635 * 636 * @Syscap SystemCapability.Multimedia.Image 637 * @since 10 638 * @version 4.0 639 */ 640 ImageSourceNative* OH_ImageSource_InitNative(napi_env env, napi_value source); 641 642 /** 643 * @brief Decodes an <b>ImageSource</b> object to obtain a <b>PixelMap</b> object at the JavaScript native layer 644 * based on the specified {@link OhosImageDecodingOps} struct. 645 * 646 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 647 * @param ops Indicates a pointer to the options for decoding the image source. 648 * For details, see {@link OhosImageDecodingOps}. 649 * @param res Indicates a pointer to the <b>PixelMap</b> object obtained at the JavaScript native layer. 650 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 651 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 652 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 653 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 654 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 655 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 656 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 657 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 658 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed. 659 * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed. 660 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 661 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 662 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error. 663 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal. 664 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 665 * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error. 666 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 667 * returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error. 668 * returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error. 669 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 670 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 671 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 672 * returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - if image add pixel map fail. 673 * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported. 674 * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed. 675 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error. 676 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 677 * returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed. 678 * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed. 679 * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps} 680 * 681 * @Syscap SystemCapability.Multimedia.Image 682 * @since 10 683 * @version 4.0 684 */ 685 int32_t OH_ImageSource_CreatePixelMap(const ImageSourceNative* native, 686 struct OhosImageDecodingOps* ops, napi_value *res); 687 688 /** 689 * @brief Decodes an <b>ImageSource</b> to obtain all the <b>PixelMap</b> objects at the JavaScript native layer 690 * based on the specified {@link OhosImageDecodingOps} struct. 691 * 692 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 693 * @param ops Indicates a pointer to the options for decoding the image source. 694 * For details, see {@link OhosImageDecodingOps}. 695 * @param res Indicates a pointer to the <b>PixelMap</b> objects obtained at the JavaScript native layer. 696 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 697 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 698 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 699 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 700 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 701 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 702 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 703 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 704 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed. 705 * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed. 706 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 707 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 708 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error. 709 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal. 710 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 711 * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error. 712 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 713 * returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error. 714 * returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error. 715 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 716 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 717 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 718 * returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - if image add pixel map fail. 719 * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported. 720 * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed. 721 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error. 722 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 723 * returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed. 724 * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed. 725 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 726 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 727 * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps} 728 * 729 * @Syscap SystemCapability.Multimedia.Image 730 * @since 10 731 * @version 4.0 732 */ 733 int32_t OH_ImageSource_CreatePixelMapList(const ImageSourceNative* native, 734 struct OhosImageDecodingOps* ops, napi_value *res); 735 736 /** 737 * @brief Obtains the delay time list from some <b>ImageSource</b> objects (such as GIF image sources). 738 * 739 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 740 * @param res Indicates a pointer to the delay time list obtained. 741 * For details, see {@link OhosImageSourceDelayTimeList}. When the input <b>delayTimeList</b> is a null pointer and 742 * <b>size</b> is <b>0</b>, the size of the delay time list is returned through <b>size</b> in <b>res</b>. 743 * To obtain the complete delay time list, a space greater than <b>size</b> is required. 744 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 745 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 746 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 747 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 748 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 749 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 750 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 751 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 752 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 753 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 754 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 755 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 756 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 757 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 758 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 759 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 760 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 761 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 762 * @see {@link ImageSourceNative}, {@link OhosImageSourceDelayTimeList} 763 * 764 * @Syscap SystemCapability.Multimedia.Image 765 * @since 10 766 * @version 4.0 767 */ 768 int32_t OH_ImageSource_GetDelayTime(const ImageSourceNative* native, 769 struct OhosImageSourceDelayTimeList* res); 770 771 /** 772 * @brief Obtains the number of frames from an <b>ImageSource</b> object. 773 * 774 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 775 * @param res Indicates a pointer to the number of frames obtained. 776 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 777 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 778 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 779 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 780 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 781 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 782 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 783 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 784 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 785 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 786 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 787 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 788 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 789 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 790 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 791 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 792 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 793 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 794 * @see {@link ImageSourceNative} 795 * 796 * @Syscap SystemCapability.Multimedia.Image 797 * @since 10 798 * @version 4.0 799 */ 800 int32_t OH_ImageSource_GetFrameCount(const ImageSourceNative* native, uint32_t *res); 801 802 /** 803 * @brief Obtains image source information from an <b>ImageSource</b> object by index. 804 * 805 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 806 * @param index Indicates the index of the frame. 807 * @param info Indicates a pointer to the image source information obtained. 808 * For details, see {@link OhosImageSourceInfo}. 809 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 810 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 811 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 812 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 813 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 814 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 815 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 816 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 817 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 818 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 819 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 820 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 821 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 822 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 823 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 824 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 825 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 826 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 827 * @see {@link ImageSourceNative}, {@link OhosImageSourceInfo} 828 * 829 * @Syscap SystemCapability.Multimedia.Image 830 * @since 10 831 * @version 4.0 832 */ 833 int32_t OH_ImageSource_GetImageInfo(const ImageSourceNative* native, int32_t index, 834 struct OhosImageSourceInfo* info); 835 836 /** 837 * @brief Obtains the value of an image property from an <b>ImageSource</b> object. 838 * 839 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 840 * @param key Indicates a pointer to the property. For details, see {@link OhosImageSourceProperty}. 841 * @param value Indicates a pointer to the property value obtained. 842 * If the input <b>value</b> is a null pointer and <b>size</b> is <b>0</b>, the size of the property value is returned 843 * through <b>size</b> in <b>value</b>. 844 * To obtain the complete property value, a space greater than <b>size</b> is required. 845 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 846 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 847 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 848 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 849 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 850 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 851 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 852 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 853 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 854 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 855 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 856 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 857 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 858 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 859 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 860 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 861 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 862 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 863 * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty} 864 * 865 * @Syscap SystemCapability.Multimedia.Image 866 * @since 10 867 * @version 4.0 868 */ 869 int32_t OH_ImageSource_GetImageProperty(const ImageSourceNative* native, 870 struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value); 871 872 /** 873 * @brief Modifies the value of an image property of an <b>ImageSource</b> object. 874 * 875 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 876 * @param key Indicates a pointer to the property. For details, see {@link OhosImageSourceProperty}. 877 * @param value Indicates a pointer to the new value of the property. 878 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 879 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 880 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 881 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 882 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 883 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 884 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 885 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 886 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 887 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 888 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 889 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 890 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 891 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 892 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 893 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 894 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_EXIF_UNSUPPORT - if image decode exif unsupport. 895 * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. 896 * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty} 897 * 898 * @Syscap SystemCapability.Multimedia.Image 899 * @since 10 900 * @version 4.0 901 */ 902 int32_t OH_ImageSource_ModifyImageProperty(const ImageSourceNative* native, 903 struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value); 904 905 /** 906 * @brief Updates the data of an <b>ImageSource</b> object. 907 * 908 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 909 * @param data Indicates a pointer to the update data. For details, see {@link OhosImageSourceUpdateData}. 910 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 911 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 912 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 913 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 914 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 915 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_FAILED - if decode fail. 916 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_HEAD_ABNORMAL - if image decode head error. 917 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_DECODER_FAILED - if create decoder failed. 918 * returns {@link IRNdkErrCode} IMAGE_RESULT_CREATE_ENCODER_FAILED - if create encoder failed. 919 * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if check format failed. 920 * returns {@link IRNdkErrCode} IMAGE_RESULT_THIRDPART_SKIA_ERROR - if skia error. 921 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 922 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST - if sharememory error. 923 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL - if sharememory data abnormal. 924 * returns {@link IRNdkErrCode} IMAGE_RESULT_DECODE_ABNORMAL - if image decode error. 925 * returns {@link IRNdkErrCode} IMAGE_RESULT_MALLOC_ABNORMAL - if image malloc error. 926 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_UNSUPPORT - if image init error. 927 * returns {@link IRNdkErrCode} IMAGE_RESULT_INIT_ABNORMAL - if image input data error. 928 * returns {@link IRNdkErrCode} IMAGE_RESULT_CROP - if crop error. 929 * returns {@link IRNdkErrCode} IMAGE_RESULT_UNKNOWN_FORMAT - if image unknown format. 930 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_REGISTER_FAILED - if register plugin fail. 931 * returns {@link IRNdkErrCode} IMAGE_RESULT_PLUGIN_CREATE_FAILED - if create plugin fail. 932 * returns {@link IRNdkErrCode} IMAGE_RESULT_ENCODE_FAILED - image add pixel map fail. 933 * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_UNSUPPORT - if image hardware decode unsupported. 934 * returns {@link IRNdkErrCode} IMAGE_RESULT_HW_DECODE_FAILED - if hard decode failed. 935 * returns {@link IRNdkErrCode} IMAGE_RESULT_ERR_IPC - if ipc error. 936 * returns {@link IRNdkErrCode} IMAGE_RESULT_INDEX_INVALID - if invalid index. 937 * returns {@link IRNdkErrCode} IMAGE_RESULT_ALPHA_TYPE_ERROR - if hard decode failed. 938 * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed. 939 * @see {@link ImageSourceNative}, {@link OhosImageSourceUpdateData} 940 * 941 * @Syscap SystemCapability.Multimedia.Image 942 * @since 10 943 * @version 4.0 944 */ 945 int32_t OH_ImageSource_UpdateData(const ImageSourceNative* native, struct OhosImageSourceUpdateData* data); 946 947 948 /** 949 * @brief Releases an <b>ImageSourceNative</b> object. 950 * 951 * @param native Indicates a pointer to the {@link ImageSourceNative} object at the C++ native layer. 952 * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. 953 * returns {@link IRNdkErrCode} IMAGE_RESULT_BAD_PARAMETER - if bad parameter. 954 * returns {@link IRNdkErrCode} IMAGE_RESULT_JNI_ENV_ABNORMAL - if Abnormal JNI environment. 955 * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. 956 * returns {@link IRNdkErrCode} IMAGE_RESULT_GET_DATA_ABNORMAL - if image get data error. 957 * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. 958 * @see {@link ImageSourceNative}, {@link OH_ImageSource_Create}, {@link OH_ImageSource_CreateIncremental} 959 * 960 * @Syscap SystemCapability.Multimedia.Image 961 * @since 10 962 * @version 4.0 963 */ 964 int32_t OH_ImageSource_Release(ImageSourceNative* native); 965 #ifdef __cplusplus 966 }; 967 #endif 968 #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ 969