1/* 2 * Copyright (C) 2022 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 * @file 18 * @kit ImageKit 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; 23import type rpc from './@ohos.rpc'; 24import type resourceManager from './@ohos.resourceManager'; 25 26/** 27 * @namespace image 28 * @since 6 29 */ 30/** 31 * This module provides the capability of image codec and access 32 * @namespace image 33 * @syscap SystemCapability.Multimedia.Image.Core 34 * @crossplatform 35 * @atomicservice 36 * @since 11 37 */ 38declare namespace image { 39 /** 40 * Enumerates pixel map formats. 41 * 42 * @enum { number } 43 * @syscap SystemCapability.Multimedia.Image.Core 44 * @since 7 45 */ 46 /** 47 * Enumerates pixel map formats. 48 * 49 * @enum { number } 50 * @syscap SystemCapability.Multimedia.Image.Core 51 * @crossplatform 52 * @since 10 53 */ 54 /** 55 * Enumerates pixel map formats. 56 * 57 * @enum { number } 58 * @syscap SystemCapability.Multimedia.Image.Core 59 * @crossplatform 60 * @atomicservice 61 * @since 11 62 */ 63 enum PixelMapFormat { 64 /** 65 * Indicates an unknown format. 66 * 67 * @syscap SystemCapability.Multimedia.Image.Core 68 * @since 7 69 */ 70 /** 71 * Indicates an unknown format. 72 * 73 * @syscap SystemCapability.Multimedia.Image.Core 74 * @crossplatform 75 * @since 10 76 */ 77 /** 78 * Indicates an unknown format. 79 * 80 * @syscap SystemCapability.Multimedia.Image.Core 81 * @crossplatform 82 * @atomicservice 83 * @since 11 84 */ 85 UNKNOWN = 0, 86 87 /** 88 * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded 89 * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, 90 * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. 91 * 92 * @syscap SystemCapability.Multimedia.Image.Core 93 * @since 7 94 */ 95 /** 96 * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded 97 * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, 98 * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. 99 * 100 * @syscap SystemCapability.Multimedia.Image.Core 101 * @crossplatform 102 * @since 10 103 */ 104 /** 105 * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded 106 * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, 107 * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. 108 * 109 * @syscap SystemCapability.Multimedia.Image.Core 110 * @crossplatform 111 * @atomicservice 112 * @since 11 113 */ 114 RGB_565 = 2, 115 116 /** 117 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 118 * and are stored from the higher-order to the lower-order bits. 119 * 120 * @syscap SystemCapability.Multimedia.Image.Core 121 * @since 7 122 */ 123 /** 124 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 125 * and are stored from the higher-order to the lower-order bits. 126 * 127 * @syscap SystemCapability.Multimedia.Image.Core 128 * @crossplatform 129 * @since 10 130 */ 131 /** 132 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 133 * and are stored from the higher-order to the lower-order bits. 134 * 135 * @syscap SystemCapability.Multimedia.Image.Core 136 * @crossplatform 137 * @atomicservice 138 * @since 11 139 */ 140 RGBA_8888 = 3, 141 142 /** 143 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 144 * and are stored from the higher-order to the lower-order bits. 145 * 146 * @syscap SystemCapability.Multimedia.Image.Core 147 * @since 9 148 */ 149 /** 150 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 151 * and are stored from the higher-order to the lower-order bits. 152 * 153 * @syscap SystemCapability.Multimedia.Image.Core 154 * @crossplatform 155 * @since 10 156 */ 157 /** 158 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 159 * and are stored from the higher-order to the lower-order bits. 160 * 161 * @syscap SystemCapability.Multimedia.Image.Core 162 * @crossplatform 163 * @atomicservice 164 * @since 11 165 */ 166 BGRA_8888 = 4, 167 168 /** 169 * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) 170 * and are stored from the higher-order to the lower-order bits. 171 * 172 * @syscap SystemCapability.Multimedia.Image.Core 173 * @since 9 174 */ 175 /** 176 * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) 177 * and are stored from the higher-order to the lower-order bits. 178 * 179 * @syscap SystemCapability.Multimedia.Image.Core 180 * @crossplatform 181 * @since 10 182 */ 183 /** 184 * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) 185 * and are stored from the higher-order to the lower-order bits. 186 * 187 * @syscap SystemCapability.Multimedia.Image.Core 188 * @crossplatform 189 * @atomicservice 190 * @since 11 191 */ 192 RGB_888 = 5, 193 194 /** 195 * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) 196 * and is stored from the higher-order to the lower-order bits. 197 * 198 * @syscap SystemCapability.Multimedia.Image.Core 199 * @since 9 200 */ 201 /** 202 * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) 203 * and is stored from the higher-order to the lower-order bits. 204 * 205 * @syscap SystemCapability.Multimedia.Image.Core 206 * @crossplatform 207 * @since 10 208 */ 209 /** 210 * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) 211 * and is stored from the higher-order to the lower-order bits. 212 * 213 * @syscap SystemCapability.Multimedia.Image.Core 214 * @crossplatform 215 * @atomicservice 216 * @since 11 217 */ 218 ALPHA_8 = 6, 219 220 /** 221 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 222 * and are stored from the higher-order to the lower-order bits in F16. 223 * 224 * @syscap SystemCapability.Multimedia.Image.Core 225 * @since 9 226 */ 227 /** 228 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 229 * and are stored from the higher-order to the lower-order bits in F16. 230 * 231 * @syscap SystemCapability.Multimedia.Image.Core 232 * @crossplatform 233 * @since 10 234 */ 235 /** 236 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 237 * and are stored from the higher-order to the lower-order bits in F16. 238 * 239 * @syscap SystemCapability.Multimedia.Image.Core 240 * @crossplatform 241 * @atomicservice 242 * @since 11 243 */ 244 RGBA_F16 = 7, 245 246 /** 247 * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits 248 * and are stored from the higher-order to the lower-order bits. 249 * 250 * @syscap SystemCapability.Multimedia.Image.Core 251 * @since 9 252 */ 253 /** 254 * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits 255 * and are stored from the higher-order to the lower-order bits. 256 * 257 * @syscap SystemCapability.Multimedia.Image.Core 258 * @crossplatform 259 * @since 10 260 */ 261 /** 262 * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits 263 * and are stored from the higher-order to the lower-order bits. 264 * 265 * @syscap SystemCapability.Multimedia.Image.Core 266 * @crossplatform 267 * @atomicservice 268 * @since 11 269 */ 270 NV21 = 8, 271 272 /** 273 * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits 274 * and are stored from the higher-order to the lower-order bits. 275 * 276 * @syscap SystemCapability.Multimedia.Image.Core 277 * @since 9 278 */ 279 /** 280 * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits 281 * and are stored from the higher-order to the lower-order bits. 282 * 283 * @syscap SystemCapability.Multimedia.Image.Core 284 * @crossplatform 285 * @since 10 286 */ 287 /** 288 * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits 289 * and are stored from the higher-order to the lower-order bits. 290 * 291 * @syscap SystemCapability.Multimedia.Image.Core 292 * @crossplatform 293 * @atomicservice 294 * @since 11 295 */ 296 NV12 = 9 297 } 298 299 /** 300 * Describes the size of an image. 301 * 302 * @typedef Size 303 * @syscap SystemCapability.Multimedia.Image.Core 304 * @since 6 305 */ 306 /** 307 * Describes the size of an image. 308 * 309 * @typedef Size 310 * @syscap SystemCapability.Multimedia.Image.Core 311 * @crossplatform 312 * @since 10 313 */ 314 /** 315 * Describes the size of an image. 316 * 317 * @typedef Size 318 * @syscap SystemCapability.Multimedia.Image.Core 319 * @crossplatform 320 * @atomicservice 321 * @since 11 322 */ 323 interface Size { 324 /** 325 * Height 326 * 327 * @type { number } 328 * @syscap SystemCapability.Multimedia.Image.Core 329 * @since 6 330 */ 331 /** 332 * Height 333 * 334 * @type { number } 335 * @syscap SystemCapability.Multimedia.Image.Core 336 * @crossplatform 337 * @since 10 338 */ 339 /** 340 * Height 341 * 342 * @type { number } 343 * @syscap SystemCapability.Multimedia.Image.Core 344 * @crossplatform 345 * @atomicservice 346 * @since 11 347 */ 348 height: number; 349 350 /** 351 * Width 352 * 353 * @type { number } 354 * @syscap SystemCapability.Multimedia.Image.Core 355 * @since 6 356 */ 357 /** 358 * Width 359 * 360 * @type { number } 361 * @syscap SystemCapability.Multimedia.Image.Core 362 * @crossplatform 363 * @since 10 364 */ 365 /** 366 * Width 367 * 368 * @type { number } 369 * @syscap SystemCapability.Multimedia.Image.Core 370 * @crossplatform 371 * @atomicservice 372 * @since 11 373 */ 374 width: number; 375 } 376 377 /** 378 * Enumerates exchangeable image file format (Exif) information types of an image. 379 * 380 * @enum { string } 381 * @syscap SystemCapability.Multimedia.Image.Core 382 * @since 7 383 */ 384 /** 385 * Enumerates exchangeable image file format (Exif) information types of an image. 386 * 387 * @enum { string } 388 * @syscap SystemCapability.Multimedia.Image.Core 389 * @crossplatform 390 * @since 10 391 */ 392 enum PropertyKey { 393 /** 394 * Number of bits in each pixel of an image. 395 * 396 * @syscap SystemCapability.Multimedia.Image.Core 397 * @since 7 398 */ 399 /** 400 * Number of bits in each pixel of an image. 401 * 402 * @syscap SystemCapability.Multimedia.Image.Core 403 * @crossplatform 404 * @since 10 405 */ 406 BITS_PER_SAMPLE = 'BitsPerSample', 407 408 /** 409 * Image rotation mode. 410 * 411 * @syscap SystemCapability.Multimedia.Image.Core 412 * @since 7 413 */ 414 /** 415 * Image rotation mode. 416 * 417 * @syscap SystemCapability.Multimedia.Image.Core 418 * @crossplatform 419 * @since 10 420 */ 421 ORIENTATION = 'Orientation', 422 423 /** 424 * Image length. 425 * 426 * @syscap SystemCapability.Multimedia.Image.Core 427 * @since 7 428 */ 429 /** 430 * Image length. 431 * 432 * @syscap SystemCapability.Multimedia.Image.Core 433 * @crossplatform 434 * @since 10 435 */ 436 IMAGE_LENGTH = 'ImageLength', 437 438 /** 439 * Image width. 440 * 441 * @syscap SystemCapability.Multimedia.Image.Core 442 * @since 7 443 */ 444 /** 445 * Image width. 446 * 447 * @syscap SystemCapability.Multimedia.Image.Core 448 * @crossplatform 449 * @since 10 450 */ 451 IMAGE_WIDTH = 'ImageWidth', 452 453 /** 454 * GPS latitude. 455 * 456 * @syscap SystemCapability.Multimedia.Image.Core 457 * @since 7 458 */ 459 /** 460 * GPS latitude. 461 * 462 * @syscap SystemCapability.Multimedia.Image.Core 463 * @crossplatform 464 * @since 10 465 */ 466 GPS_LATITUDE = 'GPSLatitude', 467 468 /** 469 * GPS longitude. 470 * 471 * @syscap SystemCapability.Multimedia.Image.Core 472 * @since 7 473 */ 474 /** 475 * GPS longitude. 476 * 477 * @syscap SystemCapability.Multimedia.Image.Core 478 * @crossplatform 479 * @since 10 480 */ 481 GPS_LONGITUDE = 'GPSLongitude', 482 483 /** 484 * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude. 485 * 486 * @syscap SystemCapability.Multimedia.Image.Core 487 * @since 7 488 */ 489 /** 490 * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude. 491 * 492 * @syscap SystemCapability.Multimedia.Image.Core 493 * @crossplatform 494 * @since 10 495 */ 496 GPS_LATITUDE_REF = 'GPSLatitudeRef', 497 498 /** 499 * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude. 500 * 501 * @syscap SystemCapability.Multimedia.Image.Core 502 * @since 7 503 */ 504 /** 505 * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude. 506 * 507 * @syscap SystemCapability.Multimedia.Image.Core 508 * @crossplatform 509 * @since 10 510 */ 511 GPS_LONGITUDE_REF = 'GPSLongitudeRef', 512 513 /** 514 * Shooting time 515 * 516 * @syscap SystemCapability.Multimedia.Image.Core 517 * @since 9 518 */ 519 /** 520 * Shooting time 521 * 522 * @syscap SystemCapability.Multimedia.Image.Core 523 * @crossplatform 524 * @since 10 525 */ 526 DATE_TIME_ORIGINAL = 'DateTimeOriginal', 527 528 /** 529 * Exposure time 530 * 531 * @syscap SystemCapability.Multimedia.Image.Core 532 * @since 9 533 */ 534 /** 535 * Exposure time 536 * 537 * @syscap SystemCapability.Multimedia.Image.Core 538 * @crossplatform 539 * @since 10 540 */ 541 EXPOSURE_TIME = 'ExposureTime', 542 543 /** 544 * Scene type 545 * 546 * @syscap SystemCapability.Multimedia.Image.Core 547 * @since 9 548 */ 549 /** 550 * Scene type 551 * 552 * @syscap SystemCapability.Multimedia.Image.Core 553 * @crossplatform 554 * @since 10 555 */ 556 SCENE_TYPE = 'SceneType', 557 558 /** 559 * ISO speedratings 560 * 561 * @syscap SystemCapability.Multimedia.Image.Core 562 * @since 9 563 */ 564 /** 565 * ISO speedratings 566 * 567 * @syscap SystemCapability.Multimedia.Image.Core 568 * @crossplatform 569 * @since 10 570 */ 571 ISO_SPEED_RATINGS = 'ISOSpeedRatings', 572 573 /** 574 * Aperture value 575 * 576 * @syscap SystemCapability.Multimedia.Image.Core 577 * @since 9 578 */ 579 /** 580 * Aperture value 581 * 582 * @syscap SystemCapability.Multimedia.Image.Core 583 * @crossplatform 584 * @since 10 585 */ 586 F_NUMBER = 'FNumber', 587 588 /** 589 * Date time 590 * 591 * @syscap SystemCapability.Multimedia.Image.Core 592 * @since 10 593 */ 594 DATE_TIME = 'DateTime', 595 596 /** 597 * GPS time stamp 598 * 599 * @syscap SystemCapability.Multimedia.Image.Core 600 * @since 10 601 */ 602 GPS_TIME_STAMP = 'GPSTimeStamp', 603 604 /** 605 * GPS date stamp 606 * 607 * @syscap SystemCapability.Multimedia.Image.Core 608 * @since 10 609 */ 610 GPS_DATE_STAMP = 'GPSDateStamp', 611 612 /** 613 * Image description 614 * 615 * @syscap SystemCapability.Multimedia.Image.Core 616 * @since 10 617 */ 618 IMAGE_DESCRIPTION = 'ImageDescription', 619 620 /** 621 * Make 622 * 623 * @syscap SystemCapability.Multimedia.Image.Core 624 * @since 10 625 */ 626 MAKE = 'Make', 627 628 /** 629 * Model 630 * 631 * @syscap SystemCapability.Multimedia.Image.Core 632 * @since 10 633 */ 634 MODEL = 'Model', 635 636 /** 637 * Photo mode 638 * 639 * @syscap SystemCapability.Multimedia.Image.Core 640 * @since 10 641 */ 642 PHOTO_MODE = 'PhotoMode', 643 644 /** 645 * Sensitivity type 646 * 647 * @syscap SystemCapability.Multimedia.Image.Core 648 * @since 10 649 */ 650 SENSITIVITY_TYPE = 'SensitivityType', 651 652 /** 653 * Standard output sensitivity 654 * 655 * @syscap SystemCapability.Multimedia.Image.Core 656 * @since 10 657 */ 658 STANDARD_OUTPUT_SENSITIVITY = 'StandardOutputSensitivity', 659 660 /** 661 * Recommended exposure index 662 * 663 * @syscap SystemCapability.Multimedia.Image.Core 664 * @since 10 665 */ 666 RECOMMENDED_EXPOSURE_INDEX = 'RecommendedExposureIndex', 667 668 /** 669 * ISO speed 670 * 671 * @syscap SystemCapability.Multimedia.Image.Core 672 * @since 10 673 */ 674 ISO_SPEED = 'ISOSpeedRatings', 675 676 /** 677 * Aperture value 678 * 679 * @syscap SystemCapability.Multimedia.Image.Core 680 * @since 10 681 */ 682 APERTURE_VALUE = 'ApertureValue', 683 684 /** 685 * Exposure bias value 686 * 687 * @syscap SystemCapability.Multimedia.Image.Core 688 * @since 10 689 */ 690 EXPOSURE_BIAS_VALUE = 'ExposureBiasValue', 691 692 /** 693 * Metering mode 694 * 695 * @syscap SystemCapability.Multimedia.Image.Core 696 * @since 10 697 */ 698 METERING_MODE = 'MeteringMode', 699 700 /** 701 * Light source 702 * 703 * @syscap SystemCapability.Multimedia.Image.Core 704 * @since 10 705 */ 706 LIGHT_SOURCE = 'LightSource', 707 708 /** 709 * Flash 710 * 711 * @syscap SystemCapability.Multimedia.Image.Core 712 * @since 10 713 */ 714 FLASH = 'Flash', 715 716 /** 717 * Focal length 718 * 719 * @syscap SystemCapability.Multimedia.Image.Core 720 * @since 10 721 */ 722 FOCAL_LENGTH = 'FocalLength', 723 724 /** 725 * User comment 726 * 727 * @syscap SystemCapability.Multimedia.Image.Core 728 * @since 10 729 */ 730 USER_COMMENT = 'UserComment', 731 732 /** 733 * Pixel x dimension 734 * 735 * @syscap SystemCapability.Multimedia.Image.Core 736 * @since 10 737 */ 738 PIXEL_X_DIMENSION = 'PixelXDimension', 739 740 /** 741 * Pixel y dimension 742 * 743 * @syscap SystemCapability.Multimedia.Image.Core 744 * @since 10 745 */ 746 PIXEL_Y_DIMENSION = 'PixelYDimension', 747 748 /** 749 * White balance 750 * 751 * @syscap SystemCapability.Multimedia.Image.Core 752 * @since 10 753 */ 754 WHITE_BALANCE = 'WhiteBalance', 755 756 /** 757 * Focal length in 35mm film 758 * 759 * @syscap SystemCapability.Multimedia.Image.Core 760 * @since 10 761 */ 762 FOCAL_LENGTH_IN_35_MM_FILM = 'FocalLengthIn35mmFilm', 763 764 /** 765 * Capture mode 766 * 767 * @syscap SystemCapability.Multimedia.Image.Core 768 * @since 10 769 */ 770 CAPTURE_MODE = 'HwMnoteCaptureMode', 771 772 /** 773 * Physical aperture 774 * 775 * @syscap SystemCapability.Multimedia.Image.Core 776 * @since 10 777 */ 778 PHYSICAL_APERTURE = 'HwMnotePhysicalAperture', 779 780 /** 781 * Roll Angle 782 * 783 * @syscap SystemCapability.Multimedia.Image.Core 784 * @crossplatform 785 * @since 11 786 */ 787 ROLL_ANGLE = 'HwMnoteRollAngle', 788 789 /** 790 * Pitch Angle 791 * 792 * @syscap SystemCapability.Multimedia.Image.Core 793 * @crossplatform 794 * @since 11 795 */ 796 PITCH_ANGLE = 'HwMnotePitchAngle', 797 798 /** 799 * Capture Scene: Food 800 * 801 * @syscap SystemCapability.Multimedia.Image.Core 802 * @crossplatform 803 * @since 11 804 */ 805 SCENE_FOOD_CONF = 'HwMnoteSceneFoodConf', 806 807 /** 808 * Capture Scene: Stage 809 * 810 * @syscap SystemCapability.Multimedia.Image.Core 811 * @crossplatform 812 * @since 11 813 */ 814 SCENE_STAGE_CONF = 'HwMnoteSceneStageConf', 815 816 /** 817 * Capture Scene: Blue Sky 818 * 819 * @syscap SystemCapability.Multimedia.Image.Core 820 * @crossplatform 821 * @since 11 822 */ 823 SCENE_BLUE_SKY_CONF = 'HwMnoteSceneBlueSkyConf', 824 825 /** 826 * Capture Scene: Green Plant 827 * 828 * @syscap SystemCapability.Multimedia.Image.Core 829 * @crossplatform 830 * @since 11 831 */ 832 SCENE_GREEN_PLANT_CONF = 'HwMnoteSceneGreenPlantConf', 833 834 /** 835 * Capture Scene: Beach 836 * 837 * @syscap SystemCapability.Multimedia.Image.Core 838 * @crossplatform 839 * @since 11 840 */ 841 SCENE_BEACH_CONF = 'HwMnoteSceneBeachConf', 842 843 /** 844 * Capture Scene: Snow 845 * 846 * @syscap SystemCapability.Multimedia.Image.Core 847 * @crossplatform 848 * @since 11 849 */ 850 SCENE_SNOW_CONF = 'HwMnoteSceneSnowConf', 851 852 /** 853 * Capture Scene: Sunset 854 * 855 * @syscap SystemCapability.Multimedia.Image.Core 856 * @crossplatform 857 * @since 11 858 */ 859 SCENE_SUNSET_CONF = 'HwMnoteSceneSunsetConf', 860 861 /** 862 * Capture Scene: Flowers 863 * 864 * @syscap SystemCapability.Multimedia.Image.Core 865 * @crossplatform 866 * @since 11 867 */ 868 SCENE_FLOWERS_CONF = 'HwMnoteSceneFlowersConf', 869 870 /** 871 * Capture Scene: Night 872 * 873 * @syscap SystemCapability.Multimedia.Image.Core 874 * @crossplatform 875 * @since 11 876 */ 877 SCENE_NIGHT_CONF = 'HwMnoteSceneNightConf', 878 879 /** 880 * Capture Scene: Text 881 * 882 * @syscap SystemCapability.Multimedia.Image.Core 883 * @crossplatform 884 * @since 11 885 */ 886 SCENE_TEXT_CONF = 'HwMnoteSceneTextConf', 887 888 /** 889 * Face Count 890 * 891 * @syscap SystemCapability.Multimedia.Image.Core 892 * @crossplatform 893 * @since 11 894 */ 895 FACE_COUNT = 'HwMnoteFaceCount', 896 897 /** 898 * Focus Mode 899 * 900 * @syscap SystemCapability.Multimedia.Image.Core 901 * @crossplatform 902 * @since 11 903 */ 904 FOCUS_MODE = 'HwMnoteFocusMode' 905 } 906 907 /** 908 * Enum for image formats. 909 * 910 * @enum { number } 911 * @syscap SystemCapability.Multimedia.Image.Core 912 * @since 9 913 */ 914 enum ImageFormat { 915 /** 916 * YCBCR422 semi-planar format. 917 * 918 * @syscap SystemCapability.Multimedia.Image.Core 919 * @since 9 920 */ 921 YCBCR_422_SP = 1000, 922 923 /** 924 * JPEG encoding format. 925 * 926 * @syscap SystemCapability.Multimedia.Image.Core 927 * @since 9 928 */ 929 JPEG = 2000 930 } 931 932 /** 933 * Enumerates alpha types. 934 * 935 * @enum { number } 936 * @syscap SystemCapability.Multimedia.Image.Core 937 * @since 9 938 */ 939 /** 940 * Enumerates alpha types. 941 * 942 * @enum { number } 943 * @syscap SystemCapability.Multimedia.Image.Core 944 * @crossplatform 945 * @since 10 946 */ 947 /** 948 * Enumerates alpha types. 949 * 950 * @enum { number } 951 * @syscap SystemCapability.Multimedia.Image.Core 952 * @crossplatform 953 * @atomicservice 954 * @since 11 955 */ 956 enum AlphaType { 957 /** 958 * Indicates an unknown alpha type. 959 * 960 * @syscap SystemCapability.Multimedia.Image.Core 961 * @since 9 962 */ 963 /** 964 * Indicates an unknown alpha type. 965 * 966 * @syscap SystemCapability.Multimedia.Image.Core 967 * @crossplatform 968 * @since 10 969 */ 970 /** 971 * Indicates an unknown alpha type. 972 * 973 * @syscap SystemCapability.Multimedia.Image.Core 974 * @crossplatform 975 * @atomicservice 976 * @since 11 977 */ 978 UNKNOWN = 0, 979 980 /** 981 * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. 982 * 983 * @syscap SystemCapability.Multimedia.Image.Core 984 * @since 9 985 */ 986 /** 987 * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. 988 * 989 * @syscap SystemCapability.Multimedia.Image.Core 990 * @crossplatform 991 * @since 10 992 */ 993 /** 994 * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. 995 * 996 * @syscap SystemCapability.Multimedia.Image.Core 997 * @crossplatform 998 * @atomicservice 999 * @since 11 1000 */ 1001 OPAQUE = 1, 1002 1003 /** 1004 * Indicates that RGB components of each pixel in the image are premultiplied by alpha. 1005 * 1006 * @syscap SystemCapability.Multimedia.Image.Core 1007 * @since 9 1008 */ 1009 /** 1010 * Indicates that RGB components of each pixel in the image are premultiplied by alpha. 1011 * 1012 * @syscap SystemCapability.Multimedia.Image.Core 1013 * @crossplatform 1014 * @since 10 1015 */ 1016 /** 1017 * Indicates that RGB components of each pixel in the image are premultiplied by alpha. 1018 * 1019 * @syscap SystemCapability.Multimedia.Image.Core 1020 * @crossplatform 1021 * @atomicservice 1022 * @since 11 1023 */ 1024 PREMUL = 2, 1025 1026 /** 1027 * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. 1028 * 1029 * @syscap SystemCapability.Multimedia.Image.Core 1030 * @since 9 1031 */ 1032 /** 1033 * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. 1034 * 1035 * @syscap SystemCapability.Multimedia.Image.Core 1036 * @crossplatform 1037 * @since 10 1038 */ 1039 /** 1040 * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. 1041 * 1042 * @syscap SystemCapability.Multimedia.Image.Core 1043 * @crossplatform 1044 * @atomicservice 1045 * @since 11 1046 */ 1047 UNPREMUL = 3 1048 } 1049 1050 /** 1051 * Enum for image scale mode. 1052 * 1053 * @enum { number } 1054 * @syscap SystemCapability.Multimedia.Image.Core 1055 * @since 9 1056 */ 1057 /** 1058 * Enum for image scale mode. 1059 * 1060 * @enum { number } 1061 * @syscap SystemCapability.Multimedia.Image.Core 1062 * @crossplatform 1063 * @since 10 1064 */ 1065 /** 1066 * Enum for image scale mode. 1067 * 1068 * @enum { number } 1069 * @syscap SystemCapability.Multimedia.Image.Core 1070 * @crossplatform 1071 * @atomicservice 1072 * @since 11 1073 */ 1074 enum ScaleMode { 1075 /** 1076 * Indicates the effect that fits the image into the target size. 1077 * 1078 * @syscap SystemCapability.Multimedia.Image.Core 1079 * @since 9 1080 */ 1081 /** 1082 * Indicates the effect that fits the image into the target size. 1083 * 1084 * @syscap SystemCapability.Multimedia.Image.Core 1085 * @crossplatform 1086 * @since 10 1087 */ 1088 /** 1089 * Indicates the effect that fits the image into the target size. 1090 * 1091 * @syscap SystemCapability.Multimedia.Image.Core 1092 * @crossplatform 1093 * @atomicservice 1094 * @since 11 1095 */ 1096 FIT_TARGET_SIZE = 0, 1097 1098 /** 1099 * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. 1100 * 1101 * @syscap SystemCapability.Multimedia.Image.Core 1102 * @since 9 1103 */ 1104 /** 1105 * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. 1106 * 1107 * @syscap SystemCapability.Multimedia.Image.Core 1108 * @crossplatform 1109 * @since 10 1110 */ 1111 /** 1112 * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. 1113 * 1114 * @syscap SystemCapability.Multimedia.Image.Core 1115 * @crossplatform 1116 * @atomicservice 1117 * @since 11 1118 */ 1119 CENTER_CROP = 1 1120 } 1121 1122 /** 1123 * The component type of image. 1124 * 1125 * @enum { number } 1126 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 1127 * @since 9 1128 */ 1129 enum ComponentType { 1130 /** 1131 * Luma info. 1132 * 1133 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 1134 * @since 9 1135 */ 1136 YUV_Y = 1, 1137 1138 /** 1139 * Chrominance info. 1140 * 1141 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 1142 * @since 9 1143 */ 1144 YUV_U = 2, 1145 1146 /** 1147 * Chroma info. 1148 * 1149 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 1150 * @since 9 1151 */ 1152 YUV_V = 3, 1153 1154 /** 1155 * Jpeg type. 1156 * 1157 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 1158 * @since 9 1159 */ 1160 JPEG = 4 1161 } 1162 1163 /** 1164 * Describes region information. 1165 * 1166 * @typedef Region 1167 * @syscap SystemCapability.Multimedia.Image.Core 1168 * @since 8 1169 */ 1170 /** 1171 * Describes region information. 1172 * 1173 * @typedef Region 1174 * @syscap SystemCapability.Multimedia.Image.Core 1175 * @crossplatform 1176 * @since 10 1177 */ 1178 /** 1179 * Describes region information. 1180 * 1181 * @typedef Region 1182 * @syscap SystemCapability.Multimedia.Image.Core 1183 * @crossplatform 1184 * @atomicservice 1185 * @since 11 1186 */ 1187 interface Region { 1188 /** 1189 * Image size. 1190 * 1191 * @type { Size } 1192 * @syscap SystemCapability.Multimedia.Image.Core 1193 * @since 7 1194 */ 1195 /** 1196 * Image size. 1197 * 1198 * @type { Size } 1199 * @syscap SystemCapability.Multimedia.Image.Core 1200 * @crossplatform 1201 * @since 10 1202 */ 1203 /** 1204 * Image size. 1205 * 1206 * @type { Size } 1207 * @syscap SystemCapability.Multimedia.Image.Core 1208 * @crossplatform 1209 * @atomicservice 1210 * @since 11 1211 */ 1212 size: Size; 1213 1214 /** 1215 * x-coordinate at the upper left corner of the image. 1216 * 1217 * @type { number } 1218 * @syscap SystemCapability.Multimedia.Image.Core 1219 * @since 7 1220 */ 1221 /** 1222 * x-coordinate at the upper left corner of the image. 1223 * 1224 * @type { number } 1225 * @syscap SystemCapability.Multimedia.Image.Core 1226 * @crossplatform 1227 * @since 10 1228 */ 1229 /** 1230 * x-coordinate at the upper left corner of the image. 1231 * 1232 * @type { number } 1233 * @syscap SystemCapability.Multimedia.Image.Core 1234 * @crossplatform 1235 * @atomicservice 1236 * @since 11 1237 */ 1238 x: number; 1239 1240 /** 1241 * y-coordinate at the upper left corner of the image. 1242 * 1243 * @type { number } 1244 * @syscap SystemCapability.Multimedia.Image.Core 1245 * @since 7 1246 */ 1247 /** 1248 * y-coordinate at the upper left corner of the image. 1249 * 1250 * @type { number } 1251 * @syscap SystemCapability.Multimedia.Image.Core 1252 * @crossplatform 1253 * @since 10 1254 */ 1255 /** 1256 * y-coordinate at the upper left corner of the image. 1257 * 1258 * @type { number } 1259 * @syscap SystemCapability.Multimedia.Image.Core 1260 * @crossplatform 1261 * @atomicservice 1262 * @since 11 1263 */ 1264 y: number; 1265 } 1266 1267 /** 1268 * Describes area information in an image. 1269 * 1270 * @typedef PositionArea 1271 * @syscap SystemCapability.Multimedia.Image.Core 1272 * @since 7 1273 */ 1274 /** 1275 * Describes area information in an image. 1276 * 1277 * @typedef PositionArea 1278 * @syscap SystemCapability.Multimedia.Image.Core 1279 * @crossplatform 1280 * @since 10 1281 */ 1282 /** 1283 * Describes area information in an image. 1284 * 1285 * @typedef PositionArea 1286 * @syscap SystemCapability.Multimedia.Image.Core 1287 * @crossplatform 1288 * @atomicservice 1289 * @since 11 1290 */ 1291 interface PositionArea { 1292 /** 1293 * Image data that will be read or written. 1294 * 1295 * @type { ArrayBuffer } 1296 * @syscap SystemCapability.Multimedia.Image.Core 1297 * @since 7 1298 */ 1299 /** 1300 * Image data that will be read or written. 1301 * 1302 * @type { ArrayBuffer } 1303 * @syscap SystemCapability.Multimedia.Image.Core 1304 * @crossplatform 1305 * @since 10 1306 */ 1307 /** 1308 * Image data that will be read or written. 1309 * 1310 * @type { ArrayBuffer } 1311 * @syscap SystemCapability.Multimedia.Image.Core 1312 * @crossplatform 1313 * @atomicservice 1314 * @since 11 1315 */ 1316 pixels: ArrayBuffer; 1317 1318 /** 1319 * Offset for data reading. 1320 * 1321 * @type { number } 1322 * @syscap SystemCapability.Multimedia.Image.Core 1323 * @since 7 1324 */ 1325 /** 1326 * Offset for data reading. 1327 * 1328 * @type { number } 1329 * @syscap SystemCapability.Multimedia.Image.Core 1330 * @crossplatform 1331 * @since 10 1332 */ 1333 /** 1334 * Offset for data reading. 1335 * 1336 * @type { number } 1337 * @syscap SystemCapability.Multimedia.Image.Core 1338 * @crossplatform 1339 * @atomicservice 1340 * @since 11 1341 */ 1342 offset: number; 1343 1344 /** 1345 * Number of bytes to read. 1346 * 1347 * @type { number } 1348 * @syscap SystemCapability.Multimedia.Image.Core 1349 * @since 7 1350 */ 1351 /** 1352 * Number of bytes to read. 1353 * 1354 * @type { number } 1355 * @syscap SystemCapability.Multimedia.Image.Core 1356 * @crossplatform 1357 * @since 10 1358 */ 1359 /** 1360 * Number of bytes to read. 1361 * 1362 * @type { number } 1363 * @syscap SystemCapability.Multimedia.Image.Core 1364 * @crossplatform 1365 * @atomicservice 1366 * @since 11 1367 */ 1368 stride: number; 1369 1370 /** 1371 * Region to read. 1372 * 1373 * @type { Region } 1374 * @syscap SystemCapability.Multimedia.Image.Core 1375 * @since 7 1376 */ 1377 /** 1378 * Region to read. 1379 * 1380 * @type { Region } 1381 * @syscap SystemCapability.Multimedia.Image.Core 1382 * @crossplatform 1383 * @since 10 1384 */ 1385 /** 1386 * Region to read. 1387 * 1388 * @type { Region } 1389 * @syscap SystemCapability.Multimedia.Image.Core 1390 * @crossplatform 1391 * @atomicservice 1392 * @since 11 1393 */ 1394 region: Region; 1395 } 1396 1397 /** 1398 * Describes image information. 1399 * 1400 * @typedef ImageInfo 1401 * @syscap SystemCapability.Multimedia.Image.Core 1402 * @since 6 1403 */ 1404 /** 1405 * Describes image information. 1406 * 1407 * @typedef ImageInfo 1408 * @syscap SystemCapability.Multimedia.Image.Core 1409 * @crossplatform 1410 * @since 10 1411 */ 1412 /** 1413 * Describes image information. 1414 * 1415 * @typedef ImageInfo 1416 * @syscap SystemCapability.Multimedia.Image.Core 1417 * @crossplatform 1418 * @atomicservice 1419 * @since 11 1420 */ 1421 interface ImageInfo { 1422 /** 1423 * Indicates image dimensions specified by a {@link Size} interface. 1424 * 1425 * @type { Size } 1426 * @syscap SystemCapability.Multimedia.Image.Core 1427 * @since 6 1428 */ 1429 /** 1430 * Indicates image dimensions specified by a {@link Size} interface. 1431 * 1432 * @type { Size } 1433 * @syscap SystemCapability.Multimedia.Image.Core 1434 * @crossplatform 1435 * @since 10 1436 */ 1437 /** 1438 * Indicates image dimensions specified by a {@link Size} interface. 1439 * 1440 * @type { Size } 1441 * @syscap SystemCapability.Multimedia.Image.Core 1442 * @crossplatform 1443 * @atomicservice 1444 * @since 11 1445 */ 1446 size: Size; 1447 1448 /** 1449 * Indicates image default density. 1450 * 1451 * @type { number } 1452 * @syscap SystemCapability.Multimedia.Image.Core 1453 * @since 9 1454 */ 1455 /** 1456 * Indicates image default density. 1457 * 1458 * @type { number } 1459 * @syscap SystemCapability.Multimedia.Image.Core 1460 * @crossplatform 1461 * @since 10 1462 */ 1463 /** 1464 * Indicates image default density. 1465 * 1466 * @type { number } 1467 * @syscap SystemCapability.Multimedia.Image.Core 1468 * @crossplatform 1469 * @atomicservice 1470 * @since 11 1471 */ 1472 density: number; 1473 1474 /** 1475 * The number of byte per row. 1476 * 1477 * @type { number } 1478 * @syscap SystemCapability.Multimedia.Image.Core 1479 * @atomicservice 1480 * @since 11 1481 */ 1482 stride: number; 1483 } 1484 1485 /** 1486 * Describes the option for image packing. 1487 * 1488 * @typedef PackingOption 1489 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1490 * @since 6 1491 */ 1492 /** 1493 * Describes the option for image packing. 1494 * 1495 * @typedef PackingOption 1496 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1497 * @crossplatform 1498 * @since 10 1499 */ 1500 /** 1501 * Describes the option for image packing. 1502 * 1503 * @typedef PackingOption 1504 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1505 * @crossplatform 1506 * @atomicservice 1507 * @since 11 1508 */ 1509 interface PackingOption { 1510 /** 1511 * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. 1512 * 1513 * @type { string } 1514 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1515 * @since 6 1516 */ 1517 /** 1518 * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. 1519 * 1520 * @type { string } 1521 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1522 * @crossplatform 1523 * @since 10 1524 */ 1525 /** 1526 * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. 1527 * 1528 * @type { string } 1529 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1530 * @crossplatform 1531 * @atomicservice 1532 * @since 11 1533 */ 1534 format: string; 1535 1536 /** 1537 * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. 1538 * 1539 * @type { number } 1540 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1541 * @since 6 1542 */ 1543 /** 1544 * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. 1545 * 1546 * @type { number } 1547 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1548 * @crossplatform 1549 * @since 10 1550 */ 1551 /** 1552 * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. 1553 * 1554 * @type { number } 1555 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1556 * @crossplatform 1557 * @atomicservice 1558 * @since 11 1559 */ 1560 quality: number; 1561 1562 /** 1563 * BufferSize of the target image. 1564 * If this bufferSize is less than or equal to 0, it will be converted to 10MB. 1565 * 1566 * @type { ?number } 1567 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1568 * @since 9 1569 */ 1570 /** 1571 * BufferSize of the target image. 1572 * If this bufferSize is less than or equal to 0, it will be converted to 10MB. 1573 * 1574 * @type { ?number } 1575 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1576 * @crossplatform 1577 * @since 10 1578 */ 1579 /** 1580 * BufferSize of the target image. 1581 * If this bufferSize is less than or equal to 0, it will be converted to 10MB. 1582 * 1583 * @type { ?number } 1584 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1585 * @crossplatform 1586 * @atomicservice 1587 * @since 11 1588 */ 1589 bufferSize?: number; 1590 } 1591 1592 /** 1593 * Describes image properties. 1594 * 1595 * @typedef GetImagePropertyOptions 1596 * @syscap SystemCapability.Multimedia.Image.ImageSource 1597 * @since 7 1598 * @deprecated since 11 1599 * @useinstead image.ImagePropertyOptions 1600 */ 1601 /** 1602 * Describes image properties. 1603 * 1604 * @typedef GetImagePropertyOptions 1605 * @syscap SystemCapability.Multimedia.Image.ImageSource 1606 * @crossplatform 1607 * @since 10 1608 * @deprecated since 11 1609 * @useinstead image.ImagePropertyOptions 1610 */ 1611 interface GetImagePropertyOptions { 1612 /** 1613 * Index of an image. 1614 * 1615 * @type { ?number } 1616 * @syscap SystemCapability.Multimedia.Image.ImageSource 1617 * @since 7 1618 * @deprecated since 11 1619 * @useinstead image.ImagePropertyOptions#index 1620 */ 1621 /** 1622 * Index of an image. 1623 * 1624 * @type { ?number } 1625 * @syscap SystemCapability.Multimedia.Image.ImageSource 1626 * @crossplatform 1627 * @since 10 1628 * @deprecated since 11 1629 * @useinstead image.ImagePropertyOptions#index 1630 */ 1631 index?: number; 1632 1633 /** 1634 * Default property value. 1635 * 1636 * @type { ?string } 1637 * @syscap SystemCapability.Multimedia.Image.ImageSource 1638 * @since 7 1639 * @deprecated since 11 1640 * @useinstead image.ImagePropertyOptions#defaultValue 1641 */ 1642 /** 1643 * Default property value. 1644 * 1645 * @type { ?string } 1646 * @syscap SystemCapability.Multimedia.Image.ImageSource 1647 * @crossplatform 1648 * @since 10 1649 * @deprecated since 11 1650 * @useinstead image.ImagePropertyOptions#defaultValue 1651 */ 1652 defaultValue?: string; 1653 } 1654 1655 /** 1656 * Describes image properties. 1657 * 1658 * @typedef ImagePropertyOptions 1659 * @syscap SystemCapability.Multimedia.Image.ImageSource 1660 * @crossplatform 1661 * @since 11 1662 */ 1663 interface ImagePropertyOptions { 1664 /** 1665 * Index of an image. 1666 * 1667 * @type { ?number } 1668 * @syscap SystemCapability.Multimedia.Image.ImageSource 1669 * @crossplatform 1670 * @since 11 1671 */ 1672 index?: number; 1673 1674 /** 1675 * Default property value. 1676 * 1677 * @type { ?string } 1678 * @syscap SystemCapability.Multimedia.Image.ImageSource 1679 * @crossplatform 1680 * @since 11 1681 */ 1682 defaultValue?: string; 1683 } 1684 1685 /** 1686 * Describes image decoding parameters. 1687 * 1688 * @typedef DecodingOptions 1689 * @syscap SystemCapability.Multimedia.Image.ImageSource 1690 * @since 7 1691 */ 1692 /** 1693 * Describes image decoding parameters. 1694 * 1695 * @typedef DecodingOptions 1696 * @syscap SystemCapability.Multimedia.Image.ImageSource 1697 * @crossplatform 1698 * @since 10 1699 */ 1700 /** 1701 * Describes image decoding parameters. 1702 * 1703 * @typedef DecodingOptions 1704 * @syscap SystemCapability.Multimedia.Image.ImageSource 1705 * @crossplatform 1706 * @atomicservice 1707 * @since 11 1708 */ 1709 interface DecodingOptions { 1710 /** 1711 * Number of image frames. 1712 * 1713 * @type { ?number } 1714 * @syscap SystemCapability.Multimedia.Image.ImageSource 1715 * @since 7 1716 */ 1717 /** 1718 * Number of image frames. 1719 * 1720 * @type { ?number } 1721 * @syscap SystemCapability.Multimedia.Image.ImageSource 1722 * @crossplatform 1723 * @since 10 1724 */ 1725 /** 1726 * Number of image frames. 1727 * 1728 * @type { ?number } 1729 * @syscap SystemCapability.Multimedia.Image.ImageSource 1730 * @crossplatform 1731 * @atomicservice 1732 * @since 11 1733 */ 1734 index?: number; 1735 1736 /** 1737 * Sampling ratio of the image pixel map. 1738 * 1739 * @type { ?number } 1740 * @syscap SystemCapability.Multimedia.Image.ImageSource 1741 * @since 7 1742 */ 1743 /** 1744 * Sampling ratio of the image pixel map. 1745 * 1746 * @type { ?number } 1747 * @syscap SystemCapability.Multimedia.Image.ImageSource 1748 * @crossplatform 1749 * @since 10 1750 */ 1751 /** 1752 * Sampling ratio of the image pixel map. 1753 * 1754 * @type { ?number } 1755 * @syscap SystemCapability.Multimedia.Image.ImageSource 1756 * @crossplatform 1757 * @atomicservice 1758 * @since 11 1759 */ 1760 sampleSize?: number; 1761 1762 /** 1763 * Rotation angle of the image pixel map. The value ranges from 0 to 360. 1764 * 1765 * @type { ?number } 1766 * @syscap SystemCapability.Multimedia.Image.ImageSource 1767 * @since 7 1768 */ 1769 /** 1770 * Rotation angle of the image pixel map. The value ranges from 0 to 360. 1771 * 1772 * @type { ?number } 1773 * @syscap SystemCapability.Multimedia.Image.ImageSource 1774 * @crossplatform 1775 * @since 10 1776 */ 1777 /** 1778 * Rotation angle of the image pixel map. The value ranges from 0 to 360. 1779 * 1780 * @type { ?number } 1781 * @syscap SystemCapability.Multimedia.Image.ImageSource 1782 * @crossplatform 1783 * @atomicservice 1784 * @since 11 1785 */ 1786 rotate?: number; 1787 1788 /** 1789 * Whether the image pixel map is editable. 1790 * 1791 * @type { ?boolean } 1792 * @syscap SystemCapability.Multimedia.Image.ImageSource 1793 * @since 7 1794 */ 1795 /** 1796 * Whether the image pixel map is editable. 1797 * 1798 * @type { ?boolean } 1799 * @syscap SystemCapability.Multimedia.Image.ImageSource 1800 * @crossplatform 1801 * @since 10 1802 */ 1803 /** 1804 * Whether the image pixel map is editable. 1805 * 1806 * @type { ?boolean } 1807 * @syscap SystemCapability.Multimedia.Image.ImageSource 1808 * @crossplatform 1809 * @atomicservice 1810 * @since 11 1811 */ 1812 editable?: boolean; 1813 1814 /** 1815 * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded 1816 * based on the original image size. 1817 * 1818 * @type { ?Size } 1819 * @syscap SystemCapability.Multimedia.Image.ImageSource 1820 * @since 7 1821 */ 1822 /** 1823 * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded 1824 * based on the original image size. 1825 * 1826 * @type { ?Size } 1827 * @syscap SystemCapability.Multimedia.Image.ImageSource 1828 * @crossplatform 1829 * @since 10 1830 */ 1831 /** 1832 * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded 1833 * based on the original image size. 1834 * 1835 * @type { ?Size } 1836 * @syscap SystemCapability.Multimedia.Image.ImageSource 1837 * @crossplatform 1838 * @atomicservice 1839 * @since 11 1840 */ 1841 desiredSize?: Size; 1842 1843 /** 1844 * Cropping region of the image pixel map. 1845 * 1846 * @type { ?Region } 1847 * @syscap SystemCapability.Multimedia.Image.ImageSource 1848 * @since 7 1849 */ 1850 /** 1851 * Cropping region of the image pixel map. 1852 * 1853 * @type { ?Region } 1854 * @syscap SystemCapability.Multimedia.Image.ImageSource 1855 * @crossplatform 1856 * @since 10 1857 */ 1858 /** 1859 * Cropping region of the image pixel map. 1860 * 1861 * @type { ?Region } 1862 * @syscap SystemCapability.Multimedia.Image.ImageSource 1863 * @crossplatform 1864 * @atomicservice 1865 * @since 11 1866 */ 1867 desiredRegion?: Region; 1868 1869 /** 1870 * Data format of the image pixel map. 1871 * 1872 * @type { ?PixelMapFormat } 1873 * @syscap SystemCapability.Multimedia.Image.ImageSource 1874 * @since 7 1875 */ 1876 /** 1877 * Data format of the image pixel map. 1878 * 1879 * @type { ?PixelMapFormat } 1880 * @syscap SystemCapability.Multimedia.Image.ImageSource 1881 * @crossplatform 1882 * @since 10 1883 */ 1884 /** 1885 * Data format of the image pixel map. 1886 * 1887 * @type { ?PixelMapFormat } 1888 * @syscap SystemCapability.Multimedia.Image.ImageSource 1889 * @crossplatform 1890 * @atomicservice 1891 * @since 11 1892 */ 1893 desiredPixelFormat?: PixelMapFormat; 1894 1895 /** 1896 * The density for image pixel map. 1897 * 1898 * @type { ?number } 1899 * @syscap SystemCapability.Multimedia.Image.ImageSource 1900 * @since 9 1901 */ 1902 /** 1903 * The density for image pixel map. 1904 * 1905 * @type { ?number } 1906 * @syscap SystemCapability.Multimedia.Image.ImageSource 1907 * @crossplatform 1908 * @since 10 1909 */ 1910 /** 1911 * The density for image pixel map. 1912 * 1913 * @type { ?number } 1914 * @syscap SystemCapability.Multimedia.Image.ImageSource 1915 * @crossplatform 1916 * @atomicservice 1917 * @since 11 1918 */ 1919 fitDensity?: number; 1920 1921 /** 1922 * Color space of the image pixel map. 1923 * 1924 * @type { ?colorSpaceManager.ColorSpaceManager } 1925 * @syscap SystemCapability.Multimedia.Image.ImageSource 1926 * @crossplatform 1927 * @since 11 1928 */ 1929 desiredColorSpace?: colorSpaceManager.ColorSpaceManager; 1930 } 1931 1932 /** 1933 * Describes image color components. 1934 * 1935 * @typedef Component 1936 * @syscap SystemCapability.Multimedia.Image.Core 1937 * @since 9 1938 */ 1939 interface Component { 1940 /** 1941 * Component type. 1942 * 1943 * @type { ComponentType } 1944 * @syscap SystemCapability.Multimedia.Image.Core 1945 * @since 9 1946 */ 1947 readonly componentType: ComponentType; 1948 1949 /** 1950 * Row stride. 1951 * 1952 * @type { number } 1953 * @syscap SystemCapability.Multimedia.Image.Core 1954 * @since 9 1955 */ 1956 readonly rowStride: number; 1957 1958 /** 1959 * Pixel stride. 1960 * 1961 * @type { number } 1962 * @syscap SystemCapability.Multimedia.Image.Core 1963 * @since 9 1964 */ 1965 readonly pixelStride: number; 1966 1967 /** 1968 * Component buffer. 1969 * 1970 * @type { ArrayBuffer } 1971 * @syscap SystemCapability.Multimedia.Image.Core 1972 * @since 9 1973 */ 1974 readonly byteBuffer: ArrayBuffer; 1975 } 1976 1977 /** 1978 * Initialization options for pixelmap. 1979 * 1980 * @typedef InitializationOptions 1981 * @syscap SystemCapability.Multimedia.Image.Core 1982 * @since 8 1983 */ 1984 /** 1985 * Initialization options for pixelmap. 1986 * 1987 * @typedef InitializationOptions 1988 * @syscap SystemCapability.Multimedia.Image.Core 1989 * @crossplatform 1990 * @since 10 1991 */ 1992 /** 1993 * Initialization options for pixelmap. 1994 * 1995 * @typedef InitializationOptions 1996 * @syscap SystemCapability.Multimedia.Image.Core 1997 * @crossplatform 1998 * @atomicservice 1999 * @since 11 2000 */ 2001 interface InitializationOptions { 2002 /** 2003 * PixelMap size. 2004 * 2005 * @type { Size } 2006 * @syscap SystemCapability.Multimedia.Image.Core 2007 * @since 8 2008 */ 2009 /** 2010 * PixelMap size. 2011 * 2012 * @type { Size } 2013 * @syscap SystemCapability.Multimedia.Image.Core 2014 * @crossplatform 2015 * @since 10 2016 */ 2017 /** 2018 * PixelMap size. 2019 * 2020 * @type { Size } 2021 * @syscap SystemCapability.Multimedia.Image.Core 2022 * @crossplatform 2023 * @atomicservice 2024 * @since 11 2025 */ 2026 size: Size; 2027 2028 /** 2029 * PixelMap expected format. 2030 * 2031 * @type { ?PixelMapFormat } 2032 * @syscap SystemCapability.Multimedia.Image.Core 2033 * @since 8 2034 */ 2035 /** 2036 * PixelMap expected format. 2037 * 2038 * @type { ?PixelMapFormat } 2039 * @syscap SystemCapability.Multimedia.Image.Core 2040 * @crossplatform 2041 * @since 10 2042 */ 2043 /** 2044 * PixelMap expected format. 2045 * 2046 * @type { ?PixelMapFormat } 2047 * @syscap SystemCapability.Multimedia.Image.Core 2048 * @crossplatform 2049 * @atomicservice 2050 * @since 11 2051 */ 2052 pixelFormat?: PixelMapFormat; 2053 2054 /** 2055 * Editable or not. 2056 * 2057 * @type { ?boolean } 2058 * @syscap SystemCapability.Multimedia.Image.Core 2059 * @since 8 2060 */ 2061 /** 2062 * Editable or not. 2063 * 2064 * @type { ?boolean } 2065 * @syscap SystemCapability.Multimedia.Image.Core 2066 * @crossplatform 2067 * @since 10 2068 */ 2069 /** 2070 * Editable or not. 2071 * 2072 * @type { ?boolean } 2073 * @syscap SystemCapability.Multimedia.Image.Core 2074 * @crossplatform 2075 * @atomicservice 2076 * @since 11 2077 */ 2078 editable?: boolean; 2079 2080 /** 2081 * PixelMap expected alpha type. 2082 * 2083 * @type { ?AlphaType } 2084 * @syscap SystemCapability.Multimedia.Image.Core 2085 * @since 9 2086 */ 2087 /** 2088 * PixelMap expected alpha type. 2089 * 2090 * @type { ?AlphaType } 2091 * @syscap SystemCapability.Multimedia.Image.Core 2092 * @crossplatform 2093 * @since 10 2094 */ 2095 /** 2096 * PixelMap expected alpha type. 2097 * 2098 * @type { ?AlphaType } 2099 * @syscap SystemCapability.Multimedia.Image.Core 2100 * @crossplatform 2101 * @atomicservice 2102 * @since 11 2103 */ 2104 alphaType?: AlphaType; 2105 2106 /** 2107 * PixelMap expected scaling effect. 2108 * 2109 * @type { ?ScaleMode } 2110 * @syscap SystemCapability.Multimedia.Image.Core 2111 * @since 9 2112 */ 2113 /** 2114 * PixelMap expected scaling effect. 2115 * 2116 * @type { ?ScaleMode } 2117 * @syscap SystemCapability.Multimedia.Image.Core 2118 * @crossplatform 2119 * @since 10 2120 */ 2121 /** 2122 * PixelMap expected scaling effect. 2123 * 2124 * @type { ?ScaleMode } 2125 * @syscap SystemCapability.Multimedia.Image.Core 2126 * @crossplatform 2127 * @atomicservice 2128 * @since 11 2129 */ 2130 scaleMode?: ScaleMode; 2131 } 2132 2133 /** 2134 * Initialization options for ImageSource. 2135 * 2136 * @typedef SourceOptions 2137 * @syscap SystemCapability.Multimedia.Image.Core 2138 * @since 9 2139 */ 2140 /** 2141 * Initialization options for ImageSource. 2142 * 2143 * @typedef SourceOptions 2144 * @syscap SystemCapability.Multimedia.Image.Core 2145 * @crossplatform 2146 * @since 10 2147 */ 2148 /** 2149 * Initialization options for ImageSource. 2150 * 2151 * @typedef SourceOptions 2152 * @syscap SystemCapability.Multimedia.Image.Core 2153 * @crossplatform 2154 * @atomicservice 2155 * @since 11 2156 */ 2157 interface SourceOptions { 2158 /** 2159 * The density for ImageSource. 2160 * 2161 * @type { number } 2162 * @syscap SystemCapability.Multimedia.Image.Core 2163 * @since 9 2164 */ 2165 /** 2166 * The density for ImageSource. 2167 * 2168 * @type { number } 2169 * @syscap SystemCapability.Multimedia.Image.Core 2170 * @crossplatform 2171 * @since 10 2172 */ 2173 /** 2174 * The density for ImageSource. 2175 * 2176 * @type { number } 2177 * @syscap SystemCapability.Multimedia.Image.Core 2178 * @crossplatform 2179 * @atomicservice 2180 * @since 11 2181 */ 2182 sourceDensity: number; 2183 2184 /** 2185 * PixelMap expected format. 2186 * 2187 * @type { ?PixelMapFormat } 2188 * @syscap SystemCapability.Multimedia.Image.Core 2189 * @since 9 2190 */ 2191 /** 2192 * PixelMap expected format. 2193 * 2194 * @type { ?PixelMapFormat } 2195 * @syscap SystemCapability.Multimedia.Image.Core 2196 * @crossplatform 2197 * @since 10 2198 */ 2199 /** 2200 * PixelMap expected format. 2201 * 2202 * @type { ?PixelMapFormat } 2203 * @syscap SystemCapability.Multimedia.Image.Core 2204 * @crossplatform 2205 * @atomicservice 2206 * @since 11 2207 */ 2208 sourcePixelFormat?: PixelMapFormat; 2209 2210 /** 2211 * PixelMap size. 2212 * 2213 * @type { ?Size } 2214 * @syscap SystemCapability.Multimedia.Image.Core 2215 * @since 9 2216 */ 2217 /** 2218 * PixelMap size. 2219 * 2220 * @type { ?Size } 2221 * @syscap SystemCapability.Multimedia.Image.Core 2222 * @crossplatform 2223 * @since 10 2224 */ 2225 /** 2226 * PixelMap size. 2227 * 2228 * @type { ?Size } 2229 * @syscap SystemCapability.Multimedia.Image.Core 2230 * @crossplatform 2231 * @atomicservice 2232 * @since 11 2233 */ 2234 sourceSize?: Size; 2235 } 2236 2237 /** 2238 * Create pixelmap by data buffer. 2239 * 2240 * @param { ArrayBuffer } colors The image color buffer. 2241 * @param { InitializationOptions } options Initialization options for pixelmap. 2242 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 2243 * @syscap SystemCapability.Multimedia.Image.Core 2244 * @since 8 2245 */ 2246 /** 2247 * Create pixelmap by data buffer. 2248 * 2249 * @param { ArrayBuffer } colors The image color buffer. 2250 * @param { InitializationOptions } options Initialization options for pixelmap. 2251 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 2252 * @syscap SystemCapability.Multimedia.Image.Core 2253 * @crossplatform 2254 * @since 10 2255 */ 2256 function createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback<PixelMap>): void; 2257 2258 /** 2259 * Create pixelmap by data buffer. 2260 * 2261 * @param { ArrayBuffer } colors The image color buffer. 2262 * @param { InitializationOptions } options Initialization options for pixelmap. 2263 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 2264 * @syscap SystemCapability.Multimedia.Image.Core 2265 * @since 8 2266 */ 2267 /** 2268 * Create pixelmap by data buffer. 2269 * 2270 * @param { ArrayBuffer } colors The image color buffer. 2271 * @param { InitializationOptions } options Initialization options for pixelmap. 2272 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 2273 * @syscap SystemCapability.Multimedia.Image.Core 2274 * @crossplatform 2275 * @since 10 2276 */ 2277 function createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise<PixelMap>; 2278 2279 /** 2280 * Creates a PixelMap object based on MessageSequence parameter. 2281 * 2282 * @param { rpc.MessageSequence } sequence - rpc.MessageSequence parameter. 2283 * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, an exception will be thrown. 2284 * @throws { BusinessError } 62980096 - Operation failed. 2285 * @throws { BusinessError } 62980097 - IPC error. 2286 * @throws { BusinessError } 62980115 - Invalid input parameter. 2287 * @throws { BusinessError } 62980105 - Failed to get the data. 2288 * @throws { BusinessError } 62980177 - Abnormal API environment. 2289 * @throws { BusinessError } 62980178 - Failed to create the PixelMap. 2290 * @throws { BusinessError } 62980179 - Abnormal buffer size. 2291 * @throws { BusinessError } 62980180 - FD mapping failed. 2292 * @throws { BusinessError } 62980246 - Failed to read the PixelMap. 2293 * @syscap SystemCapability.Multimedia.Image.Core 2294 * @since 11 2295 */ 2296 function createPixelMapFromParcel(sequence: rpc.MessageSequence): PixelMap; 2297 2298 /** 2299 * Creates a PixelMap object from surface id. 2300 * 2301 * @param { string } surfaceId - surface id. 2302 * @param { Region } region - The region to surface. 2303 * @returns { Promise<PixelMap> } Returns the instance if the operation is successful;Otherwise, an exception will be thrown. 2304 * @throws { BusinessError } 62980115 - If the image parameter invalid. 2305 * @throws { BusinessError } 62980105 - Failed to get the data. 2306 * @throws { BusinessError } 62980178 - Failed to create the PixelMap. 2307 * @syscap SystemCapability.Multimedia.Image.Core 2308 * @since 11 2309 */ 2310 function createPixelMapFromSurface(surfaceId: string, region: Region): Promise<PixelMap>; 2311 2312 /** 2313 * Creates an ImageSource instance based on the URI. 2314 * 2315 * @param { string } uri Image source URI. 2316 * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. 2317 * @syscap SystemCapability.Multimedia.Image.ImageSource 2318 * @since 6 2319 */ 2320 /** 2321 * Creates an ImageSource instance based on the URI. 2322 * 2323 * @param { string } uri Image source URI. 2324 * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. 2325 * @syscap SystemCapability.Multimedia.Image.ImageSource 2326 * @crossplatform 2327 * @since 10 2328 */ 2329 /** 2330 * Creates an ImageSource instance based on the URI. 2331 * 2332 * @param { string } uri Image source URI. 2333 * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. 2334 * @syscap SystemCapability.Multimedia.Image.ImageSource 2335 * @crossplatform 2336 * @atomicservice 2337 * @since 11 2338 */ 2339 function createImageSource(uri: string): ImageSource; 2340 2341 /** 2342 * Creates an ImageSource instance based on the URI. 2343 * 2344 * @param { string } uri Image source URI. 2345 * @param { SourceOptions } options The config of Image source. 2346 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2347 * @syscap SystemCapability.Multimedia.Image.ImageSource 2348 * @since 9 2349 */ 2350 /** 2351 * Creates an ImageSource instance based on the URI. 2352 * 2353 * @param { string } uri Image source URI. 2354 * @param { SourceOptions } options The config of Image source. 2355 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2356 * @syscap SystemCapability.Multimedia.Image.ImageSource 2357 * @crossplatform 2358 * @since 10 2359 */ 2360 /** 2361 * Creates an ImageSource instance based on the URI. 2362 * 2363 * @param { string } uri Image source URI. 2364 * @param { SourceOptions } options The config of Image source. 2365 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2366 * @syscap SystemCapability.Multimedia.Image.ImageSource 2367 * @crossplatform 2368 * @atomicservice 2369 * @since 11 2370 */ 2371 function createImageSource(uri: string, options: SourceOptions): ImageSource; 2372 2373 /** 2374 * Creates an ImageSource instance based on the file descriptor. 2375 * 2376 * @param { number } fd ID of a file descriptor. 2377 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2378 * @syscap SystemCapability.Multimedia.Image.ImageSource 2379 * @since 7 2380 */ 2381 /** 2382 * Creates an ImageSource instance based on the file descriptor. 2383 * 2384 * @param { number } fd ID of a file descriptor. 2385 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2386 * @syscap SystemCapability.Multimedia.Image.ImageSource 2387 * @crossplatform 2388 * @since 10 2389 */ 2390 /** 2391 * Creates an ImageSource instance based on the file descriptor. 2392 * 2393 * @param { number } fd ID of a file descriptor. 2394 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2395 * @syscap SystemCapability.Multimedia.Image.ImageSource 2396 * @crossplatform 2397 * @atomicservice 2398 * @since 11 2399 */ 2400 function createImageSource(fd: number): ImageSource; 2401 2402 /** 2403 * Creates an ImageSource instance based on the file descriptor. 2404 * 2405 * @param { number } fd ID of a file descriptor. 2406 * @param { SourceOptions } options The config of Image source. 2407 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2408 * @syscap SystemCapability.Multimedia.Image.ImageSource 2409 * @since 9 2410 */ 2411 /** 2412 * Creates an ImageSource instance based on the file descriptor. 2413 * 2414 * @param { number } fd ID of a file descriptor. 2415 * @param { SourceOptions } options The config of Image source. 2416 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2417 * @syscap SystemCapability.Multimedia.Image.ImageSource 2418 * @crossplatform 2419 * @since 10 2420 */ 2421 /** 2422 * Creates an ImageSource instance based on the file descriptor. 2423 * 2424 * @param { number } fd ID of a file descriptor. 2425 * @param { SourceOptions } options The config of Image source. 2426 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2427 * @syscap SystemCapability.Multimedia.Image.ImageSource 2428 * @crossplatform 2429 * @atomicservice 2430 * @since 11 2431 */ 2432 function createImageSource(fd: number, options: SourceOptions): ImageSource; 2433 2434 /** 2435 * Creates an ImageSource instance based on the buffer. 2436 * 2437 * @param { ArrayBuffer } buf The buffer of the image. 2438 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2439 * @syscap SystemCapability.Multimedia.Image.ImageSource 2440 * @since 9 2441 */ 2442 /** 2443 * Creates an ImageSource instance based on the buffer. 2444 * 2445 * @param { ArrayBuffer } buf The buffer of the image. 2446 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2447 * @syscap SystemCapability.Multimedia.Image.ImageSource 2448 * @crossplatform 2449 * @since 10 2450 */ 2451 /** 2452 * Creates an ImageSource instance based on the buffer. 2453 * 2454 * @param { ArrayBuffer } buf The buffer of the image. 2455 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2456 * @syscap SystemCapability.Multimedia.Image.ImageSource 2457 * @crossplatform 2458 * @atomicservice 2459 * @since 11 2460 */ 2461 function createImageSource(buf: ArrayBuffer): ImageSource; 2462 2463 /** 2464 * Creates an ImageSource instance based on the buffer. 2465 * 2466 * @param { ArrayBuffer } buf The buffer of the image. 2467 * @param { SourceOptions } options The config of Image source. 2468 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2469 * @syscap SystemCapability.Multimedia.Image.ImageSource 2470 * @since 9 2471 */ 2472 /** 2473 * Creates an ImageSource instance based on the buffer. 2474 * 2475 * @param { ArrayBuffer } buf The buffer of the image. 2476 * @param { SourceOptions } options The config of Image source. 2477 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2478 * @syscap SystemCapability.Multimedia.Image.ImageSource 2479 * @crossplatform 2480 * @since 10 2481 */ 2482 /** 2483 * Creates an ImageSource instance based on the buffer. 2484 * 2485 * @param { ArrayBuffer } buf The buffer of the image. 2486 * @param { SourceOptions } options The config of Image source. 2487 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2488 * @syscap SystemCapability.Multimedia.Image.ImageSource 2489 * @crossplatform 2490 * @atomicservice 2491 * @since 11 2492 */ 2493 function createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource; 2494 2495 /** 2496 * Creates an ImageSource instance based on the raw file descriptor. 2497 * 2498 * @param { resourceManager.RawFileDescriptor } rawfile The raw file descriptor of the image. 2499 * @param { SourceOptions } options The config of Image source. 2500 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2501 * @syscap SystemCapability.Multimedia.Image.ImageSource 2502 * @crossplatform 2503 * @atomicservice 2504 * @since 11 2505 */ 2506 function createImageSource(rawfile: resourceManager.RawFileDescriptor, options?: SourceOptions): ImageSource; 2507 2508 /** 2509 * Creates an ImageSource instance based on the buffer in incremental. 2510 * 2511 * @param { ArrayBuffer } buf The buffer of the image. 2512 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2513 * @syscap SystemCapability.Multimedia.Image.ImageSource 2514 * @since 9 2515 */ 2516 /** 2517 * Creates an ImageSource instance based on the buffer in incremental. 2518 * 2519 * @param { ArrayBuffer } buf The buffer of the image. 2520 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2521 * @syscap SystemCapability.Multimedia.Image.ImageSource 2522 * @crossplatform 2523 * @since 10 2524 */ 2525 function CreateIncrementalSource(buf: ArrayBuffer): ImageSource; 2526 2527 /** 2528 * Creates an ImageSource instance based on the buffer in incremental. 2529 * 2530 * @param { ArrayBuffer } buf The buffer of the image. 2531 * @param { SourceOptions } options The config of source. 2532 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2533 * @syscap SystemCapability.Multimedia.Image.ImageSource 2534 * @since 9 2535 */ 2536 /** 2537 * Creates an ImageSource instance based on the buffer in incremental. 2538 * 2539 * @param { ArrayBuffer } buf The buffer of the image. 2540 * @param { SourceOptions } options The config of source. 2541 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 2542 * @syscap SystemCapability.Multimedia.Image.ImageSource 2543 * @crossplatform 2544 * @since 10 2545 */ 2546 function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource; 2547 2548 /** 2549 * Creates an ImagePacker instance. 2550 * 2551 * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. 2552 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2553 * @since 6 2554 */ 2555 /** 2556 * Creates an ImagePacker instance. 2557 * 2558 * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. 2559 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2560 * @crossplatform 2561 * @since 10 2562 */ 2563 /** 2564 * Creates an ImagePacker instance. 2565 * 2566 * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. 2567 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2568 * @crossplatform 2569 * @atomicservice 2570 * @since 11 2571 */ 2572 function createImagePacker(): ImagePacker; 2573 2574 /** 2575 * Creates an ImageReceiver instance. 2576 * 2577 * @param { number } width The default width in pixels of the Images that this receiver will produce. 2578 * @param { number } height The default height in pixels of the Images that this receiver will produce. 2579 * @param { number } format The format of the Image that this receiver will produce. This must be one of the 2580 * {@link ImageFormat} constants. 2581 * @param { number } capacity The maximum number of images the user will want to access simultaneously. 2582 * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise. 2583 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 2584 * @since 9 2585 * @deprecated since 11 2586 * @useinstead image#createImageReceiver 2587 */ 2588 function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver; 2589 2590 /** 2591 * Creates an ImageReceiver instance. 2592 * 2593 * @param { Size } size - The default {@link Size} in pixels of the Images that this receiver will produce. 2594 * @param { ImageFormat } format - The format of the Image that this receiver will produce. This must be one of the 2595 * {@link ImageFormat} constants. 2596 * @param { number } capacity - The maximum number of images the user will want to access simultaneously. 2597 * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise. 2598 * @throws { BusinessError } 401 - The parameter check failed. 2599 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 2600 * @since 11 2601 */ 2602 function createImageReceiver(size: Size, format: ImageFormat, capacity: number): ImageReceiver; 2603 2604 /** 2605 * Creates an ImageCreator instance. 2606 * 2607 * @param { number } width The default width in pixels of the Images that this creator will produce. 2608 * @param { number } height The default height in pixels of the Images that this creator will produce. 2609 * @param { number } format The format of the Image that this creator will produce. This must be one of the 2610 * {@link ImageFormat} constants. 2611 * @param { number } capacity The maximum number of images the user will want to access simultaneously. 2612 * @returns { ImageCreator } Returns the ImageCreator instance if the operation is successful; returns null otherwise. 2613 * @syscap SystemCapability.Multimedia.Image.ImageCreator 2614 * @since 9 2615 * @deprecated since 11 2616 * @useinstead image#createImageCreator 2617 */ 2618 function createImageCreator(width: number, height: number, format: number, capacity: number): ImageCreator; 2619 2620 /** 2621 * Creates an ImageCreator instance. 2622 * 2623 * @param { Size } size - The default {@link Size} in pixels of the Images that this creator will produce. 2624 * @param { ImageFormat } format - The format of the Image that this creator will produce. This must be one of the 2625 * {@link ImageFormat} constants. 2626 * @param { number } capacity - The maximum number of images the user will want to access simultaneously. 2627 * @returns { ImageCreator } Returns the ImageCreator instance if the operation is successful; returns null otherwise. 2628 * @throws { BusinessError } 401 - The parameter check failed. 2629 * @syscap SystemCapability.Multimedia.Image.ImageCreator 2630 * @since 11 2631 */ 2632 function createImageCreator(size: Size, format: ImageFormat, capacity: number): ImageCreator; 2633 /** 2634 * PixelMap instance. 2635 * 2636 * @typedef PixelMap 2637 * @syscap SystemCapability.Multimedia.Image.Core 2638 * @since 7 2639 */ 2640 /** 2641 * PixelMap instance. 2642 * 2643 * @typedef PixelMap 2644 * @syscap SystemCapability.Multimedia.Image.Core 2645 * @crossplatform 2646 * @since 10 2647 */ 2648 /** 2649 * PixelMap instance. 2650 * 2651 * @typedef PixelMap 2652 * @syscap SystemCapability.Multimedia.Image.Core 2653 * @crossplatform 2654 * @atomicservice 2655 * @since 11 2656 */ 2657 interface PixelMap { 2658 /** 2659 * Whether the image pixel map can be edited. 2660 * 2661 * @type { boolean } 2662 * @syscap SystemCapability.Multimedia.Image.Core 2663 * @since 7 2664 */ 2665 /** 2666 * Whether the image pixel map can be edited. 2667 * 2668 * @type { boolean } 2669 * @syscap SystemCapability.Multimedia.Image.Core 2670 * @crossplatform 2671 * @since 10 2672 */ 2673 /** 2674 * Whether the image pixel map can be edited. 2675 * 2676 * @type { boolean } 2677 * @syscap SystemCapability.Multimedia.Image.Core 2678 * @crossplatform 2679 * @atomicservice 2680 * @since 11 2681 */ 2682 readonly isEditable: boolean; 2683 2684 /** 2685 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 2686 * a promise to return the result. 2687 * 2688 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 2689 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2690 * @syscap SystemCapability.Multimedia.Image.Core 2691 * @since 7 2692 */ 2693 /** 2694 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 2695 * a promise to return the result. 2696 * 2697 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 2698 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2699 * @syscap SystemCapability.Multimedia.Image.Core 2700 * @crossplatform 2701 * @since 10 2702 */ 2703 /** 2704 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 2705 * a promise to return the result. 2706 * 2707 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 2708 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2709 * @syscap SystemCapability.Multimedia.Image.Core 2710 * @crossplatform 2711 * @atomicservice 2712 * @since 11 2713 */ 2714 readPixelsToBuffer(dst: ArrayBuffer): Promise<void>; 2715 2716 /** 2717 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 2718 * a callback to return the result. 2719 * 2720 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 2721 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2722 * @syscap SystemCapability.Multimedia.Image.Core 2723 * @since 7 2724 */ 2725 /** 2726 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 2727 * a callback to return the result. 2728 * 2729 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 2730 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2731 * @syscap SystemCapability.Multimedia.Image.Core 2732 * @crossplatform 2733 * @since 10 2734 */ 2735 /** 2736 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 2737 * a callback to return the result. 2738 * 2739 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 2740 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2741 * @syscap SystemCapability.Multimedia.Image.Core 2742 * @crossplatform 2743 * @atomicservice 2744 * @since 11 2745 */ 2746 readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback<void>): void; 2747 2748 /** 2749 * Reads image pixel map data in an area. This method uses a promise to return the data read. 2750 * 2751 * @param { PositionArea } area Area from which the image pixel map data will be read. 2752 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2753 * @syscap SystemCapability.Multimedia.Image.Core 2754 * @since 7 2755 */ 2756 /** 2757 * Reads image pixel map data in an area. This method uses a promise to return the data read. 2758 * 2759 * @param { PositionArea } area Area from which the image pixel map data will be read. 2760 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2761 * @syscap SystemCapability.Multimedia.Image.Core 2762 * @crossplatform 2763 * @since 10 2764 */ 2765 /** 2766 * Reads image pixel map data in an area. This method uses a promise to return the data read. 2767 * 2768 * @param { PositionArea } area Area from which the image pixel map data will be read. 2769 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2770 * @syscap SystemCapability.Multimedia.Image.Core 2771 * @crossplatform 2772 * @atomicservice 2773 * @since 11 2774 */ 2775 readPixels(area: PositionArea): Promise<void>; 2776 2777 /** 2778 * Reads image pixel map data in an area. This method uses a callback to return the data read. 2779 * 2780 * @param { PositionArea } area Area from which the image pixel map data will be read. 2781 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2782 * @syscap SystemCapability.Multimedia.Image.Core 2783 * @since 7 2784 */ 2785 /** 2786 * Reads image pixel map data in an area. This method uses a callback to return the data read. 2787 * 2788 * @param { PositionArea } area Area from which the image pixel map data will be read. 2789 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2790 * @syscap SystemCapability.Multimedia.Image.Core 2791 * @crossplatform 2792 * @since 10 2793 */ 2794 /** 2795 * Reads image pixel map data in an area. This method uses a callback to return the data read. 2796 * 2797 * @param { PositionArea } area Area from which the image pixel map data will be read. 2798 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2799 * @syscap SystemCapability.Multimedia.Image.Core 2800 * @crossplatform 2801 * @atomicservice 2802 * @since 11 2803 */ 2804 readPixels(area: PositionArea, callback: AsyncCallback<void>): void; 2805 2806 /** 2807 * Writes image pixel map data to the specified area. This method uses a promise to return 2808 * the operation result. 2809 * 2810 * @param { PositionArea } area Area to which the image pixel map data will be written. 2811 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2812 * @syscap SystemCapability.Multimedia.Image.Core 2813 * @since 7 2814 */ 2815 /** 2816 * Writes image pixel map data to the specified area. This method uses a promise to return 2817 * the operation result. 2818 * 2819 * @param { PositionArea } area Area to which the image pixel map data will be written. 2820 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2821 * @syscap SystemCapability.Multimedia.Image.Core 2822 * @crossplatform 2823 * @since 10 2824 */ 2825 /** 2826 * Writes image pixel map data to the specified area. This method uses a promise to return 2827 * the operation result. 2828 * 2829 * @param { PositionArea } area Area to which the image pixel map data will be written. 2830 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2831 * @syscap SystemCapability.Multimedia.Image.Core 2832 * @crossplatform 2833 * @atomicservice 2834 * @since 11 2835 */ 2836 writePixels(area: PositionArea): Promise<void>; 2837 2838 /** 2839 * Writes image pixel map data to the specified area. This method uses a callback to return 2840 * the operation result. 2841 * 2842 * @param { PositionArea } area Area to which the image pixel map data will be written. 2843 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2844 * @syscap SystemCapability.Multimedia.Image.Core 2845 * @since 7 2846 */ 2847 /** 2848 * Writes image pixel map data to the specified area. This method uses a callback to return 2849 * the operation result. 2850 * 2851 * @param { PositionArea } area Area to which the image pixel map data will be written. 2852 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2853 * @syscap SystemCapability.Multimedia.Image.Core 2854 * @crossplatform 2855 * @since 10 2856 */ 2857 /** 2858 * Writes image pixel map data to the specified area. This method uses a callback to return 2859 * the operation result. 2860 * 2861 * @param { PositionArea } area Area to which the image pixel map data will be written. 2862 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2863 * @syscap SystemCapability.Multimedia.Image.Core 2864 * @crossplatform 2865 * @atomicservice 2866 * @since 11 2867 */ 2868 writePixels(area: PositionArea, callback: AsyncCallback<void>): void; 2869 2870 /** 2871 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 2872 * uses a promise to return the result. 2873 * 2874 * @param { ArrayBuffer } src A buffer from which the image data will be read. 2875 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2876 * @syscap SystemCapability.Multimedia.Image.Core 2877 * @since 7 2878 */ 2879 /** 2880 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 2881 * uses a promise to return the result. 2882 * 2883 * @param { ArrayBuffer } src A buffer from which the image data will be read. 2884 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2885 * @syscap SystemCapability.Multimedia.Image.Core 2886 * @crossplatform 2887 * @since 10 2888 */ 2889 /** 2890 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 2891 * uses a promise to return the result. 2892 * 2893 * @param { ArrayBuffer } src A buffer from which the image data will be read. 2894 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2895 * @syscap SystemCapability.Multimedia.Image.Core 2896 * @crossplatform 2897 * @atomicservice 2898 * @since 11 2899 */ 2900 writeBufferToPixels(src: ArrayBuffer): Promise<void>; 2901 2902 /** 2903 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 2904 * uses a callback to return the result. 2905 * 2906 * @param { ArrayBuffer } src A buffer from which the image data will be read. 2907 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2908 * @syscap SystemCapability.Multimedia.Image.Core 2909 * @since 7 2910 */ 2911 /** 2912 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 2913 * uses a callback to return the result. 2914 * 2915 * @param { ArrayBuffer } src A buffer from which the image data will be read. 2916 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2917 * @syscap SystemCapability.Multimedia.Image.Core 2918 * @crossplatform 2919 * @since 10 2920 */ 2921 /** 2922 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 2923 * uses a callback to return the result. 2924 * 2925 * @param { ArrayBuffer } src A buffer from which the image data will be read. 2926 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2927 * @syscap SystemCapability.Multimedia.Image.Core 2928 * @crossplatform 2929 * @atomicservice 2930 * @since 11 2931 */ 2932 writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback<void>): void; 2933 2934 /** 2935 * Obtains pixel map information about this image. This method uses a promise to return the information. 2936 * 2937 * @returns { Promise<ImageInfo> } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. 2938 * @syscap SystemCapability.Multimedia.Image.Core 2939 * @since 7 2940 */ 2941 /** 2942 * Obtains pixel map information about this image. This method uses a promise to return the information. 2943 * 2944 * @returns { Promise<ImageInfo> } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. 2945 * @syscap SystemCapability.Multimedia.Image.Core 2946 * @crossplatform 2947 * @since 10 2948 */ 2949 /** 2950 * Obtains pixel map information about this image. This method uses a promise to return the information. 2951 * 2952 * @returns { Promise<ImageInfo> } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. 2953 * @syscap SystemCapability.Multimedia.Image.Core 2954 * @crossplatform 2955 * @atomicservice 2956 * @since 11 2957 */ 2958 getImageInfo(): Promise<ImageInfo>; 2959 2960 /** 2961 * Obtains pixel map information about this image. This method uses a callback to return the information. 2962 * 2963 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image pixel map information. 2964 * If the operation fails, an error message is returned. 2965 * @syscap SystemCapability.Multimedia.Image.Core 2966 * @since 7 2967 */ 2968 /** 2969 * Obtains pixel map information about this image. This method uses a callback to return the information. 2970 * 2971 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image pixel map information. 2972 * If the operation fails, an error message is returned. 2973 * @syscap SystemCapability.Multimedia.Image.Core 2974 * @crossplatform 2975 * @since 10 2976 */ 2977 /** 2978 * Obtains pixel map information about this image. This method uses a callback to return the information. 2979 * 2980 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image pixel map information. 2981 * If the operation fails, an error message is returned. 2982 * @syscap SystemCapability.Multimedia.Image.Core 2983 * @crossplatform 2984 * @atomicservice 2985 * @since 11 2986 */ 2987 getImageInfo(callback: AsyncCallback<ImageInfo>): void; 2988 2989 /** 2990 * Obtains the number of bytes in each line of the image pixel map. 2991 * 2992 * @returns { number } Number of bytes in each line. 2993 * @syscap SystemCapability.Multimedia.Image.Core 2994 * @since 7 2995 */ 2996 /** 2997 * Obtains the number of bytes in each line of the image pixel map. 2998 * 2999 * @returns { number } Number of bytes in each line. 3000 * @syscap SystemCapability.Multimedia.Image.Core 3001 * @crossplatform 3002 * @since 10 3003 */ 3004 /** 3005 * Obtains the number of bytes in each line of the image pixel map. 3006 * 3007 * @returns { number } Number of bytes in each line. 3008 * @syscap SystemCapability.Multimedia.Image.Core 3009 * @crossplatform 3010 * @atomicservice 3011 * @since 11 3012 */ 3013 getBytesNumberPerRow(): number; 3014 3015 /** 3016 * Obtains the total number of bytes of the image pixel map. 3017 * 3018 * @returns { number } Total number of bytes. 3019 * @syscap SystemCapability.Multimedia.Image.Core 3020 * @since 7 3021 */ 3022 /** 3023 * Obtains the total number of bytes of the image pixel map. 3024 * 3025 * @returns { number } Total number of bytes. 3026 * @syscap SystemCapability.Multimedia.Image.Core 3027 * @crossplatform 3028 * @since 10 3029 */ 3030 /** 3031 * Obtains the total number of bytes of the image pixel map. 3032 * 3033 * @returns { number } Total number of bytes. 3034 * @syscap SystemCapability.Multimedia.Image.Core 3035 * @crossplatform 3036 * @atomicservice 3037 * @since 11 3038 */ 3039 getPixelBytesNumber(): number; 3040 3041 /** 3042 * Obtains the density of the image pixel map. 3043 * 3044 * @returns { number } The number of density. 3045 * @syscap SystemCapability.Multimedia.Image.Core 3046 * @since 9 3047 */ 3048 /** 3049 * Obtains the density of the image pixel map. 3050 * 3051 * @returns { number } The number of density. 3052 * @syscap SystemCapability.Multimedia.Image.Core 3053 * @crossplatform 3054 * @since 10 3055 */ 3056 /** 3057 * Obtains the density of the image pixel map. 3058 * 3059 * @returns { number } The number of density. 3060 * @syscap SystemCapability.Multimedia.Image.Core 3061 * @crossplatform 3062 * @atomicservice 3063 * @since 11 3064 */ 3065 getDensity(): number; 3066 3067 /** 3068 * Set the transparent rate of pixel map. This method uses a callback to return the operation result. 3069 * 3070 * @param { number } rate The value of transparent rate. 3071 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3072 * @syscap SystemCapability.Multimedia.Image.Core 3073 * @since 9 3074 */ 3075 /** 3076 * Set the transparent rate of pixel map. This method uses a callback to return the operation result. 3077 * 3078 * @param { number } rate The value of transparent rate. 3079 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3080 * @syscap SystemCapability.Multimedia.Image.Core 3081 * @crossplatform 3082 * @since 10 3083 */ 3084 /** 3085 * Set the transparent rate of pixel map. This method uses a callback to return the operation result. 3086 * 3087 * @param { number } rate The value of transparent rate. 3088 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3089 * @syscap SystemCapability.Multimedia.Image.Core 3090 * @crossplatform 3091 * @atomicservice 3092 * @since 11 3093 */ 3094 opacity(rate: number, callback: AsyncCallback<void>): void; 3095 3096 /** 3097 * Set the transparent rate of pixel map. This method uses a promise to return the result. 3098 * 3099 * @param { number } rate The value of transparent rate. 3100 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3101 * @syscap SystemCapability.Multimedia.Image.Core 3102 * @since 9 3103 */ 3104 /** 3105 * Set the transparent rate of pixel map. This method uses a promise to return the result. 3106 * 3107 * @param { number } rate The value of transparent rate. 3108 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3109 * @syscap SystemCapability.Multimedia.Image.Core 3110 * @crossplatform 3111 * @since 10 3112 */ 3113 /** 3114 * Set the transparent rate of pixel map. This method uses a promise to return the result. 3115 * 3116 * @param { number } rate The value of transparent rate. 3117 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3118 * @syscap SystemCapability.Multimedia.Image.Core 3119 * @crossplatform 3120 * @atomicservice 3121 * @since 11 3122 */ 3123 opacity(rate: number): Promise<void>; 3124 3125 /** 3126 * Obtains new pixel map with alpha information. This method uses a promise to return the information. 3127 * 3128 * @returns { Promise<PixelMap> } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. 3129 * @syscap SystemCapability.Multimedia.Image.Core 3130 * @since 9 3131 */ 3132 /** 3133 * Obtains new pixel map with alpha information. This method uses a promise to return the information. 3134 * 3135 * @returns { Promise<PixelMap> } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. 3136 * @syscap SystemCapability.Multimedia.Image.Core 3137 * @crossplatform 3138 * @since 10 3139 */ 3140 /** 3141 * Obtains new pixel map with alpha information. This method uses a promise to return the information. 3142 * 3143 * @returns { Promise<PixelMap> } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. 3144 * @syscap SystemCapability.Multimedia.Image.Core 3145 * @crossplatform 3146 * @atomicservice 3147 * @since 11 3148 */ 3149 createAlphaPixelmap(): Promise<PixelMap>; 3150 3151 /** 3152 * Obtains new pixel map with alpha information. This method uses a callback to return the information. 3153 * 3154 * @param { AsyncCallback<PixelMap> } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. 3155 * @syscap SystemCapability.Multimedia.Image.Core 3156 * @since 9 3157 */ 3158 /** 3159 * Obtains new pixel map with alpha information. This method uses a callback to return the information. 3160 * 3161 * @param { AsyncCallback<PixelMap> } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. 3162 * @syscap SystemCapability.Multimedia.Image.Core 3163 * @crossplatform 3164 * @since 10 3165 */ 3166 /** 3167 * Obtains new pixel map with alpha information. This method uses a callback to return the information. 3168 * 3169 * @param { AsyncCallback<PixelMap> } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. 3170 * @syscap SystemCapability.Multimedia.Image.Core 3171 * @crossplatform 3172 * @atomicservice 3173 * @since 11 3174 */ 3175 createAlphaPixelmap(callback: AsyncCallback<PixelMap>): void; 3176 3177 /** 3178 * Image zoom in width and height. This method uses a callback to return the operation result. 3179 * 3180 * @param { number } x The zoom value of width. 3181 * @param { number } y The zoom value of height. 3182 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3183 * @syscap SystemCapability.Multimedia.Image.Core 3184 * @since 9 3185 */ 3186 /** 3187 * Image zoom in width and height. This method uses a callback to return the operation result. 3188 * 3189 * @param { number } x The zoom value of width. 3190 * @param { number } y The zoom value of height. 3191 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3192 * @syscap SystemCapability.Multimedia.Image.Core 3193 * @crossplatform 3194 * @since 10 3195 */ 3196 /** 3197 * Image zoom in width and height. This method uses a callback to return the operation result. 3198 * 3199 * @param { number } x The zoom value of width. 3200 * @param { number } y The zoom value of height. 3201 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3202 * @syscap SystemCapability.Multimedia.Image.Core 3203 * @crossplatform 3204 * @atomicservice 3205 * @since 11 3206 */ 3207 scale(x: number, y: number, callback: AsyncCallback<void>): void; 3208 3209 /** 3210 * Image zoom in width and height. This method uses a promise to return the result. 3211 * 3212 * @param { number } x The zoom value of width. 3213 * @param { number } y The zoom value of height. 3214 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3215 * @syscap SystemCapability.Multimedia.Image.Core 3216 * @since 9 3217 */ 3218 /** 3219 * Image zoom in width and height. This method uses a promise to return the result. 3220 * 3221 * @param { number } x The zoom value of width. 3222 * @param { number } y The zoom value of height. 3223 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3224 * @syscap SystemCapability.Multimedia.Image.Core 3225 * @crossplatform 3226 * @since 10 3227 */ 3228 /** 3229 * Image zoom in width and height. This method uses a promise to return the result. 3230 * 3231 * @param { number } x The zoom value of width. 3232 * @param { number } y The zoom value of height. 3233 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3234 * @syscap SystemCapability.Multimedia.Image.Core 3235 * @crossplatform 3236 * @atomicservice 3237 * @since 11 3238 */ 3239 scale(x: number, y: number): Promise<void>; 3240 3241 /** 3242 * Image position transformation. This method uses a callback to return the operation result. 3243 * 3244 * @param { number } x The position value of width. 3245 * @param { number } y The position value of height. 3246 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3247 * @syscap SystemCapability.Multimedia.Image.Core 3248 * @since 9 3249 */ 3250 /** 3251 * Image position transformation. This method uses a callback to return the operation result. 3252 * 3253 * @param { number } x The position value of width. 3254 * @param { number } y The position value of height. 3255 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3256 * @syscap SystemCapability.Multimedia.Image.Core 3257 * @crossplatform 3258 * @since 10 3259 */ 3260 /** 3261 * Image position transformation. This method uses a callback to return the operation result. 3262 * 3263 * @param { number } x The position value of width. 3264 * @param { number } y The position value of height. 3265 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3266 * @syscap SystemCapability.Multimedia.Image.Core 3267 * @crossplatform 3268 * @atomicservice 3269 * @since 11 3270 */ 3271 translate(x: number, y: number, callback: AsyncCallback<void>): void; 3272 3273 /** 3274 * Image position transformation. This method uses a promise to return the result. 3275 * 3276 * @param { number } x The position value of width. 3277 * @param { number } y The position value of height. 3278 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3279 * @syscap SystemCapability.Multimedia.Image.Core 3280 * @since 9 3281 */ 3282 /** 3283 * Image position transformation. This method uses a promise to return the result. 3284 * 3285 * @param { number } x The position value of width. 3286 * @param { number } y The position value of height. 3287 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3288 * @syscap SystemCapability.Multimedia.Image.Core 3289 * @crossplatform 3290 * @since 10 3291 */ 3292 /** 3293 * Image position transformation. This method uses a promise to return the result. 3294 * 3295 * @param { number } x The position value of width. 3296 * @param { number } y The position value of height. 3297 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3298 * @syscap SystemCapability.Multimedia.Image.Core 3299 * @crossplatform 3300 * @atomicservice 3301 * @since 11 3302 */ 3303 translate(x: number, y: number): Promise<void>; 3304 3305 /** 3306 * Image rotation. This method uses a callback to return the operation result. 3307 * 3308 * @param { number } angle The rotation angle. 3309 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3310 * @syscap SystemCapability.Multimedia.Image.Core 3311 * @since 9 3312 */ 3313 /** 3314 * Image rotation. This method uses a callback to return the operation result. 3315 * 3316 * @param { number } angle The rotation angle. 3317 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3318 * @syscap SystemCapability.Multimedia.Image.Core 3319 * @crossplatform 3320 * @since 10 3321 */ 3322 /** 3323 * Image rotation. This method uses a callback to return the operation result. 3324 * 3325 * @param { number } angle The rotation angle. 3326 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3327 * @syscap SystemCapability.Multimedia.Image.Core 3328 * @crossplatform 3329 * @atomicservice 3330 * @since 11 3331 */ 3332 rotate(angle: number, callback: AsyncCallback<void>): void; 3333 3334 /** 3335 * Image rotation. This method uses a promise to return the result. 3336 * 3337 * @param { number } angle The rotation angle. 3338 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3339 * @syscap SystemCapability.Multimedia.Image.Core 3340 * @since 9 3341 */ 3342 /** 3343 * Image rotation. This method uses a promise to return the result. 3344 * 3345 * @param { number } angle The rotation angle. 3346 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3347 * @syscap SystemCapability.Multimedia.Image.Core 3348 * @crossplatform 3349 * @since 10 3350 */ 3351 /** 3352 * Image rotation. This method uses a promise to return the result. 3353 * 3354 * @param { number } angle The rotation angle. 3355 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3356 * @syscap SystemCapability.Multimedia.Image.Core 3357 * @crossplatform 3358 * @atomicservice 3359 * @since 11 3360 */ 3361 rotate(angle: number): Promise<void>; 3362 3363 /** 3364 * Image flipping. This method uses a callback to return the operation result. 3365 * 3366 * @param { boolean } horizontal Is flip in horizontal. 3367 * @param { boolean } vertical Is flip in vertical. 3368 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3369 * @syscap SystemCapability.Multimedia.Image.Core 3370 * @since 9 3371 */ 3372 /** 3373 * Image flipping. This method uses a callback to return the operation result. 3374 * 3375 * @param { boolean } horizontal Is flip in horizontal. 3376 * @param { boolean } vertical Is flip in vertical. 3377 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3378 * @syscap SystemCapability.Multimedia.Image.Core 3379 * @crossplatform 3380 * @since 10 3381 */ 3382 /** 3383 * Image flipping. This method uses a callback to return the operation result. 3384 * 3385 * @param { boolean } horizontal Is flip in horizontal. 3386 * @param { boolean } vertical Is flip in vertical. 3387 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3388 * @syscap SystemCapability.Multimedia.Image.Core 3389 * @crossplatform 3390 * @atomicservice 3391 * @since 11 3392 */ 3393 flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback<void>): void; 3394 3395 /** 3396 * Image flipping. This method uses a promise to return the result. 3397 * 3398 * @param { boolean } horizontal Is flip in horizontal. 3399 * @param { boolean } vertical Is flip in vertical. 3400 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3401 * @syscap SystemCapability.Multimedia.Image.Core 3402 * @since 9 3403 */ 3404 /** 3405 * Image flipping. This method uses a promise to return the result. 3406 * 3407 * @param { boolean } horizontal Is flip in horizontal. 3408 * @param { boolean } vertical Is flip in vertical. 3409 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3410 * @syscap SystemCapability.Multimedia.Image.Core 3411 * @crossplatform 3412 * @since 10 3413 */ 3414 /** 3415 * Image flipping. This method uses a promise to return the result. 3416 * 3417 * @param { boolean } horizontal Is flip in horizontal. 3418 * @param { boolean } vertical Is flip in vertical. 3419 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3420 * @syscap SystemCapability.Multimedia.Image.Core 3421 * @crossplatform 3422 * @atomicservice 3423 * @since 11 3424 */ 3425 flip(horizontal: boolean, vertical: boolean): Promise<void>; 3426 3427 /** 3428 * Crop the image. This method uses a callback to return the operation result. 3429 * 3430 * @param { Region } region The region to crop. 3431 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3432 * @syscap SystemCapability.Multimedia.Image.Core 3433 * @since 9 3434 */ 3435 /** 3436 * Crop the image. This method uses a callback to return the operation result. 3437 * 3438 * @param { Region } region The region to crop. 3439 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3440 * @syscap SystemCapability.Multimedia.Image.Core 3441 * @crossplatform 3442 * @since 10 3443 */ 3444 /** 3445 * Crop the image. This method uses a callback to return the operation result. 3446 * 3447 * @param { Region } region The region to crop. 3448 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 3449 * @syscap SystemCapability.Multimedia.Image.Core 3450 * @crossplatform 3451 * @atomicservice 3452 * @since 11 3453 */ 3454 crop(region: Region, callback: AsyncCallback<void>): void; 3455 3456 /** 3457 * Crop the image. This method uses a promise to return the result. 3458 * 3459 * @param { Region } region The region to crop. 3460 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3461 * @syscap SystemCapability.Multimedia.Image.Core 3462 * @since 9 3463 */ 3464 /** 3465 * Crop the image. This method uses a promise to return the result. 3466 * 3467 * @param { Region } region The region to crop. 3468 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3469 * @syscap SystemCapability.Multimedia.Image.Core 3470 * @crossplatform 3471 * @since 10 3472 */ 3473 /** 3474 * Crop the image. This method uses a promise to return the result. 3475 * 3476 * @param { Region } region The region to crop. 3477 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3478 * @syscap SystemCapability.Multimedia.Image.Core 3479 * @crossplatform 3480 * @atomicservice 3481 * @since 11 3482 */ 3483 crop(region: Region): Promise<void>; 3484 3485 /** 3486 * Get color space of pixel map. 3487 * 3488 * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned. 3489 * @throws { BusinessError } 62980101 - The image data is abnormal. 3490 * @throws { BusinessError } 62980103 - The image data is not supported. 3491 * @throws { BusinessError } 62980115 - Invalid image parameter. 3492 * @syscap SystemCapability.Multimedia.Image.Core 3493 * @since 10 3494 */ 3495 /** 3496 * Get color space of pixel map. 3497 * 3498 * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned. 3499 * @throws { BusinessError } 62980101 - If the image data abnormal. 3500 * @throws { BusinessError } 62980103 - If the image data unsupport. 3501 * @throws { BusinessError } 62980115 - If the image parameter invalid. 3502 * @syscap SystemCapability.Multimedia.Image.Core 3503 * @crossplatform 3504 * @since 11 3505 */ 3506 getColorSpace(): colorSpaceManager.ColorSpaceManager; 3507 3508 /** 3509 * Marshalling pixelmap and write into MessageSequence. 3510 * 3511 * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. 3512 * @throws { BusinessError } 62980115 - Invalid image parameter. 3513 * @throws { BusinessError } 62980097 - IPC error. 3514 * @syscap SystemCapability.Multimedia.Image.Core 3515 * @since 10 3516 */ 3517 marshalling(sequence: rpc.MessageSequence): void; 3518 3519 /** 3520 * Creates a PixelMap object based on MessageSequence parameter. 3521 * 3522 * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. 3523 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 3524 * @throws { BusinessError } 62980115 - Invalid image parameter. 3525 * @throws { BusinessError } 62980097 - IPC error. 3526 * @throws { BusinessError } 62980096 - The operation failed. 3527 * @syscap SystemCapability.Multimedia.Image.Core 3528 * @since 10 3529 */ 3530 unmarshalling(sequence: rpc.MessageSequence): Promise<PixelMap>; 3531 3532 /** 3533 * Set color space of pixel map. 3534 * 3535 * This method is only used to set the colorspace property of pixelmap, while all pixel data remains the same after calling this method. 3536 * If you want to change colorspace for all pixels, use method {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager)} or 3537 * {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager, AsyncCallback<void>)}. 3538 * 3539 * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixel map. 3540 * @throws { BusinessError } 62980111 - The image source data is incomplete. 3541 * @throws { BusinessError } 62980115 - Invalid image parameter. 3542 * @syscap SystemCapability.Multimedia.Image.Core 3543 * @since 10 3544 */ 3545 /** 3546 * Set color space of pixel map. 3547 * 3548 * This method is only used to set the colorspace property of pixelmap, while all pixel data remains the same after calling this method. 3549 * If you want to change colorspace for all pixels, use method {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager)} or 3550 * {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager, AsyncCallback<void>)}. 3551 * 3552 * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixel map. 3553 * @throws { BusinessError } 62980111 - If the operation invalid. 3554 * @throws { BusinessError } 62980115 - If the image parameter invalid. 3555 * @syscap SystemCapability.Multimedia.Image.Core 3556 * @crossplatform 3557 * @since 11 3558 */ 3559 setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void; 3560 3561 /** 3562 * Is it stride Alignment 3563 * 3564 * @type { boolean } 3565 * @readonly 3566 * @syscap SystemCapability.Multimedia.Image.Core 3567 * @since 11 3568 */ 3569 readonly isStrideAlignment: boolean; 3570 3571 /** 3572 * Apply color space of pixel map, the pixels will be changed by input color space. This method uses a callback to return the operation result. 3573 * 3574 * This method is used to change color space of pixelmap. Pixel data will be changed by calling this method. 3575 * If you want to set the colorspace property of pixelmap only, use method {@Link #setColorSpace(colorSpaceManager.ColorSpaceManager)}. 3576 * 3577 * @param { colorSpaceManager.ColorSpaceManager } targetColorSpace - The color space for pixel map. 3578 * @param { AsyncCallback<void> } callback - Callback used to return the operation result. If the operation fails, an error message is returned. 3579 * @throws { BusinessError } 401 - The parameter check failed. 3580 * @throws { BusinessError } 62980104 - Failed to initialize the internal object. 3581 * @throws { BusinessError } 62980108 - Failed to convert the color space. 3582 * @throws { BusinessError } 62980115 - Invalid image parameter. 3583 * @syscap SystemCapability.Multimedia.Image.Core 3584 * @crossplatform 3585 * @since 11 3586 */ 3587 applyColorSpace(targetColorSpace: colorSpaceManager.ColorSpaceManager, callback: AsyncCallback<void>): void; 3588 3589 /** 3590 * Apply color space of pixel map, the pixels will be changed by input color space. This method uses a promise to return the result. 3591 * 3592 * This method is used to change color space of pixelmap. Pixel data will be changed by calling this method. 3593 * If you want to set the colorspace property of pixelmap only, use method {@Link #setColorSpace(colorSpaceManager.ColorSpaceManager)}. 3594 * 3595 * @param { colorSpaceManager.ColorSpaceManager } targetColorSpace - The color space for pixel map. 3596 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 3597 * @throws { BusinessError } 401 - The parameter check failed. 3598 * @throws { BusinessError } 62980104 - Failed to initialize the internal object. 3599 * @throws { BusinessError } 62980108 - Failed to convert the color space. 3600 * @throws { BusinessError } 62980115 - Invalid image parameter. 3601 * @syscap SystemCapability.Multimedia.Image.Core 3602 * @crossplatform 3603 * @since 11 3604 */ 3605 applyColorSpace(targetColorSpace: colorSpaceManager.ColorSpaceManager): Promise<void>; 3606 3607 /** 3608 * Releases this PixelMap object. This method uses a callback to return the result. 3609 * 3610 * @param { AsyncCallback<void> } callback Callback invoked for instance release. If the operation fails, an error message is returned. 3611 * @syscap SystemCapability.Multimedia.Image.Core 3612 * @since 7 3613 */ 3614 /** 3615 * Releases this PixelMap object. This method uses a callback to return the result. 3616 * 3617 * @param { AsyncCallback<void> } callback Callback invoked for instance release. If the operation fails, an error message is returned. 3618 * @syscap SystemCapability.Multimedia.Image.Core 3619 * @crossplatform 3620 * @since 10 3621 */ 3622 /** 3623 * Releases this PixelMap object. This method uses a callback to return the result. 3624 * 3625 * @param { AsyncCallback<void> } callback Callback invoked for instance release. If the operation fails, an error message is returned. 3626 * @syscap SystemCapability.Multimedia.Image.Core 3627 * @crossplatform 3628 * @atomicservice 3629 * @since 11 3630 */ 3631 release(callback: AsyncCallback<void>): void; 3632 3633 /** 3634 * Releases this PixelMap object. This method uses a promise to return the result. 3635 * 3636 * @returns { Promise<void> } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. 3637 * @syscap SystemCapability.Multimedia.Image.Core 3638 * @since 7 3639 */ 3640 /** 3641 * Releases this PixelMap object. This method uses a promise to return the result. 3642 * 3643 * @returns { Promise<void> } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. 3644 * @syscap SystemCapability.Multimedia.Image.Core 3645 * @crossplatform 3646 * @since 10 3647 */ 3648 /** 3649 * Releases this PixelMap object. This method uses a promise to return the result. 3650 * 3651 * @returns { Promise<void> } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. 3652 * @syscap SystemCapability.Multimedia.Image.Core 3653 * @crossplatform 3654 * @atomicservice 3655 * @since 11 3656 */ 3657 release(): Promise<void>; 3658 } 3659 3660 /** 3661 * ImageSource instance. 3662 * 3663 * @typedef ImageSource 3664 * @syscap SystemCapability.Multimedia.Image.ImageSource 3665 * @since 6 3666 */ 3667 /** 3668 * ImageSource instance. 3669 * 3670 * @typedef ImageSource 3671 * @syscap SystemCapability.Multimedia.Image.ImageSource 3672 * @crossplatform 3673 * @since 10 3674 */ 3675 /** 3676 * ImageSource instance. 3677 * 3678 * @typedef ImageSource 3679 * @syscap SystemCapability.Multimedia.Image.ImageSource 3680 * @crossplatform 3681 * @atomicservice 3682 * @since 11 3683 */ 3684 interface ImageSource { 3685 /** 3686 * Obtains information about an image with the specified sequence number and uses a callback 3687 * to return the result. 3688 * 3689 * @param { number } index Sequence number of an image. 3690 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 3691 * @syscap SystemCapability.Multimedia.Image.ImageSource 3692 * @since 6 3693 */ 3694 /** 3695 * Obtains information about an image with the specified sequence number and uses a callback 3696 * to return the result. 3697 * 3698 * @param { number } index Sequence number of an image. 3699 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 3700 * @syscap SystemCapability.Multimedia.Image.ImageSource 3701 * @crossplatform 3702 * @since 10 3703 */ 3704 /** 3705 * Obtains information about an image with the specified sequence number and uses a callback 3706 * to return the result. 3707 * 3708 * @param { number } index Sequence number of an image. 3709 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 3710 * @syscap SystemCapability.Multimedia.Image.ImageSource 3711 * @crossplatform 3712 * @atomicservice 3713 * @since 11 3714 */ 3715 getImageInfo(index: number, callback: AsyncCallback<ImageInfo>): void; 3716 3717 /** 3718 * Obtains information about this image and uses a callback to return the result. 3719 * 3720 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 3721 * @syscap SystemCapability.Multimedia.Image.ImageSource 3722 * @since 6 3723 */ 3724 /** 3725 * Obtains information about this image and uses a callback to return the result. 3726 * 3727 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 3728 * @syscap SystemCapability.Multimedia.Image.ImageSource 3729 * @crossplatform 3730 * @since 10 3731 */ 3732 /** 3733 * Obtains information about this image and uses a callback to return the result. 3734 * 3735 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 3736 * @syscap SystemCapability.Multimedia.Image.ImageSource 3737 * @crossplatform 3738 * @atomicservice 3739 * @since 11 3740 */ 3741 getImageInfo(callback: AsyncCallback<ImageInfo>): void; 3742 3743 /** 3744 * Get image information from image source. 3745 * 3746 * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. 3747 * @returns { Promise<ImageInfo> } A Promise instance used to return the image information. 3748 * @syscap SystemCapability.Multimedia.Image.ImageSource 3749 * @since 6 3750 */ 3751 /** 3752 * Get image information from image source. 3753 * 3754 * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. 3755 * @returns { Promise<ImageInfo> } A Promise instance used to return the image information. 3756 * @syscap SystemCapability.Multimedia.Image.ImageSource 3757 * @crossplatform 3758 * @since 10 3759 */ 3760 /** 3761 * Get image information from image source. 3762 * 3763 * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. 3764 * @returns { Promise<ImageInfo> } A Promise instance used to return the image information. 3765 * @syscap SystemCapability.Multimedia.Image.ImageSource 3766 * @crossplatform 3767 * @atomicservice 3768 * @since 11 3769 */ 3770 getImageInfo(index?: number): Promise<ImageInfo>; 3771 3772 /** 3773 * Creates a PixelMap object based on image decoding parameters. This method uses a promise to 3774 * return the object. 3775 * 3776 * @param { DecodingOptions } options Image decoding parameters. 3777 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 3778 * @syscap SystemCapability.Multimedia.Image.ImageSource 3779 * @since 7 3780 */ 3781 /** 3782 * Creates a PixelMap object based on image decoding parameters. This method uses a promise to 3783 * return the object. 3784 * 3785 * @param { DecodingOptions } options Image decoding parameters. 3786 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 3787 * @syscap SystemCapability.Multimedia.Image.ImageSource 3788 * @crossplatform 3789 * @since 10 3790 */ 3791 /** 3792 * Creates a PixelMap object based on image decoding parameters. This method uses a promise to 3793 * return the object. 3794 * 3795 * @param { DecodingOptions } options Image decoding parameters. 3796 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 3797 * @syscap SystemCapability.Multimedia.Image.ImageSource 3798 * @crossplatform 3799 * @atomicservice 3800 * @since 11 3801 */ 3802 createPixelMap(options?: DecodingOptions): Promise<PixelMap>; 3803 3804 /** 3805 * Creates a PixelMap object. This method uses a callback to return the object. 3806 * 3807 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 3808 * @syscap SystemCapability.Multimedia.Image.ImageSource 3809 * @since 7 3810 */ 3811 /** 3812 * Creates a PixelMap object. This method uses a callback to return the object. 3813 * 3814 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 3815 * @syscap SystemCapability.Multimedia.Image.ImageSource 3816 * @crossplatform 3817 * @since 10 3818 */ 3819 /** 3820 * Creates a PixelMap object. This method uses a callback to return the object. 3821 * 3822 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 3823 * @syscap SystemCapability.Multimedia.Image.ImageSource 3824 * @crossplatform 3825 * @atomicservice 3826 * @since 11 3827 */ 3828 createPixelMap(callback: AsyncCallback<PixelMap>): void; 3829 3830 /** 3831 * Creates a PixelMap object based on image decoding parameters. This method uses a callback to 3832 * return the object. 3833 * 3834 * @param { DecodingOptions } options Image decoding parameters. 3835 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 3836 * @syscap SystemCapability.Multimedia.Image.ImageSource 3837 * @since 7 3838 */ 3839 /** 3840 * Creates a PixelMap object based on image decoding parameters. This method uses a callback to 3841 * return the object. 3842 * 3843 * @param { DecodingOptions } options Image decoding parameters. 3844 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 3845 * @syscap SystemCapability.Multimedia.Image.ImageSource 3846 * @crossplatform 3847 * @since 10 3848 */ 3849 /** 3850 * Creates a PixelMap object based on image decoding parameters. This method uses a callback to 3851 * return the object. 3852 * 3853 * @param { DecodingOptions } options Image decoding parameters. 3854 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 3855 * @syscap SystemCapability.Multimedia.Image.ImageSource 3856 * @crossplatform 3857 * @atomicservice 3858 * @since 11 3859 */ 3860 createPixelMap(options: DecodingOptions, callback: AsyncCallback<PixelMap>): void; 3861 3862 /** 3863 * Creates a PixelMap array based on image decoding parameters. This method uses a promise to 3864 * return the array. 3865 * 3866 * @param { DecodingOptions } options Image decoding parameters. 3867 * @returns { Promise<Array<PixelMap>> } A Promise instance used to return the PixelMap array. 3868 * @throws { BusinessError } 401 - The parameter check failed. 3869 * @throws { BusinessError } 62980096 - The operation failed. 3870 * @throws { BusinessError } 62980099 - The shared memory data is abnormal. 3871 * @throws { BusinessError } 62980101 - The image data is abnormal. 3872 * @throws { BusinessError } 62980103 - The image data is not supported. 3873 * @throws { BusinessError } 62980106 - The image is too large. 3874 * @throws { BusinessError } 62980109 - Failed to crop the image. 3875 * @throws { BusinessError } 62980110 - The image source data is incorrect. 3876 * @throws { BusinessError } 62980111 - The image source data is incomplete. 3877 * @throws { BusinessError } 62980112 - The image format does not match. 3878 * @throws { BusinessError } 62980113 - Unknown image format. 3879 * @throws { BusinessError } 62980115 - Invalid image parameter. 3880 * @throws { BusinessError } 62980116 - Failed to decode the image. 3881 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 3882 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 3883 * @throws { BusinessError } 62980137 - Invalid media operation. 3884 * @throws { BusinessError } 62980173 - The DMA memory does not exist. 3885 * @throws { BusinessError } 62980174 - The DMA memory data is abnormal. 3886 * @syscap SystemCapability.Multimedia.Image.ImageSource 3887 * @crossplatform 3888 * @since 10 3889 */ 3890 createPixelMapList(options?: DecodingOptions): Promise<Array<PixelMap>>; 3891 3892 /** 3893 * Creates a PixelMap array. This method uses a callback to return the array. 3894 * 3895 * @param { AsyncCallback<Array<PixelMap>> } callback Callback used to return the PixelMap array. 3896 * @throws { BusinessError } 401 - The parameter check failed. 3897 * @throws { BusinessError } 62980096 - The operation failed. 3898 * @throws { BusinessError } 62980099 - The shared memory data is abnormal. 3899 * @throws { BusinessError } 62980101 - The image data is abnormal. 3900 * @throws { BusinessError } 62980103 - The image data is not supported. 3901 * @throws { BusinessError } 62980106 - The image is too large. 3902 * @throws { BusinessError } 62980109 - Failed to crop the image. 3903 * @throws { BusinessError } 62980110 - The image source data is incorrect. 3904 * @throws { BusinessError } 62980111 - The image source data is incomplete. 3905 * @throws { BusinessError } 62980112 - The image format does not match. 3906 * @throws { BusinessError } 62980113 - Unknown image format. 3907 * @throws { BusinessError } 62980115 - Invalid image parameter. 3908 * @throws { BusinessError } 62980116 - Failed to decode the image. 3909 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 3910 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 3911 * @throws { BusinessError } 62980137 - Invalid media operation. 3912 * @throws { BusinessError } 62980173 - The DMA memory does not exist. 3913 * @throws { BusinessError } 62980174 - The DMA memory data is abnormal. 3914 * @syscap SystemCapability.Multimedia.Image.ImageSource 3915 * @crossplatform 3916 * @since 10 3917 */ 3918 createPixelMapList(callback: AsyncCallback<Array<PixelMap>>): void; 3919 3920 /** 3921 * Creates a PixelMap array based on image decoding parameters. This method uses a callback to 3922 * return the array. 3923 * 3924 * @param { DecodingOptions } options Image decoding parameters. 3925 * @param { AsyncCallback<Array<PixelMap>> } callback Callback used to return the PixelMap array. 3926 * @throws { BusinessError } 401 - The parameter check failed. 3927 * @throws { BusinessError } 62980096 - The operation failed. 3928 * @throws { BusinessError } 62980099 - The shared memory data is abnormal. 3929 * @throws { BusinessError } 62980101 - The image data is abnormal. 3930 * @throws { BusinessError } 62980103 - The image data is not supported. 3931 * @throws { BusinessError } 62980106 - The image is too large. 3932 * @throws { BusinessError } 62980109 - Failed to crop the image. 3933 * @throws { BusinessError } 62980110 - The image source data is incorrect. 3934 * @throws { BusinessError } 62980111 - The image source data is incomplete. 3935 * @throws { BusinessError } 62980112 - The image format does not match. 3936 * @throws { BusinessError } 62980113 - Unknown image format. 3937 * @throws { BusinessError } 62980115 - Invalid image parameter. 3938 * @throws { BusinessError } 62980116 - Failed to decode the image. 3939 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 3940 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 3941 * @throws { BusinessError } 62980137 - Invalid media operation. 3942 * @throws { BusinessError } 62980173 - The DMA memory does not exist. 3943 * @throws { BusinessError } 62980174 - The DMA memory data is abnormal. 3944 * @syscap SystemCapability.Multimedia.Image.ImageSource 3945 * @crossplatform 3946 * @since 10 3947 */ 3948 createPixelMapList(options: DecodingOptions, callback: AsyncCallback<Array<PixelMap>>): void; 3949 3950 /** 3951 * Obtains the array of delay time in an image. This method uses a promise to return the array. 3952 * 3953 * @returns { Promise<Array<number>> } A Promise instance used to return the array. 3954 * @throws { BusinessError } 401 - The parameter check failed. 3955 * @throws { BusinessError } 62980096 - The operation failed. 3956 * @throws { BusinessError } 62980110 - The image source data is incorrect. 3957 * @throws { BusinessError } 62980111 - The image source data is incomplete. 3958 * @throws { BusinessError } 62980112 - The image format does not match. 3959 * @throws { BusinessError } 62980113 - Unknown image format. 3960 * @throws { BusinessError } 62980115 - Invalid image parameter. 3961 * @throws { BusinessError } 62980116 - Failed to decode the image. 3962 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 3963 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 3964 * @throws { BusinessError } 62980137 - Invalid media operation. 3965 * @throws { BusinessError } 62980149 - Invalid media parameter. 3966 * @syscap SystemCapability.Multimedia.Image.ImageSource 3967 * @crossplatform 3968 * @since 10 3969 */ 3970 getDelayTimeList(): Promise<Array<number>>; 3971 3972 /** 3973 * Obtains the array of delay time in an image. This method uses a callback to return the array. 3974 * 3975 * @param { AsyncCallback<Array<number>> } callback Callback used to return the array. 3976 * @throws { BusinessError } 401 - The parameter check failed. 3977 * @throws { BusinessError } 62980096 - The operation failed. 3978 * @throws { BusinessError } 62980110 - The image source data is incorrect. 3979 * @throws { BusinessError } 62980111 - The image source data is incomplete. 3980 * @throws { BusinessError } 62980112 - The image format does not match. 3981 * @throws { BusinessError } 62980113 - Unknown image format. 3982 * @throws { BusinessError } 62980115 - Invalid image parameter. 3983 * @throws { BusinessError } 62980116 - Failed to decode the image. 3984 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 3985 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 3986 * @throws { BusinessError } 62980137 - Invalid media operation. 3987 * @throws { BusinessError } 62980149 - Invalid media parameter. 3988 * @syscap SystemCapability.Multimedia.Image.ImageSource 3989 * @crossplatform 3990 * @since 10 3991 */ 3992 getDelayTimeList(callback: AsyncCallback<Array<number>>): void; 3993 3994 /** 3995 * Obtains the count of frame in an image. This method uses a promise to return the number. 3996 * 3997 * @returns { Promise<number> } A Promise instance used to return the number. 3998 * @throws { BusinessError } 401 - The parameter check failed. 3999 * @throws { BusinessError } 62980096 - The operation failed. 4000 * @throws { BusinessError } 62980110 - The image source data is incorrect. 4001 * @throws { BusinessError } 62980111 - The image source data is incomplete. 4002 * @throws { BusinessError } 62980112 - The image format does not match. 4003 * @throws { BusinessError } 62980113 - Unknown image format. 4004 * @throws { BusinessError } 62980115 - Invalid image parameter. 4005 * @throws { BusinessError } 62980116 - Failed to decode the image. 4006 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 4007 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 4008 * @throws { BusinessError } 62980137 - Invalid media operation. 4009 * @syscap SystemCapability.Multimedia.Image.ImageSource 4010 * @crossplatform 4011 * @since 10 4012 */ 4013 getFrameCount(): Promise<number>; 4014 4015 /** 4016 * Obtains the count of frame in an image. This method uses a callback to return the number. 4017 * 4018 * @param { AsyncCallback<number> } callback Callback used to return the number. 4019 * @throws { BusinessError } 401 - The parameter check failed. 4020 * @throws { BusinessError } 62980096 - The operation failed. 4021 * @throws { BusinessError } 62980110 - The image source data is incorrect. 4022 * @throws { BusinessError } 62980111 - The image source data is incomplete. 4023 * @throws { BusinessError } 62980112 - The image format does not match. 4024 * @throws { BusinessError } 62980113 - Unknown image format. 4025 * @throws { BusinessError } 62980115 - Invalid image parameter. 4026 * @throws { BusinessError } 62980116 - Failed to decode the image. 4027 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 4028 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 4029 * @throws { BusinessError } 62980137 - Invalid media operation. 4030 * @syscap SystemCapability.Multimedia.Image.ImageSource 4031 * @crossplatform 4032 * @since 10 4033 */ 4034 getFrameCount(callback: AsyncCallback<number>): void; 4035 4036 /** 4037 * Obtains the value of a property in an image with the specified index. This method uses a 4038 * promise to return the property value in a string. 4039 * 4040 * @param { PropertyKey } key - Name of the property whose value is to be obtained. 4041 * @param { ImagePropertyOptions } options - Index of the image. 4042 * @returns { Promise<string> } A Promise instance used to return the property value. If the operation fails, the default value is returned. 4043 * @throws { BusinessError } 401 - The parameter check failed. 4044 * @throws { BusinessError } 62980096 - The operation failed. 4045 * @throws { BusinessError } 62980103 - The image data is not supported. 4046 * @throws { BusinessError } 62980110 - The image source data is incorrect. 4047 * @throws { BusinessError } 62980111 - The image source data is incomplete. 4048 * @throws { BusinessError } 62980112 - The image format does not match. 4049 * @throws { BusinessError } 62980113 - Unknown image format. 4050 * @throws { BusinessError } 62980115 - Invalid image parameter. 4051 * @throws { BusinessError } 62980116 - Failed to decode the image. 4052 * @throws { BusinessError } 62980118 - Failed to create the image plugin. 4053 * @throws { BusinessError } 62980122 - The image decoding header is abnormal. 4054 * @throws { BusinessError } 62980123 - Images in EXIF format are not supported. 4055 * @throws { BusinessError } 62980135 - The EXIF value is invalid. 4056 * @syscap SystemCapability.Multimedia.Image.ImageSource 4057 * @crossplatform 4058 * @since 11 4059 */ 4060 getImageProperty(key: PropertyKey, options?: ImagePropertyOptions): Promise<string>; 4061 4062 /** 4063 * Obtains the value of a property in an image with the specified index. This method uses a 4064 * promise to return the property value in a string. 4065 * 4066 * @param { string } key Name of the property whose value is to be obtained. 4067 * @param { GetImagePropertyOptions } options Index of the image. 4068 * @returns { Promise<string> } A Promise instance used to return the property value. If the operation fails, the default value is returned. 4069 * @syscap SystemCapability.Multimedia.Image.ImageSource 4070 * @since 7 4071 * @deprecated since 11 4072 * @useinstead image.ImageSource#getImageProperty 4073 */ 4074 /** 4075 * Obtains the value of a property in an image with the specified index. This method uses a 4076 * promise to return the property value in a string. 4077 * 4078 * @param { string } key Name of the property whose value is to be obtained. 4079 * @param { GetImagePropertyOptions } options Index of the image. 4080 * @returns { Promise<string> } A Promise instance used to return the property value. If the operation fails, the default value is returned. 4081 * @syscap SystemCapability.Multimedia.Image.ImageSource 4082 * @crossplatform 4083 * @since 10 4084 * @deprecated since 11 4085 * @useinstead image.ImageSource#getImageProperty 4086 */ 4087 getImageProperty(key: string, options?: GetImagePropertyOptions): Promise<string>; 4088 4089 /** 4090 * Obtains the value of a property in this image. This method uses a callback to return the 4091 * property value in a string. 4092 * 4093 * @param { string } key Name of the property whose value is to be obtained. 4094 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, an error message is returned. 4095 * @syscap SystemCapability.Multimedia.Image.ImageSource 4096 * @since 7 4097 * @deprecated since 11 4098 * @useinstead image.ImageSource#getImageProperty 4099 */ 4100 /** 4101 * Obtains the value of a property in this image. This method uses a callback to return the 4102 * property value in a string. 4103 * 4104 * @param { string } key Name of the property whose value is to be obtained. 4105 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, an error message is returned. 4106 * @syscap SystemCapability.Multimedia.Image.ImageSource 4107 * @crossplatform 4108 * @since 10 4109 * @deprecated since 11 4110 * @useinstead image.ImageSource#getImageProperty 4111 */ 4112 getImageProperty(key: string, callback: AsyncCallback<string>): void; 4113 4114 /** 4115 * Obtains the value of a property in an image with the specified index. This method uses 4116 * a callback to return the property value in a string. 4117 * 4118 * @param { string } key Name of the property whose value is to be obtained. 4119 * @param { GetImagePropertyOptions } options Index of the image. 4120 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, the default value is returned. 4121 * @syscap SystemCapability.Multimedia.Image.ImageSource 4122 * @since 7 4123 * @deprecated since 11 4124 * @useinstead image.ImageSource#getImageProperty 4125 */ 4126 /** 4127 * Obtains the value of a property in an image with the specified index. This method uses 4128 * a callback to return the property value in a string. 4129 * 4130 * @param { string } key Name of the property whose value is to be obtained. 4131 * @param { GetImagePropertyOptions } options Index of the image. 4132 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, the default value is returned. 4133 * @syscap SystemCapability.Multimedia.Image.ImageSource 4134 * @crossplatform 4135 * @since 10 4136 * @deprecated since 11 4137 * @useinstead image.ImageSource#getImageProperty 4138 */ 4139 getImageProperty(key: string, options: GetImagePropertyOptions, callback: AsyncCallback<string>): void; 4140 4141 /** 4142 * Modify the value of a property in an image with the specified key. This method uses a 4143 * promise to return the property value in a string. 4144 * 4145 * @param { PropertyKey } key - Name of the property whose value is to be modified. 4146 * @param { string } value - The value to be set to property. 4147 * @returns { Promise<void> } A Promise instance used to return the property value. 4148 * @throws { BusinessError } 401 - The parameter check failed. 4149 * @throws { BusinessError } 62980123 - Images in EXIF format are not supported. 4150 * @throws { BusinessError } 62980133 - The EXIF data is out of range. 4151 * @throws { BusinessError } 62980135 - The EXIF value is invalid. 4152 * @throws { BusinessError } 62980146 - The EXIF data failed to be written to the file. 4153 * @syscap SystemCapability.Multimedia.Image.ImageSource 4154 * @crossplatform 4155 * @since 11 4156 */ 4157 modifyImageProperty(key: PropertyKey, value: string): Promise<void>; 4158 4159 /** 4160 * Modify the value of a property in an image with the specified key. This method uses a 4161 * promise to return the property value in a string. 4162 * 4163 * @param { string } key Name of the property whose value is to be modified. 4164 * @param { string } value The value to be set to property. 4165 * @returns { Promise<void> } A Promise instance used to return the property value. 4166 * @syscap SystemCapability.Multimedia.Image.ImageSource 4167 * @since 9 4168 * @deprecated since 11 4169 * @useinstead image.ImageSource#modifyImageProperty 4170 */ 4171 /** 4172 * Modify the value of a property in an image with the specified key. This method uses a 4173 * promise to return the property value in a string. 4174 * 4175 * @param { string } key Name of the property whose value is to be modified. 4176 * @param { string } value The value to be set to property. 4177 * @returns { Promise<void> } A Promise instance used to return the property value. 4178 * @syscap SystemCapability.Multimedia.Image.ImageSource 4179 * @crossplatform 4180 * @since 10 4181 * @deprecated since 11 4182 * @useinstead image.ImageSource#modifyImageProperty 4183 */ 4184 modifyImageProperty(key: string, value: string): Promise<void>; 4185 4186 /** 4187 * Modify the value of a property in an image with the specified key. This method uses a callback to return the 4188 * property value in a string. 4189 * 4190 * @param { string } key Name of the property whose value is to be obtained. 4191 * @param { string } value The value to be set to property. 4192 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4193 * @syscap SystemCapability.Multimedia.Image.ImageSource 4194 * @since 9 4195 * @deprecated since 11 4196 * @useinstead image.ImageSource#modifyImageProperty 4197 */ 4198 /** 4199 * Modify the value of a property in an image with the specified key. This method uses a callback to return the 4200 * property value in a string. 4201 * 4202 * @param { string } key Name of the property whose value is to be obtained. 4203 * @param { string } value The value to be set to property. 4204 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4205 * @syscap SystemCapability.Multimedia.Image.ImageSource 4206 * @crossplatform 4207 * @since 10 4208 * @deprecated since 11 4209 * @useinstead image.ImageSource#modifyImageProperty 4210 */ 4211 modifyImageProperty(key: string, value: string, callback: AsyncCallback<void>): void; 4212 4213 /** 4214 * Update the data in the incremental ImageSource. 4215 * 4216 * @param { ArrayBuffer } buf The data to be updated. 4217 * @param { boolean } isFinished If is it finished. 4218 * @param { number } value The offset of data. 4219 * @param { number } length The length fo buf. 4220 * @returns { Promise<void> } A Promise instance used to return the property value. 4221 * @syscap SystemCapability.Multimedia.Image.ImageSource 4222 * @since 9 4223 */ 4224 /** 4225 * Update the data in the incremental ImageSource. 4226 * 4227 * @param { ArrayBuffer } buf The data to be updated. 4228 * @param { boolean } isFinished If is it finished. 4229 * @param { number } value The offset of data. 4230 * @param { number } length The length fo buf. 4231 * @returns { Promise<void> } A Promise instance used to return the property value. 4232 * @syscap SystemCapability.Multimedia.Image.ImageSource 4233 * @crossplatform 4234 * @since 10 4235 */ 4236 /** 4237 * Update the data in the incremental ImageSource. 4238 * 4239 * @param { ArrayBuffer } buf The data to be updated. 4240 * @param { boolean } isFinished If is it finished. 4241 * @param { number } offset The offset of data. 4242 * @param { number } length The length fo buf. 4243 * @returns { Promise<void> } A Promise instance used to return the property value. 4244 * @syscap SystemCapability.Multimedia.Image.ImageSource 4245 * @crossplatform 4246 * @since 11 4247 */ 4248 updateData(buf: ArrayBuffer, isFinished: boolean, offset: number, length: number): Promise<void>; 4249 4250 /** 4251 * Update the data in the incremental ImageSource. 4252 * 4253 * @param { ArrayBuffer } buf The data to be updated. 4254 * @param { boolean } isFinished If is it finished. 4255 * @param { number } value The offset of data. 4256 * @param { number } length The length fo buf. 4257 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4258 * @syscap SystemCapability.Multimedia.Image.ImageSource 4259 * @since 9 4260 */ 4261 /** 4262 * Update the data in the incremental ImageSource. 4263 * 4264 * @param { ArrayBuffer } buf The data to be updated. 4265 * @param { boolean } isFinished If is it finished. 4266 * @param { number } value The offset of data. 4267 * @param { number } length The length fo buf. 4268 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4269 * @syscap SystemCapability.Multimedia.Image.ImageSource 4270 * @crossplatform 4271 * @since 10 4272 */ 4273 /** 4274 * Update the data in the incremental ImageSource. 4275 * 4276 * @param { ArrayBuffer } buf The data to be updated. 4277 * @param { boolean } isFinished If is it finished. 4278 * @param { number } offset The offset of data. 4279 * @param { number } length The length fo buf. 4280 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4281 * @syscap SystemCapability.Multimedia.Image.ImageSource 4282 * @crossplatform 4283 * @since 11 4284 */ 4285 updateData( 4286 buf: ArrayBuffer, 4287 isFinished: boolean, 4288 offset: number, 4289 length: number, 4290 callback: AsyncCallback<void> 4291 ): void; 4292 4293 /** 4294 * Releases an ImageSource instance and uses a callback to return the result. 4295 * 4296 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4297 * @syscap SystemCapability.Multimedia.Image.ImageSource 4298 * @since 6 4299 */ 4300 /** 4301 * Releases an ImageSource instance and uses a callback to return the result. 4302 * 4303 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4304 * @syscap SystemCapability.Multimedia.Image.ImageSource 4305 * @crossplatform 4306 * @since 10 4307 */ 4308 release(callback: AsyncCallback<void>): void; 4309 4310 /** 4311 * Releases an ImageSource instance and uses a promise to return the result. 4312 * 4313 * @returns { Promise<void> } A Promise instance used to return the operation result. 4314 * @syscap SystemCapability.Multimedia.Image.ImageSource 4315 * @since 6 4316 */ 4317 /** 4318 * Releases an ImageSource instance and uses a promise to return the result. 4319 * 4320 * @returns { Promise<void> } A Promise instance used to return the operation result. 4321 * @syscap SystemCapability.Multimedia.Image.ImageSource 4322 * @crossplatform 4323 * @since 10 4324 */ 4325 release(): Promise<void>; 4326 4327 /** 4328 * Supported image formats. 4329 * 4330 * @type { Array<string> } 4331 * @syscap SystemCapability.Multimedia.Image.ImageSource 4332 * @since 6 4333 */ 4334 /** 4335 * Supported image formats. 4336 * 4337 * @type { Array<string> } 4338 * @syscap SystemCapability.Multimedia.Image.ImageSource 4339 * @crossplatform 4340 * @since 10 4341 */ 4342 readonly supportedFormats: Array<string>; 4343 } 4344 4345 /** 4346 * ImagePacker instance. 4347 * 4348 * @typedef ImagePacker 4349 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4350 * @since 6 4351 */ 4352 /** 4353 * ImagePacker instance. 4354 * 4355 * @typedef ImagePacker 4356 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4357 * @crossplatform 4358 * @since 10 4359 */ 4360 /** 4361 * ImagePacker instance. 4362 * 4363 * @typedef ImagePacker 4364 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4365 * @crossplatform 4366 * @atomicservice 4367 * @since 11 4368 */ 4369 interface ImagePacker { 4370 /** 4371 * Compresses or packs an image and uses a callback to return the result. 4372 * 4373 * @param { ImageSource } source Image to be processed. 4374 * @param { PackingOption } option Option for image packing. 4375 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 4376 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4377 * @since 6 4378 */ 4379 /** 4380 * Compresses or packs an image and uses a callback to return the result. 4381 * 4382 * @param { ImageSource } source Image to be processed. 4383 * @param { PackingOption } option Option for image packing. 4384 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 4385 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4386 * @crossplatform 4387 * @since 10 4388 */ 4389 /** 4390 * Compresses or packs an image and uses a callback to return the result. 4391 * 4392 * @param { ImageSource } source Image to be processed. 4393 * @param { PackingOption } option Option for image packing. 4394 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 4395 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4396 * @crossplatform 4397 * @atomicservice 4398 * @since 11 4399 */ 4400 packing(source: ImageSource, option: PackingOption, callback: AsyncCallback<ArrayBuffer>): void; 4401 4402 /** 4403 * Compresses or packs an image and uses a promise to return the result. 4404 * 4405 * @param { ImageSource } source Image to be processed. 4406 * @param { PackingOption } option Option for image packing. 4407 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 4408 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4409 * @since 6 4410 */ 4411 /** 4412 * Compresses or packs an image and uses a promise to return the result. 4413 * 4414 * @param { ImageSource } source Image to be processed. 4415 * @param { PackingOption } option Option for image packing. 4416 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 4417 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4418 * @crossplatform 4419 * @since 10 4420 */ 4421 /** 4422 * Compresses or packs an image and uses a promise to return the result. 4423 * 4424 * @param { ImageSource } source Image to be processed. 4425 * @param { PackingOption } option Option for image packing. 4426 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 4427 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4428 * @crossplatform 4429 * @atomicservice 4430 * @since 11 4431 */ 4432 packing(source: ImageSource, option: PackingOption): Promise<ArrayBuffer>; 4433 4434 /** 4435 * Compresses or packs an image and uses a callback to return the result. 4436 * 4437 * @param { PixelMap } source PixelMap to be processed. 4438 * @param { PackingOption } option Option for image packing. 4439 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 4440 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4441 * @since 8 4442 */ 4443 /** 4444 * Compresses or packs an image and uses a callback to return the result. 4445 * 4446 * @param { PixelMap } source PixelMap to be processed. 4447 * @param { PackingOption } option Option for image packing. 4448 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 4449 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4450 * @crossplatform 4451 * @since 10 4452 */ 4453 /** 4454 * Compresses or packs an image and uses a callback to return the result. 4455 * 4456 * @param { PixelMap } source PixelMap to be processed. 4457 * @param { PackingOption } option Option for image packing. 4458 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 4459 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4460 * @crossplatform 4461 * @atomicservice 4462 * @since 11 4463 */ 4464 packing(source: PixelMap, option: PackingOption, callback: AsyncCallback<ArrayBuffer>): void; 4465 4466 /** 4467 * Compresses or packs an image and uses a promise to return the result. 4468 * 4469 * @param { PixelMap } source PixelMap to be processed. 4470 * @param { PackingOption } option Option for image packing. 4471 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 4472 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4473 * @since 8 4474 */ 4475 /** 4476 * Compresses or packs an image and uses a promise to return the result. 4477 * 4478 * @param { PixelMap } source PixelMap to be processed. 4479 * @param { PackingOption } option Option for image packing. 4480 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 4481 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4482 * @crossplatform 4483 * @since 10 4484 */ 4485 /** 4486 * Compresses or packs an image and uses a promise to return the result. 4487 * 4488 * @param { PixelMap } source PixelMap to be processed. 4489 * @param { PackingOption } option Option for image packing. 4490 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 4491 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4492 * @crossplatform 4493 * @atomicservice 4494 * @since 11 4495 */ 4496 packing(source: PixelMap, option: PackingOption): Promise<ArrayBuffer>; 4497 4498 /** 4499 * Compresses or packs an image into a file and uses a callback to return the result. 4500 * 4501 * @param { ImageSource } source Image to be processed. 4502 * @param { number } fd ID of a file descriptor. 4503 * @param { PackingOption } options Options for image packing. 4504 * @param { AsyncCallback<void> } callback Callback used to return the operation result. 4505 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4506 * @crossplatform 4507 * @since 11 4508 */ 4509 packToFile(source: ImageSource, fd: number, options: PackingOption, callback: AsyncCallback<void>): void; 4510 4511 /** 4512 * Compresses or packs an image into a file and uses a promise to return the result. 4513 * 4514 * @param { ImageSource } source Image to be processed. 4515 * @param { number } fd ID of a file descriptor. 4516 * @param { PackingOption } options Options for image packing. 4517 * @returns { Promise<void> } A Promise instance used to return the operation result. 4518 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4519 * @crossplatform 4520 * @since 11 4521 */ 4522 packToFile(source: ImageSource, fd: number, options: PackingOption): Promise<void>; 4523 4524 /** 4525 * Compresses or packs an image into a file and uses a callback to return the result. 4526 * 4527 * @param { PixelMap } source PixelMap to be processed. 4528 * @param { number } fd ID of a file descriptor. 4529 * @param { PackingOption } options Options for image packing. 4530 * @param { AsyncCallback<void> } callback Callback used to return the operation result. 4531 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4532 * @crossplatform 4533 * @since 11 4534 */ 4535 packToFile(source: PixelMap, fd: number, options: PackingOption, callback: AsyncCallback<void>): void; 4536 4537 /** 4538 * Compresses or packs an image into a file and uses a promise to return the result. 4539 * 4540 * @param { PixelMap } source PixelMap to be processed. 4541 * @param { number } fd ID of a file descriptor. 4542 * @param { PackingOption } options Options for image packing. 4543 * @returns { Promise<void> } A Promise instance used to return the operation result. 4544 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4545 * @crossplatform 4546 * @since 11 4547 */ 4548 packToFile(source: PixelMap, fd: number, options: PackingOption): Promise<void>; 4549 4550 /** 4551 * Releases an ImagePacker instance and uses a callback to return the result. 4552 * 4553 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4554 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4555 * @since 6 4556 */ 4557 /** 4558 * Releases an ImagePacker instance and uses a callback to return the result. 4559 * 4560 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4561 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4562 * @crossplatform 4563 * @since 10 4564 */ 4565 release(callback: AsyncCallback<void>): void; 4566 4567 /** 4568 * Releases an ImagePacker instance and uses a promise to return the result. 4569 * 4570 * @returns { Promise<void> } A Promise instance used to return the operation result. 4571 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4572 * @since 6 4573 */ 4574 /** 4575 * Releases an ImagePacker instance and uses a promise to return the result. 4576 * 4577 * @returns { Promise<void> } A Promise instance used to return the operation result. 4578 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4579 * @crossplatform 4580 * @since 10 4581 */ 4582 release(): Promise<void>; 4583 4584 /** 4585 * Supported image formats. 4586 * 4587 * @type { Array<string> } 4588 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4589 * @since 6 4590 */ 4591 /** 4592 * Supported image formats. 4593 * 4594 * @type { Array<string> } 4595 * @syscap SystemCapability.Multimedia.Image.ImagePacker 4596 * @crossplatform 4597 * @since 10 4598 */ 4599 readonly supportedFormats: Array<string>; 4600 } 4601 4602 /** 4603 * Provides basic image operations, including obtaining image information, and reading and writing image data. 4604 * 4605 * @typedef Image 4606 * @syscap SystemCapability.Multimedia.Image.Core 4607 * @since 9 4608 */ 4609 interface Image { 4610 /** 4611 * Sets or gets the image area to crop, default is size. 4612 * 4613 * @type { Region } 4614 * @syscap SystemCapability.Multimedia.Image.Core 4615 * @since 9 4616 */ 4617 clipRect: Region; 4618 4619 /** 4620 * Image size. 4621 * 4622 * @type { Size } 4623 * @syscap SystemCapability.Multimedia.Image.Core 4624 * @since 9 4625 */ 4626 readonly size: Size; 4627 4628 /** 4629 * Image format. 4630 * 4631 * @type { number } 4632 * @syscap SystemCapability.Multimedia.Image.Core 4633 * @since 9 4634 */ 4635 readonly format: number; 4636 4637 /** 4638 * Get component buffer from image and uses a callback to return the result. 4639 * 4640 * @param { ComponentType } componentType The component type of image. 4641 * @param { AsyncCallback<Component> } callback Callback used to return the component buffer. 4642 * @syscap SystemCapability.Multimedia.Image.Core 4643 * @since 9 4644 */ 4645 getComponent(componentType: ComponentType, callback: AsyncCallback<Component>): void; 4646 4647 /** 4648 * Get component buffer from image and uses a promise to return the result. 4649 * 4650 * @param { ComponentType } componentType The component type of image. 4651 * @returns { Promise<Component> } A Promise instance used to return the component buffer. 4652 * @syscap SystemCapability.Multimedia.Image.Core 4653 * @since 9 4654 */ 4655 getComponent(componentType: ComponentType): Promise<Component>; 4656 4657 /** 4658 * Release current image to receive another and uses a callback to return the result. 4659 * 4660 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4661 * @syscap SystemCapability.Multimedia.Image.Core 4662 * @since 9 4663 */ 4664 release(callback: AsyncCallback<void>): void; 4665 4666 /** 4667 * Release current image to receive another and uses a promise to return the result. 4668 * 4669 * @returns { Promise<void> } A Promise instance used to return the operation result. 4670 * @syscap SystemCapability.Multimedia.Image.Core 4671 * @since 9 4672 */ 4673 release(): Promise<void>; 4674 } 4675 4676 /** 4677 * Image receiver object. 4678 * 4679 * @typedef ImageReceiver 4680 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4681 * @since 9 4682 */ 4683 interface ImageReceiver { 4684 /** 4685 * Image size. 4686 * 4687 * @type { Size } 4688 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4689 * @since 9 4690 */ 4691 readonly size: Size; 4692 4693 /** 4694 * Image capacity. 4695 * 4696 * @type { number } 4697 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4698 * @since 9 4699 */ 4700 readonly capacity: number; 4701 4702 /** 4703 * Image format. 4704 * 4705 * @type { ImageFormat } 4706 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4707 * @since 9 4708 */ 4709 readonly format: ImageFormat; 4710 4711 /** 4712 * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface 4713 * and uses a callback to return the result. 4714 * 4715 * @param { AsyncCallback<string> } callback Callback used to return the surface id. 4716 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4717 * @since 9 4718 */ 4719 getReceivingSurfaceId(callback: AsyncCallback<string>): void; 4720 4721 /** 4722 * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface 4723 * and uses a promise to return the result. 4724 * 4725 * @returns { Promise<string> } A Promise instance used to return the surface id. 4726 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4727 * @since 9 4728 */ 4729 getReceivingSurfaceId(): Promise<string>; 4730 4731 /** 4732 * Get lasted image from receiver and uses a callback to return the result. 4733 * 4734 * @param { AsyncCallback<Image> } callback Callback used to return the latest image. 4735 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4736 * @since 9 4737 */ 4738 readLatestImage(callback: AsyncCallback<Image>): void; 4739 4740 /** 4741 * Get lasted image from receiver and uses a promise to return the result. 4742 * 4743 * @returns { Promise<Image> } A Promise instance used to return the latest image. 4744 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4745 * @since 9 4746 */ 4747 readLatestImage(): Promise<Image>; 4748 4749 /** 4750 * Get next image from receiver and uses a callback to return the result. 4751 * 4752 * @param { AsyncCallback<Image> } callback Callback used to return the next image. 4753 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4754 * @since 9 4755 */ 4756 readNextImage(callback: AsyncCallback<Image>): void; 4757 4758 /** 4759 * Get next image from receiver and uses a promise to return the result. 4760 * 4761 * @returns { Promise<Image> } A Promise instance used to return the next image. 4762 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4763 * @since 9 4764 */ 4765 readNextImage(): Promise<Image>; 4766 4767 /** 4768 * Subscribe callback when receiving an image 4769 * 4770 * @param { 'imageArrival' } type Callback used to return the next image. 4771 * @param { AsyncCallback<void> } callback Callback used to return image. 4772 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4773 * @since 9 4774 */ 4775 on(type: 'imageArrival', callback: AsyncCallback<void>): void; 4776 4777 /** 4778 * Release image receiver instance and uses a callback to return the result. 4779 * 4780 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4781 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4782 * @since 9 4783 */ 4784 release(callback: AsyncCallback<void>): void; 4785 4786 /** 4787 * Release image receiver instance and uses a promise to return the result. 4788 * 4789 * @returns { Promise<void> } A Promise instance used to return the operation result. 4790 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 4791 * @since 9 4792 */ 4793 release(): Promise<void>; 4794 } 4795 4796 /** 4797 * Image creator object. 4798 * 4799 * @typedef ImageCreator 4800 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4801 * @since 9 4802 */ 4803 interface ImageCreator { 4804 /** 4805 * Image capacity. 4806 * 4807 * @type { number } 4808 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4809 * @since 9 4810 */ 4811 readonly capacity: number; 4812 4813 /** 4814 * Image format. 4815 * 4816 * @type { ImageFormat } 4817 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4818 * @since 9 4819 */ 4820 readonly format: ImageFormat; 4821 4822 /** 4823 * Apply for new graphic buffer from free queue and use a callback to return the result. 4824 * 4825 * @param { AsyncCallback<Image> } callback Callback to return the operation result. 4826 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4827 * @since 9 4828 */ 4829 dequeueImage(callback: AsyncCallback<Image>): void; 4830 4831 /** 4832 * Apply for new graphic buffer from free queue and uses a promise to return the result. 4833 * 4834 * @returns { Promise<Image> } A Promise instance used to return the operation result. 4835 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4836 * @since 9 4837 */ 4838 dequeueImage(): Promise<Image>; 4839 4840 /** 4841 * Queue buffer to dirty queue and uses a callback to return the result. 4842 * 4843 * @param { Image } interface 4844 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4845 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4846 * @since 9 4847 */ 4848 queueImage(interface: Image, callback: AsyncCallback<void>): void; 4849 4850 /** 4851 * Queue buffer to dirty queue and uses a promise to return the result. 4852 * 4853 * @param { Image } interface 4854 * @returns { Promise<void> } A Promise instance used to return the operation result. 4855 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4856 * @since 9 4857 */ 4858 queueImage(interface: Image): Promise<void>; 4859 4860 /** 4861 * Subscribe callback when releasing buffer 4862 * 4863 * @param { 'imageRelease' } type Callback used to return the operation result. 4864 * @param { AsyncCallback<void> } callback Callback used to return the operation result. 4865 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4866 * @since 9 4867 */ 4868 on(type: 'imageRelease', callback: AsyncCallback<void>): void; 4869 4870 /** 4871 * Releases buffer in bufferqueue instance and uses a callback to return the result. 4872 * 4873 * @param { AsyncCallback<void> } callback Callback to return the operation result. 4874 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4875 * @since 9 4876 */ 4877 release(callback: AsyncCallback<void>): void; 4878 4879 /** 4880 * Releases buffer in bufferqueue instance and uses a promise to return the result. 4881 * 4882 * @returns { Promise<void> } A Promise instance used to return the operation result. 4883 * @syscap SystemCapability.Multimedia.Image.ImageCreator 4884 * @since 9 4885 */ 4886 release(): Promise<void>; 4887 } 4888} 4889 4890export default image; 4891