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 16import { AsyncCallback } from './@ohos.base'; 17import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; 18import type rpc from './@ohos.rpc'; 19 20/** 21 * @namespace image 22 * @since 6 23 */ 24declare namespace image { 25 /** 26 * Enumerates pixel map formats. 27 * 28 * @enum { number } 29 * @syscap SystemCapability.Multimedia.Image.Core 30 * @since 7 31 */ 32 /** 33 * Enumerates pixel map formats. 34 * 35 * @enum { number } 36 * @syscap SystemCapability.Multimedia.Image.Core 37 * @crossplatform 38 * @since 10 39 */ 40 enum PixelMapFormat { 41 /** 42 * Indicates an unknown format. 43 * 44 * @syscap SystemCapability.Multimedia.Image.Core 45 * @since 7 46 */ 47 /** 48 * Indicates an unknown format. 49 * 50 * @syscap SystemCapability.Multimedia.Image.Core 51 * @crossplatform 52 * @since 10 53 */ 54 UNKNOWN = 0, 55 56 /** 57 * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded 58 * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, 59 * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. 60 * 61 * @syscap SystemCapability.Multimedia.Image.Core 62 * @since 7 63 */ 64 /** 65 * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded 66 * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, 67 * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. 68 * 69 * @syscap SystemCapability.Multimedia.Image.Core 70 * @crossplatform 71 * @since 10 72 */ 73 RGB_565 = 2, 74 75 /** 76 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 77 * and are stored from the higher-order to the lower-order bits. 78 * 79 * @syscap SystemCapability.Multimedia.Image.Core 80 * @since 7 81 */ 82 /** 83 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 84 * and are stored from the higher-order to the lower-order bits. 85 * 86 * @syscap SystemCapability.Multimedia.Image.Core 87 * @crossplatform 88 * @since 10 89 */ 90 RGBA_8888 = 3, 91 92 /** 93 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 94 * and are stored from the higher-order to the lower-order bits. 95 * 96 * @syscap SystemCapability.Multimedia.Image.Core 97 * @since 9 98 */ 99 /** 100 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 101 * and are stored from the higher-order to the lower-order bits. 102 * 103 * @syscap SystemCapability.Multimedia.Image.Core 104 * @crossplatform 105 * @since 10 106 */ 107 BGRA_8888 = 4, 108 109 /** 110 * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) 111 * and are stored from the higher-order to the lower-order bits. 112 * 113 * @syscap SystemCapability.Multimedia.Image.Core 114 * @since 9 115 */ 116 /** 117 * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) 118 * and are stored from the higher-order to the lower-order bits. 119 * 120 * @syscap SystemCapability.Multimedia.Image.Core 121 * @crossplatform 122 * @since 10 123 */ 124 RGB_888 = 5, 125 126 /** 127 * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) 128 * and is stored from the higher-order to the lower-order bits. 129 * 130 * @syscap SystemCapability.Multimedia.Image.Core 131 * @since 9 132 */ 133 /** 134 * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) 135 * and is stored from the higher-order to the lower-order bits. 136 * 137 * @syscap SystemCapability.Multimedia.Image.Core 138 * @crossplatform 139 * @since 10 140 */ 141 ALPHA_8 = 6, 142 143 /** 144 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 145 * and are stored from the higher-order to the lower-order bits in F16. 146 * 147 * @syscap SystemCapability.Multimedia.Image.Core 148 * @since 9 149 */ 150 /** 151 * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) 152 * and are stored from the higher-order to the lower-order bits in F16. 153 * 154 * @syscap SystemCapability.Multimedia.Image.Core 155 * @crossplatform 156 * @since 10 157 */ 158 RGBA_F16 = 7, 159 160 /** 161 * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits 162 * and are stored from the higher-order to the lower-order bits. 163 * 164 * @syscap SystemCapability.Multimedia.Image.Core 165 * @since 9 166 */ 167 /** 168 * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits 169 * and are stored from the higher-order to the lower-order bits. 170 * 171 * @syscap SystemCapability.Multimedia.Image.Core 172 * @crossplatform 173 * @since 10 174 */ 175 NV21 = 8, 176 177 /** 178 * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits 179 * and are stored from the higher-order to the lower-order bits. 180 * 181 * @syscap SystemCapability.Multimedia.Image.Core 182 * @since 9 183 */ 184 /** 185 * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits 186 * and are stored from the higher-order to the lower-order bits. 187 * 188 * @syscap SystemCapability.Multimedia.Image.Core 189 * @crossplatform 190 * @since 10 191 */ 192 NV12 = 9 193 } 194 195 /** 196 * Describes the size of an image. 197 * 198 * @typedef Size 199 * @syscap SystemCapability.Multimedia.Image.Core 200 * @since 6 201 */ 202 /** 203 * Describes the size of an image. 204 * 205 * @typedef Size 206 * @syscap SystemCapability.Multimedia.Image.Core 207 * @crossplatform 208 * @since 10 209 */ 210 interface Size { 211 /** 212 * Height 213 * 214 * @type { number } 215 * @syscap SystemCapability.Multimedia.Image.Core 216 * @since 6 217 */ 218 /** 219 * Height 220 * 221 * @type { number } 222 * @syscap SystemCapability.Multimedia.Image.Core 223 * @crossplatform 224 * @since 10 225 */ 226 height: number; 227 228 /** 229 * Width 230 * 231 * @type { number } 232 * @syscap SystemCapability.Multimedia.Image.Core 233 * @since 6 234 */ 235 /** 236 * Width 237 * 238 * @type { number } 239 * @syscap SystemCapability.Multimedia.Image.Core 240 * @crossplatform 241 * @since 10 242 */ 243 width: number; 244 } 245 246 /** 247 * Enumerates exchangeable image file format (Exif) information types of an image. 248 * 249 * @enum { string } 250 * @syscap SystemCapability.Multimedia.Image.Core 251 * @since 7 252 */ 253 /** 254 * Enumerates exchangeable image file format (Exif) information types of an image. 255 * 256 * @enum { string } 257 * @syscap SystemCapability.Multimedia.Image.Core 258 * @crossplatform 259 * @since 10 260 */ 261 enum PropertyKey { 262 /** 263 * Number of bits in each pixel of an image. 264 * 265 * @syscap SystemCapability.Multimedia.Image.Core 266 * @since 7 267 */ 268 /** 269 * Number of bits in each pixel of an image. 270 * 271 * @syscap SystemCapability.Multimedia.Image.Core 272 * @crossplatform 273 * @since 10 274 */ 275 BITS_PER_SAMPLE = 'BitsPerSample', 276 277 /** 278 * Image rotation mode. 279 * 280 * @syscap SystemCapability.Multimedia.Image.Core 281 * @since 7 282 */ 283 /** 284 * Image rotation mode. 285 * 286 * @syscap SystemCapability.Multimedia.Image.Core 287 * @crossplatform 288 * @since 10 289 */ 290 ORIENTATION = 'Orientation', 291 292 /** 293 * Image length. 294 * 295 * @syscap SystemCapability.Multimedia.Image.Core 296 * @since 7 297 */ 298 /** 299 * Image length. 300 * 301 * @syscap SystemCapability.Multimedia.Image.Core 302 * @crossplatform 303 * @since 10 304 */ 305 IMAGE_LENGTH = 'ImageLength', 306 307 /** 308 * Image width. 309 * 310 * @syscap SystemCapability.Multimedia.Image.Core 311 * @since 7 312 */ 313 /** 314 * Image width. 315 * 316 * @syscap SystemCapability.Multimedia.Image.Core 317 * @crossplatform 318 * @since 10 319 */ 320 IMAGE_WIDTH = 'ImageWidth', 321 322 /** 323 * GPS latitude. 324 * 325 * @syscap SystemCapability.Multimedia.Image.Core 326 * @since 7 327 */ 328 /** 329 * GPS latitude. 330 * 331 * @syscap SystemCapability.Multimedia.Image.Core 332 * @crossplatform 333 * @since 10 334 */ 335 GPS_LATITUDE = 'GPSLatitude', 336 337 /** 338 * GPS longitude. 339 * 340 * @syscap SystemCapability.Multimedia.Image.Core 341 * @since 7 342 */ 343 /** 344 * GPS longitude. 345 * 346 * @syscap SystemCapability.Multimedia.Image.Core 347 * @crossplatform 348 * @since 10 349 */ 350 GPS_LONGITUDE = 'GPSLongitude', 351 352 /** 353 * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude. 354 * 355 * @syscap SystemCapability.Multimedia.Image.Core 356 * @since 7 357 */ 358 /** 359 * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude. 360 * 361 * @syscap SystemCapability.Multimedia.Image.Core 362 * @crossplatform 363 * @since 10 364 */ 365 GPS_LATITUDE_REF = 'GPSLatitudeRef', 366 367 /** 368 * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude. 369 * 370 * @syscap SystemCapability.Multimedia.Image.Core 371 * @since 7 372 */ 373 /** 374 * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude. 375 * 376 * @syscap SystemCapability.Multimedia.Image.Core 377 * @crossplatform 378 * @since 10 379 */ 380 GPS_LONGITUDE_REF = 'GPSLongitudeRef', 381 382 /** 383 * Shooting time 384 * 385 * @syscap SystemCapability.Multimedia.Image.Core 386 * @since 9 387 */ 388 /** 389 * Shooting time 390 * 391 * @syscap SystemCapability.Multimedia.Image.Core 392 * @crossplatform 393 * @since 10 394 */ 395 DATE_TIME_ORIGINAL = 'DateTimeOriginal', 396 397 /** 398 * Exposure time 399 * 400 * @syscap SystemCapability.Multimedia.Image.Core 401 * @since 9 402 */ 403 /** 404 * Exposure time 405 * 406 * @syscap SystemCapability.Multimedia.Image.Core 407 * @crossplatform 408 * @since 10 409 */ 410 EXPOSURE_TIME = 'ExposureTime', 411 412 /** 413 * Scene type 414 * 415 * @syscap SystemCapability.Multimedia.Image.Core 416 * @since 9 417 */ 418 /** 419 * Scene type 420 * 421 * @syscap SystemCapability.Multimedia.Image.Core 422 * @crossplatform 423 * @since 10 424 */ 425 SCENE_TYPE = 'SceneType', 426 427 /** 428 * ISO speedratings 429 * 430 * @syscap SystemCapability.Multimedia.Image.Core 431 * @since 9 432 */ 433 /** 434 * ISO speedratings 435 * 436 * @syscap SystemCapability.Multimedia.Image.Core 437 * @crossplatform 438 * @since 10 439 */ 440 ISO_SPEED_RATINGS = 'ISOSpeedRatings', 441 442 /** 443 * Aperture value 444 * 445 * @syscap SystemCapability.Multimedia.Image.Core 446 * @since 9 447 */ 448 /** 449 * Aperture value 450 * 451 * @syscap SystemCapability.Multimedia.Image.Core 452 * @crossplatform 453 * @since 10 454 */ 455 F_NUMBER = 'FNumber', 456 457 /** 458 * Date time 459 * 460 * @syscap SystemCapability.Multimedia.Image.Core 461 * @since 10 462 */ 463 DATE_TIME = 'DateTime', 464 465 /** 466 * GPS time stamp 467 * 468 * @syscap SystemCapability.Multimedia.Image.Core 469 * @since 10 470 */ 471 GPS_TIME_STAMP = 'GPSTimeStamp', 472 473 /** 474 * GPS date stamp 475 * 476 * @syscap SystemCapability.Multimedia.Image.Core 477 * @since 10 478 */ 479 GPS_DATE_STAMP = 'GPSDateStamp', 480 481 /** 482 * Image description 483 * 484 * @syscap SystemCapability.Multimedia.Image.Core 485 * @since 10 486 */ 487 IMAGE_DESCRIPTION = 'ImageDescription', 488 489 /** 490 * Make 491 * 492 * @syscap SystemCapability.Multimedia.Image.Core 493 * @since 10 494 */ 495 MAKE = 'Make', 496 497 /** 498 * Model 499 * 500 * @syscap SystemCapability.Multimedia.Image.Core 501 * @since 10 502 */ 503 MODEL = 'Model', 504 505 /** 506 * Photo mode 507 * 508 * @syscap SystemCapability.Multimedia.Image.Core 509 * @since 10 510 */ 511 PHOTO_MODE = 'PhotoMode', 512 513 /** 514 * Sensitivity type 515 * 516 * @syscap SystemCapability.Multimedia.Image.Core 517 * @since 10 518 */ 519 SENSITIVITY_TYPE = 'SensitivityType', 520 521 /** 522 * Standard output sensitivity 523 * 524 * @syscap SystemCapability.Multimedia.Image.Core 525 * @since 10 526 */ 527 STANDARD_OUTPUT_SENSITIVITY = 'StandardOutputSensitivity', 528 529 /** 530 * Recommended exposure index 531 * 532 * @syscap SystemCapability.Multimedia.Image.Core 533 * @since 10 534 */ 535 RECOMMENDED_EXPOSURE_INDEX = 'RecommendedExposureIndex', 536 537 /** 538 * ISO speed 539 * 540 * @syscap SystemCapability.Multimedia.Image.Core 541 * @since 10 542 */ 543 ISO_SPEED = 'ISOSpeedRatings', 544 545 /** 546 * Aperture value 547 * 548 * @syscap SystemCapability.Multimedia.Image.Core 549 * @since 10 550 */ 551 APERTURE_VALUE = 'ApertureValue', 552 553 /** 554 * Exposure bias value 555 * 556 * @syscap SystemCapability.Multimedia.Image.Core 557 * @since 10 558 */ 559 EXPOSURE_BIAS_VALUE = 'ExposureBiasValue', 560 561 /** 562 * Metering mode 563 * 564 * @syscap SystemCapability.Multimedia.Image.Core 565 * @since 10 566 */ 567 METERING_MODE = 'MeteringMode', 568 569 /** 570 * Light source 571 * 572 * @syscap SystemCapability.Multimedia.Image.Core 573 * @since 10 574 */ 575 LIGHT_SOURCE = 'LightSource', 576 577 /** 578 * Flash 579 * 580 * @syscap SystemCapability.Multimedia.Image.Core 581 * @since 10 582 */ 583 FLASH = 'Flash', 584 585 /** 586 * Focal length 587 * 588 * @syscap SystemCapability.Multimedia.Image.Core 589 * @since 10 590 */ 591 FOCAL_LENGTH = 'FocalLength', 592 593 /** 594 * User comment 595 * 596 * @syscap SystemCapability.Multimedia.Image.Core 597 * @since 10 598 */ 599 USER_COMMENT = 'UserComment', 600 601 /** 602 * Pixel x dimension 603 * 604 * @syscap SystemCapability.Multimedia.Image.Core 605 * @since 10 606 */ 607 PIXEL_X_DIMENSION = 'PixelXDimension', 608 609 /** 610 * Pixel y dimension 611 * 612 * @syscap SystemCapability.Multimedia.Image.Core 613 * @since 10 614 */ 615 PIXEL_Y_DIMENSION = 'PixelYDimension', 616 617 /** 618 * White balance 619 * 620 * @syscap SystemCapability.Multimedia.Image.Core 621 * @since 10 622 */ 623 WHITE_BALANCE = 'WhiteBalance', 624 625 /** 626 * Focal length in 35mm film 627 * 628 * @syscap SystemCapability.Multimedia.Image.Core 629 * @since 10 630 */ 631 FOCAL_LENGTH_IN_35_MM_FILM = 'FocalLengthIn35mmFilm', 632 633 /** 634 * Capture mode 635 * 636 * @syscap SystemCapability.Multimedia.Image.Core 637 * @since 10 638 */ 639 CAPTURE_MODE = 'HwMnoteCaptureMode', 640 641 /** 642 * Physical aperture 643 * 644 * @syscap SystemCapability.Multimedia.Image.Core 645 * @since 10 646 */ 647 PHYSICAL_APERTURE = 'HwMnotePhysicalAperture' 648 } 649 650 /** 651 * Enum for image formats. 652 * 653 * @enum { number } 654 * @syscap SystemCapability.Multimedia.Image.Core 655 * @since 9 656 */ 657 enum ImageFormat { 658 /** 659 * YCBCR422 semi-planar format. 660 * 661 * @syscap SystemCapability.Multimedia.Image.Core 662 * @since 9 663 */ 664 YCBCR_422_SP = 1000, 665 666 /** 667 * JPEG encoding format. 668 * 669 * @syscap SystemCapability.Multimedia.Image.Core 670 * @since 9 671 */ 672 JPEG = 2000 673 } 674 675 /** 676 * Enumerates alpha types. 677 * 678 * @enum { number } 679 * @syscap SystemCapability.Multimedia.Image.Core 680 * @since 9 681 */ 682 /** 683 * Enumerates alpha types. 684 * 685 * @enum { number } 686 * @syscap SystemCapability.Multimedia.Image.Core 687 * @crossplatform 688 * @since 10 689 */ 690 enum AlphaType { 691 /** 692 * Indicates an unknown alpha type. 693 * 694 * @syscap SystemCapability.Multimedia.Image.Core 695 * @since 9 696 */ 697 /** 698 * Indicates an unknown alpha type. 699 * 700 * @syscap SystemCapability.Multimedia.Image.Core 701 * @crossplatform 702 * @since 10 703 */ 704 UNKNOWN = 0, 705 706 /** 707 * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. 708 * 709 * @syscap SystemCapability.Multimedia.Image.Core 710 * @since 9 711 */ 712 /** 713 * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. 714 * 715 * @syscap SystemCapability.Multimedia.Image.Core 716 * @crossplatform 717 * @since 10 718 */ 719 OPAQUE = 1, 720 721 /** 722 * Indicates that RGB components of each pixel in the image are premultiplied by alpha. 723 * 724 * @syscap SystemCapability.Multimedia.Image.Core 725 * @since 9 726 */ 727 /** 728 * Indicates that RGB components of each pixel in the image are premultiplied by alpha. 729 * 730 * @syscap SystemCapability.Multimedia.Image.Core 731 * @crossplatform 732 * @since 10 733 */ 734 PREMUL = 2, 735 736 /** 737 * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. 738 * 739 * @syscap SystemCapability.Multimedia.Image.Core 740 * @since 9 741 */ 742 /** 743 * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. 744 * 745 * @syscap SystemCapability.Multimedia.Image.Core 746 * @crossplatform 747 * @since 10 748 */ 749 UNPREMUL = 3 750 } 751 752 /** 753 * Enum for image scale mode. 754 * 755 * @enum { number } 756 * @syscap SystemCapability.Multimedia.Image.Core 757 * @since 9 758 */ 759 /** 760 * Enum for image scale mode. 761 * 762 * @enum { number } 763 * @syscap SystemCapability.Multimedia.Image.Core 764 * @crossplatform 765 * @since 10 766 */ 767 enum ScaleMode { 768 /** 769 * Indicates the effect that fits the image into the target size. 770 * 771 * @syscap SystemCapability.Multimedia.Image.Core 772 * @since 9 773 */ 774 /** 775 * Indicates the effect that fits the image into the target size. 776 * 777 * @syscap SystemCapability.Multimedia.Image.Core 778 * @crossplatform 779 * @since 10 780 */ 781 FIT_TARGET_SIZE = 0, 782 783 /** 784 * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. 785 * 786 * @syscap SystemCapability.Multimedia.Image.Core 787 * @since 9 788 */ 789 /** 790 * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. 791 * 792 * @syscap SystemCapability.Multimedia.Image.Core 793 * @crossplatform 794 * @since 10 795 */ 796 CENTER_CROP = 1 797 } 798 799 /** 800 * The component type of image. 801 * 802 * @enum { number } 803 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 804 * @since 9 805 */ 806 enum ComponentType { 807 /** 808 * Luma info. 809 * 810 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 811 * @since 9 812 */ 813 YUV_Y = 1, 814 815 /** 816 * Chrominance info. 817 * 818 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 819 * @since 9 820 */ 821 YUV_U = 2, 822 823 /** 824 * Chroma info. 825 * 826 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 827 * @since 9 828 */ 829 YUV_V = 3, 830 831 /** 832 * Jpeg type. 833 * 834 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 835 * @since 9 836 */ 837 JPEG = 4 838 } 839 840 /** 841 * Describes region information. 842 * 843 * @typedef Region 844 * @syscap SystemCapability.Multimedia.Image.Core 845 * @since 8 846 */ 847 /** 848 * Describes region information. 849 * 850 * @typedef Region 851 * @syscap SystemCapability.Multimedia.Image.Core 852 * @crossplatform 853 * @since 10 854 */ 855 interface Region { 856 /** 857 * Image size. 858 * 859 * @type { Size } 860 * @syscap SystemCapability.Multimedia.Image.Core 861 * @since 7 862 */ 863 /** 864 * Image size. 865 * 866 * @type { Size } 867 * @syscap SystemCapability.Multimedia.Image.Core 868 * @crossplatform 869 * @since 10 870 */ 871 size: Size; 872 873 /** 874 * x-coordinate at the upper left corner of the image. 875 * 876 * @type { number } 877 * @syscap SystemCapability.Multimedia.Image.Core 878 * @since 7 879 */ 880 /** 881 * x-coordinate at the upper left corner of the image. 882 * 883 * @type { number } 884 * @syscap SystemCapability.Multimedia.Image.Core 885 * @crossplatform 886 * @since 10 887 */ 888 x: number; 889 890 /** 891 * y-coordinate at the upper left corner of the image. 892 * 893 * @type { number } 894 * @syscap SystemCapability.Multimedia.Image.Core 895 * @since 7 896 */ 897 /** 898 * y-coordinate at the upper left corner of the image. 899 * 900 * @type { number } 901 * @syscap SystemCapability.Multimedia.Image.Core 902 * @crossplatform 903 * @since 10 904 */ 905 y: number; 906 } 907 908 /** 909 * Describes area information in an image. 910 * 911 * @typedef PositionArea 912 * @syscap SystemCapability.Multimedia.Image.Core 913 * @since 7 914 */ 915 /** 916 * Describes area information in an image. 917 * 918 * @typedef PositionArea 919 * @syscap SystemCapability.Multimedia.Image.Core 920 * @crossplatform 921 * @since 10 922 */ 923 interface PositionArea { 924 /** 925 * Image data that will be read or written. 926 * 927 * @type { ArrayBuffer } 928 * @syscap SystemCapability.Multimedia.Image.Core 929 * @since 7 930 */ 931 /** 932 * Image data that will be read or written. 933 * 934 * @type { ArrayBuffer } 935 * @syscap SystemCapability.Multimedia.Image.Core 936 * @crossplatform 937 * @since 10 938 */ 939 pixels: ArrayBuffer; 940 941 /** 942 * Offset for data reading. 943 * 944 * @type { number } 945 * @syscap SystemCapability.Multimedia.Image.Core 946 * @since 7 947 */ 948 /** 949 * Offset for data reading. 950 * 951 * @type { number } 952 * @syscap SystemCapability.Multimedia.Image.Core 953 * @crossplatform 954 * @since 10 955 */ 956 offset: number; 957 958 /** 959 * Number of bytes to read. 960 * 961 * @type { number } 962 * @syscap SystemCapability.Multimedia.Image.Core 963 * @since 7 964 */ 965 /** 966 * Number of bytes to read. 967 * 968 * @type { number } 969 * @syscap SystemCapability.Multimedia.Image.Core 970 * @crossplatform 971 * @since 10 972 */ 973 stride: number; 974 975 /** 976 * Region to read. 977 * 978 * @type { Region } 979 * @syscap SystemCapability.Multimedia.Image.Core 980 * @since 7 981 */ 982 /** 983 * Region to read. 984 * 985 * @type { Region } 986 * @syscap SystemCapability.Multimedia.Image.Core 987 * @crossplatform 988 * @since 10 989 */ 990 region: Region; 991 } 992 993 /** 994 * Describes image information. 995 * 996 * @typedef ImageInfo 997 * @syscap SystemCapability.Multimedia.Image.Core 998 * @since 6 999 */ 1000 /** 1001 * Describes image information. 1002 * 1003 * @typedef ImageInfo 1004 * @syscap SystemCapability.Multimedia.Image.Core 1005 * @crossplatform 1006 * @since 10 1007 */ 1008 interface ImageInfo { 1009 /** 1010 * Indicates image dimensions specified by a {@link Size} interface. 1011 * 1012 * @type { Size } 1013 * @syscap SystemCapability.Multimedia.Image.Core 1014 * @since 6 1015 */ 1016 /** 1017 * Indicates image dimensions specified by a {@link Size} interface. 1018 * 1019 * @type { Size } 1020 * @syscap SystemCapability.Multimedia.Image.Core 1021 * @crossplatform 1022 * @since 10 1023 */ 1024 size: Size; 1025 1026 /** 1027 * Indicates image default density. 1028 * 1029 * @type { number } 1030 * @syscap SystemCapability.Multimedia.Image.Core 1031 * @since 9 1032 */ 1033 /** 1034 * Indicates image default density. 1035 * 1036 * @type { number } 1037 * @syscap SystemCapability.Multimedia.Image.Core 1038 * @crossplatform 1039 * @since 10 1040 */ 1041 density: number; 1042 } 1043 1044 /** 1045 * Describes the option for image packing. 1046 * 1047 * @typedef PackingOption 1048 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1049 * @since 6 1050 */ 1051 /** 1052 * Describes the option for image packing. 1053 * 1054 * @typedef PackingOption 1055 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1056 * @crossplatform 1057 * @since 10 1058 */ 1059 interface PackingOption { 1060 /** 1061 * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. 1062 * 1063 * @type { string } 1064 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1065 * @since 6 1066 */ 1067 /** 1068 * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. 1069 * 1070 * @type { string } 1071 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1072 * @crossplatform 1073 * @since 10 1074 */ 1075 format: string; 1076 1077 /** 1078 * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. 1079 * 1080 * @type { number } 1081 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1082 * @since 6 1083 */ 1084 /** 1085 * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. 1086 * 1087 * @type { number } 1088 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1089 * @crossplatform 1090 * @since 10 1091 */ 1092 quality: number; 1093 1094 /** 1095 * BufferSize of the target image. 1096 * If this bufferSize is less than or equal to 0, it will be converted to 10MB. 1097 * 1098 * @type { ?number } 1099 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1100 * @since 9 1101 */ 1102 /** 1103 * BufferSize of the target image. 1104 * If this bufferSize is less than or equal to 0, it will be converted to 10MB. 1105 * 1106 * @type { ?number } 1107 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1108 * @crossplatform 1109 * @since 10 1110 */ 1111 bufferSize?: number; 1112 } 1113 1114 /** 1115 * Describes image properties. 1116 * 1117 * @typedef GetImagePropertyOptions 1118 * @syscap SystemCapability.Multimedia.Image.ImageSource 1119 * @since 7 1120 */ 1121 /** 1122 * Describes image properties. 1123 * 1124 * @typedef GetImagePropertyOptions 1125 * @syscap SystemCapability.Multimedia.Image.ImageSource 1126 * @crossplatform 1127 * @since 10 1128 */ 1129 interface GetImagePropertyOptions { 1130 /** 1131 * Index of an image. 1132 * 1133 * @type { ?number } 1134 * @syscap SystemCapability.Multimedia.Image.ImageSource 1135 * @since 7 1136 */ 1137 /** 1138 * Index of an image. 1139 * 1140 * @type { ?number } 1141 * @syscap SystemCapability.Multimedia.Image.ImageSource 1142 * @crossplatform 1143 * @since 10 1144 */ 1145 index?: number; 1146 1147 /** 1148 * Default property value. 1149 * 1150 * @type { ?string } 1151 * @syscap SystemCapability.Multimedia.Image.ImageSource 1152 * @since 7 1153 */ 1154 /** 1155 * Default property value. 1156 * 1157 * @type { ?string } 1158 * @syscap SystemCapability.Multimedia.Image.ImageSource 1159 * @crossplatform 1160 * @since 10 1161 */ 1162 defaultValue?: string; 1163 } 1164 1165 /** 1166 * Describes image decoding parameters. 1167 * 1168 * @typedef DecodingOptions 1169 * @syscap SystemCapability.Multimedia.Image.ImageSource 1170 * @since 7 1171 */ 1172 /** 1173 * Describes image decoding parameters. 1174 * 1175 * @typedef DecodingOptions 1176 * @syscap SystemCapability.Multimedia.Image.ImageSource 1177 * @crossplatform 1178 * @since 10 1179 */ 1180 interface DecodingOptions { 1181 /** 1182 * Number of image frames. 1183 * 1184 * @type { ?number } 1185 * @syscap SystemCapability.Multimedia.Image.ImageSource 1186 * @since 7 1187 */ 1188 /** 1189 * Number of image frames. 1190 * 1191 * @type { ?number } 1192 * @syscap SystemCapability.Multimedia.Image.ImageSource 1193 * @crossplatform 1194 * @since 10 1195 */ 1196 index?: number; 1197 1198 /** 1199 * Sampling ratio of the image pixel map. 1200 * 1201 * @type { ?number } 1202 * @syscap SystemCapability.Multimedia.Image.ImageSource 1203 * @since 7 1204 */ 1205 /** 1206 * Sampling ratio of the image pixel map. 1207 * 1208 * @type { ?number } 1209 * @syscap SystemCapability.Multimedia.Image.ImageSource 1210 * @crossplatform 1211 * @since 10 1212 */ 1213 sampleSize?: number; 1214 1215 /** 1216 * Rotation angle of the image pixel map. The value ranges from 0 to 360. 1217 * 1218 * @type { ?number } 1219 * @syscap SystemCapability.Multimedia.Image.ImageSource 1220 * @since 7 1221 */ 1222 /** 1223 * Rotation angle of the image pixel map. The value ranges from 0 to 360. 1224 * 1225 * @type { ?number } 1226 * @syscap SystemCapability.Multimedia.Image.ImageSource 1227 * @crossplatform 1228 * @since 10 1229 */ 1230 rotate?: number; 1231 1232 /** 1233 * Whether the image pixel map is editable. 1234 * 1235 * @type { ?boolean } 1236 * @syscap SystemCapability.Multimedia.Image.ImageSource 1237 * @since 7 1238 */ 1239 /** 1240 * Whether the image pixel map is editable. 1241 * 1242 * @type { ?boolean } 1243 * @syscap SystemCapability.Multimedia.Image.ImageSource 1244 * @crossplatform 1245 * @since 10 1246 */ 1247 editable?: boolean; 1248 1249 /** 1250 * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded 1251 * based on the original image size. 1252 * 1253 * @type { ?Size } 1254 * @syscap SystemCapability.Multimedia.Image.ImageSource 1255 * @since 7 1256 */ 1257 /** 1258 * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded 1259 * based on the original image size. 1260 * 1261 * @type { ?Size } 1262 * @syscap SystemCapability.Multimedia.Image.ImageSource 1263 * @crossplatform 1264 * @since 10 1265 */ 1266 desiredSize?: Size; 1267 1268 /** 1269 * Cropping region of the image pixel map. 1270 * 1271 * @type { ?Region } 1272 * @syscap SystemCapability.Multimedia.Image.ImageSource 1273 * @since 7 1274 */ 1275 /** 1276 * Cropping region of the image pixel map. 1277 * 1278 * @type { ?Region } 1279 * @syscap SystemCapability.Multimedia.Image.ImageSource 1280 * @crossplatform 1281 * @since 10 1282 */ 1283 desiredRegion?: Region; 1284 1285 /** 1286 * Data format of the image pixel map. 1287 * 1288 * @type { ?PixelMapFormat } 1289 * @syscap SystemCapability.Multimedia.Image.ImageSource 1290 * @since 7 1291 */ 1292 /** 1293 * Data format of the image pixel map. 1294 * 1295 * @type { ?PixelMapFormat } 1296 * @syscap SystemCapability.Multimedia.Image.ImageSource 1297 * @crossplatform 1298 * @since 10 1299 */ 1300 desiredPixelFormat?: PixelMapFormat; 1301 1302 /** 1303 * The density for image pixel map. 1304 * 1305 * @type { ?number } 1306 * @syscap SystemCapability.Multimedia.Image.ImageSource 1307 * @since 9 1308 */ 1309 /** 1310 * The density for image pixel map. 1311 * 1312 * @type { ?number } 1313 * @syscap SystemCapability.Multimedia.Image.ImageSource 1314 * @crossplatform 1315 * @since 10 1316 */ 1317 fitDensity?: number; 1318 } 1319 1320 /** 1321 * Describes image color components. 1322 * 1323 * @typedef Component 1324 * @syscap SystemCapability.Multimedia.Image.Core 1325 * @since 9 1326 */ 1327 interface Component { 1328 /** 1329 * Component type. 1330 * 1331 * @type { ComponentType } 1332 * @syscap SystemCapability.Multimedia.Image.Core 1333 * @since 9 1334 */ 1335 readonly componentType: ComponentType; 1336 1337 /** 1338 * Row stride. 1339 * 1340 * @type { number } 1341 * @syscap SystemCapability.Multimedia.Image.Core 1342 * @since 9 1343 */ 1344 readonly rowStride: number; 1345 1346 /** 1347 * Pixel stride. 1348 * 1349 * @type { number } 1350 * @syscap SystemCapability.Multimedia.Image.Core 1351 * @since 9 1352 */ 1353 readonly pixelStride: number; 1354 1355 /** 1356 * Component buffer. 1357 * 1358 * @type { ArrayBuffer } 1359 * @syscap SystemCapability.Multimedia.Image.Core 1360 * @since 9 1361 */ 1362 readonly byteBuffer: ArrayBuffer; 1363 } 1364 1365 /** 1366 * Initialization options for pixelmap. 1367 * 1368 * @typedef InitializationOptions 1369 * @syscap SystemCapability.Multimedia.Image.Core 1370 * @since 8 1371 */ 1372 /** 1373 * Initialization options for pixelmap. 1374 * 1375 * @typedef InitializationOptions 1376 * @syscap SystemCapability.Multimedia.Image.Core 1377 * @crossplatform 1378 * @since 10 1379 */ 1380 interface InitializationOptions { 1381 /** 1382 * PixelMap size. 1383 * 1384 * @type { Size } 1385 * @syscap SystemCapability.Multimedia.Image.Core 1386 * @since 8 1387 */ 1388 /** 1389 * PixelMap size. 1390 * 1391 * @type { Size } 1392 * @syscap SystemCapability.Multimedia.Image.Core 1393 * @crossplatform 1394 * @since 10 1395 */ 1396 size: Size; 1397 1398 /** 1399 * PixelMap expected format. 1400 * 1401 * @type { ?PixelMapFormat } 1402 * @syscap SystemCapability.Multimedia.Image.Core 1403 * @since 8 1404 */ 1405 /** 1406 * PixelMap expected format. 1407 * 1408 * @type { ?PixelMapFormat } 1409 * @syscap SystemCapability.Multimedia.Image.Core 1410 * @crossplatform 1411 * @since 10 1412 */ 1413 pixelFormat?: PixelMapFormat; 1414 1415 /** 1416 * Editable or not. 1417 * 1418 * @type { ?boolean } 1419 * @syscap SystemCapability.Multimedia.Image.Core 1420 * @since 8 1421 */ 1422 /** 1423 * Editable or not. 1424 * 1425 * @type { ?boolean } 1426 * @syscap SystemCapability.Multimedia.Image.Core 1427 * @crossplatform 1428 * @since 10 1429 */ 1430 editable?: boolean; 1431 1432 /** 1433 * PixelMap expected alpha type. 1434 * 1435 * @type { ?AlphaType } 1436 * @syscap SystemCapability.Multimedia.Image.Core 1437 * @since 9 1438 */ 1439 /** 1440 * PixelMap expected alpha type. 1441 * 1442 * @type { ?AlphaType } 1443 * @syscap SystemCapability.Multimedia.Image.Core 1444 * @crossplatform 1445 * @since 10 1446 */ 1447 alphaType?: AlphaType; 1448 1449 /** 1450 * PixelMap expected scaling effect. 1451 * 1452 * @type { ?ScaleMode } 1453 * @syscap SystemCapability.Multimedia.Image.Core 1454 * @since 9 1455 */ 1456 /** 1457 * PixelMap expected scaling effect. 1458 * 1459 * @type { ?ScaleMode } 1460 * @syscap SystemCapability.Multimedia.Image.Core 1461 * @crossplatform 1462 * @since 10 1463 */ 1464 scaleMode?: ScaleMode; 1465 } 1466 1467 /** 1468 * Initialization options for ImageSource. 1469 * 1470 * @typedef SourceOptions 1471 * @syscap SystemCapability.Multimedia.Image.Core 1472 * @since 9 1473 */ 1474 /** 1475 * Initialization options for ImageSource. 1476 * 1477 * @typedef SourceOptions 1478 * @syscap SystemCapability.Multimedia.Image.Core 1479 * @crossplatform 1480 * @since 10 1481 */ 1482 interface SourceOptions { 1483 /** 1484 * The density for ImageSource. 1485 * 1486 * @type { number } 1487 * @syscap SystemCapability.Multimedia.Image.Core 1488 * @since 9 1489 */ 1490 /** 1491 * The density for ImageSource. 1492 * 1493 * @type { number } 1494 * @syscap SystemCapability.Multimedia.Image.Core 1495 * @crossplatform 1496 * @since 10 1497 */ 1498 sourceDensity: number; 1499 1500 /** 1501 * PixelMap expected format. 1502 * 1503 * @type { ?PixelMapFormat } 1504 * @syscap SystemCapability.Multimedia.Image.Core 1505 * @since 9 1506 */ 1507 /** 1508 * PixelMap expected format. 1509 * 1510 * @type { ?PixelMapFormat } 1511 * @syscap SystemCapability.Multimedia.Image.Core 1512 * @crossplatform 1513 * @since 10 1514 */ 1515 sourcePixelFormat?: PixelMapFormat; 1516 1517 /** 1518 * PixelMap size. 1519 * 1520 * @type { ?Size } 1521 * @syscap SystemCapability.Multimedia.Image.Core 1522 * @since 9 1523 */ 1524 /** 1525 * PixelMap size. 1526 * 1527 * @type { ?Size } 1528 * @syscap SystemCapability.Multimedia.Image.Core 1529 * @crossplatform 1530 * @since 10 1531 */ 1532 sourceSize?: Size; 1533 } 1534 1535 /** 1536 * Create pixelmap by data buffer. 1537 * 1538 * @param { ArrayBuffer } colors The image color buffer. 1539 * @param { InitializationOptions } options Initialization options for pixelmap. 1540 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 1541 * @syscap SystemCapability.Multimedia.Image.Core 1542 * @since 8 1543 */ 1544 /** 1545 * Create pixelmap by data buffer. 1546 * 1547 * @param { ArrayBuffer } colors The image color buffer. 1548 * @param { InitializationOptions } options Initialization options for pixelmap. 1549 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 1550 * @syscap SystemCapability.Multimedia.Image.Core 1551 * @crossplatform 1552 * @since 10 1553 */ 1554 function createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback<PixelMap>): void; 1555 1556 /** 1557 * Create pixelmap by data buffer. 1558 * 1559 * @param { ArrayBuffer } colors The image color buffer. 1560 * @param { InitializationOptions } options Initialization options for pixelmap. 1561 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 1562 * @syscap SystemCapability.Multimedia.Image.Core 1563 * @since 8 1564 */ 1565 /** 1566 * Create pixelmap by data buffer. 1567 * 1568 * @param { ArrayBuffer } colors The image color buffer. 1569 * @param { InitializationOptions } options Initialization options for pixelmap. 1570 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 1571 * @syscap SystemCapability.Multimedia.Image.Core 1572 * @crossplatform 1573 * @since 10 1574 */ 1575 function createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise<PixelMap>; 1576 1577 /** 1578 * Creates an ImageSource instance based on the URI. 1579 * 1580 * @param { string } uri Image source URI. 1581 * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. 1582 * @syscap SystemCapability.Multimedia.Image.ImageSource 1583 * @since 6 1584 */ 1585 /** 1586 * Creates an ImageSource instance based on the URI. 1587 * 1588 * @param { string } uri Image source URI. 1589 * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. 1590 * @syscap SystemCapability.Multimedia.Image.ImageSource 1591 * @crossplatform 1592 * @since 10 1593 */ 1594 function createImageSource(uri: string): ImageSource; 1595 1596 /** 1597 * Creates an ImageSource instance based on the URI. 1598 * 1599 * @param { string } uri Image source URI. 1600 * @param { SourceOptions } options The config of Image source. 1601 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1602 * @syscap SystemCapability.Multimedia.Image.ImageSource 1603 * @since 9 1604 */ 1605 /** 1606 * Creates an ImageSource instance based on the URI. 1607 * 1608 * @param { string } uri Image source URI. 1609 * @param { SourceOptions } options The config of Image source. 1610 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1611 * @syscap SystemCapability.Multimedia.Image.ImageSource 1612 * @crossplatform 1613 * @since 10 1614 */ 1615 function createImageSource(uri: string, options: SourceOptions): ImageSource; 1616 1617 /** 1618 * Creates an ImageSource instance based on the file descriptor. 1619 * 1620 * @param { number } fd ID of a file descriptor. 1621 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1622 * @syscap SystemCapability.Multimedia.Image.ImageSource 1623 * @since 7 1624 */ 1625 /** 1626 * Creates an ImageSource instance based on the file descriptor. 1627 * 1628 * @param { number } fd ID of a file descriptor. 1629 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1630 * @syscap SystemCapability.Multimedia.Image.ImageSource 1631 * @crossplatform 1632 * @since 10 1633 */ 1634 function createImageSource(fd: number): ImageSource; 1635 1636 /** 1637 * Creates an ImageSource instance based on the file descriptor. 1638 * 1639 * @param { number } fd ID of a file descriptor. 1640 * @param { SourceOptions } options The config of Image source. 1641 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1642 * @syscap SystemCapability.Multimedia.Image.ImageSource 1643 * @since 9 1644 */ 1645 /** 1646 * Creates an ImageSource instance based on the file descriptor. 1647 * 1648 * @param { number } fd ID of a file descriptor. 1649 * @param { SourceOptions } options The config of Image source. 1650 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1651 * @syscap SystemCapability.Multimedia.Image.ImageSource 1652 * @crossplatform 1653 * @since 10 1654 */ 1655 function createImageSource(fd: number, options: SourceOptions): ImageSource; 1656 1657 /** 1658 * Creates an ImageSource instance based on the buffer. 1659 * 1660 * @param { ArrayBuffer } buf The buffer of the image. 1661 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1662 * @syscap SystemCapability.Multimedia.Image.ImageSource 1663 * @since 9 1664 */ 1665 /** 1666 * Creates an ImageSource instance based on the buffer. 1667 * 1668 * @param { ArrayBuffer } buf The buffer of the image. 1669 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1670 * @syscap SystemCapability.Multimedia.Image.ImageSource 1671 * @crossplatform 1672 * @since 10 1673 */ 1674 function createImageSource(buf: ArrayBuffer): ImageSource; 1675 1676 /** 1677 * Creates an ImageSource instance based on the buffer. 1678 * 1679 * @param { ArrayBuffer } buf The buffer of the image. 1680 * @param { SourceOptions } options The config of Image source. 1681 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1682 * @syscap SystemCapability.Multimedia.Image.ImageSource 1683 * @since 9 1684 */ 1685 /** 1686 * Creates an ImageSource instance based on the buffer. 1687 * 1688 * @param { ArrayBuffer } buf The buffer of the image. 1689 * @param { SourceOptions } options The config of Image source. 1690 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1691 * @syscap SystemCapability.Multimedia.Image.ImageSource 1692 * @crossplatform 1693 * @since 10 1694 */ 1695 function createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource; 1696 1697 /** 1698 * Creates an ImageSource instance based on the buffer in incremental. 1699 * 1700 * @param { ArrayBuffer } buf The buffer of the image. 1701 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1702 * @syscap SystemCapability.Multimedia.Image.ImageSource 1703 * @since 9 1704 */ 1705 /** 1706 * Creates an ImageSource instance based on the buffer in incremental. 1707 * 1708 * @param { ArrayBuffer } buf The buffer of the image. 1709 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1710 * @syscap SystemCapability.Multimedia.Image.ImageSource 1711 * @crossplatform 1712 * @since 10 1713 */ 1714 function CreateIncrementalSource(buf: ArrayBuffer): ImageSource; 1715 1716 /** 1717 * Creates an ImageSource instance based on the buffer in incremental. 1718 * 1719 * @param { ArrayBuffer } buf The buffer of the image. 1720 * @param { SourceOptions } options The config of source. 1721 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1722 * @syscap SystemCapability.Multimedia.Image.ImageSource 1723 * @since 9 1724 */ 1725 /** 1726 * Creates an ImageSource instance based on the buffer in incremental. 1727 * 1728 * @param { ArrayBuffer } buf The buffer of the image. 1729 * @param { SourceOptions } options The config of source. 1730 * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. 1731 * @syscap SystemCapability.Multimedia.Image.ImageSource 1732 * @crossplatform 1733 * @since 10 1734 */ 1735 function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource; 1736 1737 /** 1738 * Creates an ImagePacker instance. 1739 * 1740 * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. 1741 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1742 * @since 6 1743 */ 1744 /** 1745 * Creates an ImagePacker instance. 1746 * 1747 * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. 1748 * @syscap SystemCapability.Multimedia.Image.ImagePacker 1749 * @crossplatform 1750 * @since 10 1751 */ 1752 function createImagePacker(): ImagePacker; 1753 1754 /** 1755 * Creates an ImageReceiver instance. 1756 * 1757 * @param { number } width The default width in pixels of the Images that this receiver will produce. 1758 * @param { number } height The default height in pixels of the Images that this receiver will produce. 1759 * @param { number } format The format of the Image that this receiver will produce. This must be one of the 1760 * {@link ImageFormat} constants. 1761 * @param { number } capacity The maximum number of images the user will want to access simultaneously. 1762 * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise. 1763 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 1764 * @since 9 1765 */ 1766 function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver; 1767 1768 /** 1769 * Creates an ImageCreator instance. 1770 * 1771 * @param { number } width The default width in pixels of the Images that this creator will produce. 1772 * @param { number } height The default height in pixels of the Images that this creator will produce. 1773 * @param { number } format The format of the Image that this creator will produce. This must be one of the 1774 * {@link ImageFormat} constants. 1775 * @param { number } capacity The maximum number of images the user will want to access simultaneously. 1776 * @returns { ImageCreator } Returns the ImageCreator instance if the operation is successful; returns null otherwise. 1777 * @syscap SystemCapability.Multimedia.Image.ImageCreator 1778 * @since 9 1779 */ 1780 function createImageCreator(width: number, height: number, format: number, capacity: number): ImageCreator; 1781 1782 /** 1783 * PixelMap instance. 1784 * 1785 * @typedef PixelMap 1786 * @syscap SystemCapability.Multimedia.Image.Core 1787 * @since 7 1788 */ 1789 /** 1790 * PixelMap instance. 1791 * 1792 * @typedef PixelMap 1793 * @syscap SystemCapability.Multimedia.Image.Core 1794 * @crossplatform 1795 * @since 10 1796 */ 1797 interface PixelMap { 1798 /** 1799 * Whether the image pixel map can be edited. 1800 * 1801 * @type { boolean } 1802 * @syscap SystemCapability.Multimedia.Image.Core 1803 * @since 7 1804 */ 1805 /** 1806 * Whether the image pixel map can be edited. 1807 * 1808 * @type { boolean } 1809 * @syscap SystemCapability.Multimedia.Image.Core 1810 * @crossplatform 1811 * @since 10 1812 */ 1813 readonly isEditable: boolean; 1814 1815 /** 1816 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 1817 * a promise to return the result. 1818 * 1819 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 1820 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1821 * @syscap SystemCapability.Multimedia.Image.Core 1822 * @since 7 1823 */ 1824 /** 1825 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 1826 * a promise to return the result. 1827 * 1828 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 1829 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1830 * @syscap SystemCapability.Multimedia.Image.Core 1831 * @crossplatform 1832 * @since 10 1833 */ 1834 readPixelsToBuffer(dst: ArrayBuffer): Promise<void>; 1835 1836 /** 1837 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 1838 * a callback to return the result. 1839 * 1840 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 1841 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1842 * @syscap SystemCapability.Multimedia.Image.Core 1843 * @since 7 1844 */ 1845 /** 1846 * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses 1847 * a callback to return the result. 1848 * 1849 * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. 1850 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1851 * @syscap SystemCapability.Multimedia.Image.Core 1852 * @crossplatform 1853 * @since 10 1854 */ 1855 readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback<void>): void; 1856 1857 /** 1858 * Reads image pixel map data in an area. This method uses a promise to return the data read. 1859 * 1860 * @param { PositionArea } area Area from which the image pixel map data will be read. 1861 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1862 * @syscap SystemCapability.Multimedia.Image.Core 1863 * @since 7 1864 */ 1865 /** 1866 * Reads image pixel map data in an area. This method uses a promise to return the data read. 1867 * 1868 * @param { PositionArea } area Area from which the image pixel map data will be read. 1869 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1870 * @syscap SystemCapability.Multimedia.Image.Core 1871 * @crossplatform 1872 * @since 10 1873 */ 1874 readPixels(area: PositionArea): Promise<void>; 1875 1876 /** 1877 * Reads image pixel map data in an area. This method uses a callback to return the data read. 1878 * 1879 * @param { PositionArea } area Area from which the image pixel map data will be read. 1880 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1881 * @syscap SystemCapability.Multimedia.Image.Core 1882 * @since 7 1883 */ 1884 /** 1885 * Reads image pixel map data in an area. This method uses a callback to return the data read. 1886 * 1887 * @param { PositionArea } area Area from which the image pixel map data will be read. 1888 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1889 * @syscap SystemCapability.Multimedia.Image.Core 1890 * @crossplatform 1891 * @since 10 1892 */ 1893 readPixels(area: PositionArea, callback: AsyncCallback<void>): void; 1894 1895 /** 1896 * Writes image pixel map data to the specified area. This method uses a promise to return 1897 * the operation result. 1898 * 1899 * @param { PositionArea } area Area to which the image pixel map data will be written. 1900 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1901 * @syscap SystemCapability.Multimedia.Image.Core 1902 * @since 7 1903 */ 1904 /** 1905 * Writes image pixel map data to the specified area. This method uses a promise to return 1906 * the operation result. 1907 * 1908 * @param { PositionArea } area Area to which the image pixel map data will be written. 1909 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1910 * @syscap SystemCapability.Multimedia.Image.Core 1911 * @crossplatform 1912 * @since 10 1913 */ 1914 writePixels(area: PositionArea): Promise<void>; 1915 1916 /** 1917 * Writes image pixel map data to the specified area. This method uses a callback to return 1918 * the operation result. 1919 * 1920 * @param { PositionArea } area Area to which the image pixel map data will be written. 1921 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1922 * @syscap SystemCapability.Multimedia.Image.Core 1923 * @since 7 1924 */ 1925 /** 1926 * Writes image pixel map data to the specified area. This method uses a callback to return 1927 * the operation result. 1928 * 1929 * @param { PositionArea } area Area to which the image pixel map data will be written. 1930 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1931 * @syscap SystemCapability.Multimedia.Image.Core 1932 * @crossplatform 1933 * @since 10 1934 */ 1935 writePixels(area: PositionArea, callback: AsyncCallback<void>): void; 1936 1937 /** 1938 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 1939 * uses a promise to return the result. 1940 * 1941 * @param { ArrayBuffer } src A buffer from which the image data will be read. 1942 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1943 * @syscap SystemCapability.Multimedia.Image.Core 1944 * @since 7 1945 */ 1946 /** 1947 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 1948 * uses a promise to return the result. 1949 * 1950 * @param { ArrayBuffer } src A buffer from which the image data will be read. 1951 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 1952 * @syscap SystemCapability.Multimedia.Image.Core 1953 * @crossplatform 1954 * @since 10 1955 */ 1956 writeBufferToPixels(src: ArrayBuffer): Promise<void>; 1957 1958 /** 1959 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 1960 * uses a callback to return the result. 1961 * 1962 * @param { ArrayBuffer } src A buffer from which the image data will be read. 1963 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1964 * @syscap SystemCapability.Multimedia.Image.Core 1965 * @since 7 1966 */ 1967 /** 1968 * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method 1969 * uses a callback to return the result. 1970 * 1971 * @param { ArrayBuffer } src A buffer from which the image data will be read. 1972 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 1973 * @syscap SystemCapability.Multimedia.Image.Core 1974 * @crossplatform 1975 * @since 10 1976 */ 1977 writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback<void>): void; 1978 1979 /** 1980 * Obtains pixel map information about this image. This method uses a promise to return the information. 1981 * 1982 * @returns { Promise<ImageInfo> } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. 1983 * @syscap SystemCapability.Multimedia.Image.Core 1984 * @since 7 1985 */ 1986 /** 1987 * Obtains pixel map information about this image. This method uses a promise to return the information. 1988 * 1989 * @returns { Promise<ImageInfo> } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. 1990 * @syscap SystemCapability.Multimedia.Image.Core 1991 * @crossplatform 1992 * @since 10 1993 */ 1994 getImageInfo(): Promise<ImageInfo>; 1995 1996 /** 1997 * Obtains pixel map information about this image. This method uses a callback to return the information. 1998 * 1999 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image pixel map information. 2000 * If the operation fails, an error message is returned. 2001 * @syscap SystemCapability.Multimedia.Image.Core 2002 * @since 7 2003 */ 2004 /** 2005 * Obtains pixel map information about this image. This method uses a callback to return the information. 2006 * 2007 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image pixel map information. 2008 * If the operation fails, an error message is returned. 2009 * @syscap SystemCapability.Multimedia.Image.Core 2010 * @crossplatform 2011 * @since 10 2012 */ 2013 getImageInfo(callback: AsyncCallback<ImageInfo>): void; 2014 2015 /** 2016 * Obtains the number of bytes in each line of the image pixel map. 2017 * 2018 * @returns { number } Number of bytes in each line. 2019 * @syscap SystemCapability.Multimedia.Image.Core 2020 * @since 7 2021 */ 2022 /** 2023 * Obtains the number of bytes in each line of the image pixel map. 2024 * 2025 * @returns { number } Number of bytes in each line. 2026 * @syscap SystemCapability.Multimedia.Image.Core 2027 * @crossplatform 2028 * @since 10 2029 */ 2030 getBytesNumberPerRow(): number; 2031 2032 /** 2033 * Obtains the total number of bytes of the image pixel map. 2034 * 2035 * @returns { number } Total number of bytes. 2036 * @syscap SystemCapability.Multimedia.Image.Core 2037 * @since 7 2038 */ 2039 /** 2040 * Obtains the total number of bytes of the image pixel map. 2041 * 2042 * @returns { number } Total number of bytes. 2043 * @syscap SystemCapability.Multimedia.Image.Core 2044 * @crossplatform 2045 * @since 10 2046 */ 2047 getPixelBytesNumber(): number; 2048 2049 /** 2050 * Obtains the density of the image pixel map. 2051 * 2052 * @returns { number } The number of density. 2053 * @syscap SystemCapability.Multimedia.Image.Core 2054 * @since 9 2055 */ 2056 /** 2057 * Obtains the density of the image pixel map. 2058 * 2059 * @returns { number } The number of density. 2060 * @syscap SystemCapability.Multimedia.Image.Core 2061 * @crossplatform 2062 * @since 10 2063 */ 2064 getDensity(): number; 2065 2066 /** 2067 * Set the transparent rate of pixel map. This method uses a callback to return the operation result. 2068 * 2069 * @param { number } rate The value of transparent rate. 2070 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2071 * @syscap SystemCapability.Multimedia.Image.Core 2072 * @since 9 2073 */ 2074 /** 2075 * Set the transparent rate of pixel map. This method uses a callback to return the operation result. 2076 * 2077 * @param { number } rate The value of transparent rate. 2078 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2079 * @syscap SystemCapability.Multimedia.Image.Core 2080 * @crossplatform 2081 * @since 10 2082 */ 2083 opacity(rate: number, callback: AsyncCallback<void>): void; 2084 2085 /** 2086 * Set the transparent rate of pixel map. This method uses a promise to return the result. 2087 * 2088 * @param { number } rate The value of transparent rate. 2089 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2090 * @syscap SystemCapability.Multimedia.Image.Core 2091 * @since 9 2092 */ 2093 /** 2094 * Set the transparent rate of pixel map. This method uses a promise to return the result. 2095 * 2096 * @param { number } rate The value of transparent rate. 2097 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2098 * @syscap SystemCapability.Multimedia.Image.Core 2099 * @crossplatform 2100 * @since 10 2101 */ 2102 opacity(rate: number): Promise<void>; 2103 2104 /** 2105 * Obtains new pixel map with alpha information. This method uses a promise to return the information. 2106 * 2107 * @returns { Promise<PixelMap> } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. 2108 * @syscap SystemCapability.Multimedia.Image.Core 2109 * @since 9 2110 */ 2111 /** 2112 * Obtains new pixel map with alpha information. This method uses a promise to return the information. 2113 * 2114 * @returns { Promise<PixelMap> } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. 2115 * @syscap SystemCapability.Multimedia.Image.Core 2116 * @crossplatform 2117 * @since 10 2118 */ 2119 createAlphaPixelmap(): Promise<PixelMap>; 2120 2121 /** 2122 * Obtains new pixel map with alpha information. This method uses a callback to return the information. 2123 * 2124 * @param { AsyncCallback<PixelMap> } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. 2125 * @syscap SystemCapability.Multimedia.Image.Core 2126 * @since 9 2127 */ 2128 /** 2129 * Obtains new pixel map with alpha information. This method uses a callback to return the information. 2130 * 2131 * @param { AsyncCallback<PixelMap> } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. 2132 * @syscap SystemCapability.Multimedia.Image.Core 2133 * @crossplatform 2134 * @since 10 2135 */ 2136 createAlphaPixelmap(callback: AsyncCallback<PixelMap>): void; 2137 2138 /** 2139 * Image zoom in width and height. This method uses a callback to return the operation result. 2140 * 2141 * @param { number } x The zoom value of width. 2142 * @param { number } y The zoom value of height. 2143 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2144 * @syscap SystemCapability.Multimedia.Image.Core 2145 * @since 9 2146 */ 2147 /** 2148 * Image zoom in width and height. This method uses a callback to return the operation result. 2149 * 2150 * @param { number } x The zoom value of width. 2151 * @param { number } y The zoom value of height. 2152 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2153 * @syscap SystemCapability.Multimedia.Image.Core 2154 * @crossplatform 2155 * @since 10 2156 */ 2157 scale(x: number, y: number, callback: AsyncCallback<void>): void; 2158 2159 /** 2160 * Image zoom in width and height. This method uses a promise to return the result. 2161 * 2162 * @param { number } x The zoom value of width. 2163 * @param { number } y The zoom value of height. 2164 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2165 * @syscap SystemCapability.Multimedia.Image.Core 2166 * @since 9 2167 */ 2168 /** 2169 * Image zoom in width and height. This method uses a promise to return the result. 2170 * 2171 * @param { number } x The zoom value of width. 2172 * @param { number } y The zoom value of height. 2173 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2174 * @syscap SystemCapability.Multimedia.Image.Core 2175 * @crossplatform 2176 * @since 10 2177 */ 2178 scale(x: number, y: number): Promise<void>; 2179 2180 /** 2181 * Image position transformation. This method uses a callback to return the operation result. 2182 * 2183 * @param { number } x The position value of width. 2184 * @param { number } y The position value of height. 2185 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2186 * @syscap SystemCapability.Multimedia.Image.Core 2187 * @since 9 2188 */ 2189 /** 2190 * Image position transformation. This method uses a callback to return the operation result. 2191 * 2192 * @param { number } x The position value of width. 2193 * @param { number } y The position value of height. 2194 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2195 * @syscap SystemCapability.Multimedia.Image.Core 2196 * @crossplatform 2197 * @since 10 2198 */ 2199 translate(x: number, y: number, callback: AsyncCallback<void>): void; 2200 2201 /** 2202 * Image position transformation. This method uses a promise to return the result. 2203 * 2204 * @param { number } x The position value of width. 2205 * @param { number } y The position value of height. 2206 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2207 * @syscap SystemCapability.Multimedia.Image.Core 2208 * @since 9 2209 */ 2210 /** 2211 * Image position transformation. This method uses a promise to return the result. 2212 * 2213 * @param { number } x The position value of width. 2214 * @param { number } y The position value of height. 2215 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2216 * @syscap SystemCapability.Multimedia.Image.Core 2217 * @crossplatform 2218 * @since 10 2219 */ 2220 translate(x: number, y: number): Promise<void>; 2221 2222 /** 2223 * Image rotation. This method uses a callback to return the operation result. 2224 * 2225 * @param { number } angle The rotation angle. 2226 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2227 * @syscap SystemCapability.Multimedia.Image.Core 2228 * @since 9 2229 */ 2230 /** 2231 * Image rotation. This method uses a callback to return the operation result. 2232 * 2233 * @param { number } angle The rotation angle. 2234 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2235 * @syscap SystemCapability.Multimedia.Image.Core 2236 * @crossplatform 2237 * @since 10 2238 */ 2239 rotate(angle: number, callback: AsyncCallback<void>): void; 2240 2241 /** 2242 * Image rotation. This method uses a promise to return the result. 2243 * 2244 * @param { number } angle The rotation angle. 2245 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2246 * @syscap SystemCapability.Multimedia.Image.Core 2247 * @since 9 2248 */ 2249 /** 2250 * Image rotation. This method uses a promise to return the result. 2251 * 2252 * @param { number } angle The rotation angle. 2253 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2254 * @syscap SystemCapability.Multimedia.Image.Core 2255 * @crossplatform 2256 * @since 10 2257 */ 2258 rotate(angle: number): Promise<void>; 2259 2260 /** 2261 * Image flipping. This method uses a callback to return the operation result. 2262 * 2263 * @param { boolean } horizontal Is flip in horizontal. 2264 * @param { boolean } vertical Is flip in vertical. 2265 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2266 * @syscap SystemCapability.Multimedia.Image.Core 2267 * @since 9 2268 */ 2269 /** 2270 * Image flipping. This method uses a callback to return the operation result. 2271 * 2272 * @param { boolean } horizontal Is flip in horizontal. 2273 * @param { boolean } vertical Is flip in vertical. 2274 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2275 * @syscap SystemCapability.Multimedia.Image.Core 2276 * @crossplatform 2277 * @since 10 2278 */ 2279 flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback<void>): void; 2280 2281 /** 2282 * Image flipping. This method uses a promise to return the result. 2283 * 2284 * @param { boolean } horizontal Is flip in horizontal. 2285 * @param { boolean } vertical Is flip in vertical. 2286 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2287 * @syscap SystemCapability.Multimedia.Image.Core 2288 * @since 9 2289 */ 2290 /** 2291 * Image flipping. This method uses a promise to return the result. 2292 * 2293 * @param { boolean } horizontal Is flip in horizontal. 2294 * @param { boolean } vertical Is flip in vertical. 2295 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2296 * @syscap SystemCapability.Multimedia.Image.Core 2297 * @crossplatform 2298 * @since 10 2299 */ 2300 flip(horizontal: boolean, vertical: boolean): Promise<void>; 2301 2302 /** 2303 * Crop the image. This method uses a callback to return the operation result. 2304 * 2305 * @param { Region } region The region to crop. 2306 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2307 * @syscap SystemCapability.Multimedia.Image.Core 2308 * @since 9 2309 */ 2310 /** 2311 * Crop the image. This method uses a callback to return the operation result. 2312 * 2313 * @param { Region } region The region to crop. 2314 * @param { AsyncCallback<void> } callback Callback used to return the operation result. If the operation fails, an error message is returned. 2315 * @syscap SystemCapability.Multimedia.Image.Core 2316 * @crossplatform 2317 * @since 10 2318 */ 2319 crop(region: Region, callback: AsyncCallback<void>): void; 2320 2321 /** 2322 * Crop the image. This method uses a promise to return the result. 2323 * 2324 * @param { Region } region The region to crop. 2325 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2326 * @syscap SystemCapability.Multimedia.Image.Core 2327 * @since 9 2328 */ 2329 /** 2330 * Crop the image. This method uses a promise to return the result. 2331 * 2332 * @param { Region } region The region to crop. 2333 * @returns { Promise<void> } A Promise instance used to return the operation result. If the operation fails, an error message is returned. 2334 * @syscap SystemCapability.Multimedia.Image.Core 2335 * @crossplatform 2336 * @since 10 2337 */ 2338 crop(region: Region): Promise<void>; 2339 2340 /** 2341 * Get color space of pixel map. 2342 * 2343 * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned. 2344 * @throws { BusinessError } 62980101 - If the image data abnormal. 2345 * @throws { BusinessError } 62980103 - If the image data unsupport. 2346 * @throws { BusinessError } 62980115 - If the image parameter invalid. 2347 * @syscap SystemCapability.Multimedia.Image.Core 2348 * @since 10 2349 */ 2350 getColorSpace(): colorSpaceManager.ColorSpaceManager; 2351 2352 /** 2353 * Marshalling pixelmap and write into MessageSequence. 2354 * 2355 * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. 2356 * @throws { BusinessError } 62980115 - If the input parameter invalid. 2357 * @throws { BusinessError } 62980097 - If the ipc error. 2358 * @syscap SystemCapability.Multimedia.Image.Core 2359 * @since 10 2360 */ 2361 marshalling(sequence: rpc.MessageSequence): void; 2362 2363 /** 2364 * Creates a PixelMap object based on MessageSequence parameter. 2365 * 2366 * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. 2367 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 2368 * @throws { BusinessError } 62980115 - If the input parameter invalid. 2369 * @throws { BusinessError } 62980097 - If the ipc error. 2370 * @throws { BusinessError } 62980096 - If fail to create async work. 2371 * @syscap SystemCapability.Multimedia.Image.Core 2372 * @since 10 2373 */ 2374 unmarshalling(sequence: rpc.MessageSequence): Promise<PixelMap>; 2375 2376 /** 2377 * Set color space of pixel map. 2378 * 2379 * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixel map. 2380 * @throws { BusinessError } 62980111 - If the operation invalid. 2381 * @throws { BusinessError } 62980115 - If the image parameter invalid. 2382 * @syscap SystemCapability.Multimedia.Image.Core 2383 * @since 10 2384 */ 2385 setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void; 2386 2387 /** 2388 * Releases this PixelMap object. This method uses a callback to return the result. 2389 * 2390 * @param { AsyncCallback<void> } callback Callback invoked for instance release. If the operation fails, an error message is returned. 2391 * @syscap SystemCapability.Multimedia.Image.Core 2392 * @since 7 2393 */ 2394 /** 2395 * Releases this PixelMap object. This method uses a callback to return the result. 2396 * 2397 * @param { AsyncCallback<void> } callback Callback invoked for instance release. If the operation fails, an error message is returned. 2398 * @syscap SystemCapability.Multimedia.Image.Core 2399 * @crossplatform 2400 * @since 10 2401 */ 2402 release(callback: AsyncCallback<void>): void; 2403 2404 /** 2405 * Releases this PixelMap object. This method uses a promise to return the result. 2406 * 2407 * @returns { Promise<void> } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. 2408 * @syscap SystemCapability.Multimedia.Image.Core 2409 * @since 7 2410 */ 2411 /** 2412 * Releases this PixelMap object. This method uses a promise to return the result. 2413 * 2414 * @returns { Promise<void> } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. 2415 * @syscap SystemCapability.Multimedia.Image.Core 2416 * @crossplatform 2417 * @since 10 2418 */ 2419 release(): Promise<void>; 2420 } 2421 2422 /** 2423 * ImageSource instance. 2424 * 2425 * @typedef ImageSource 2426 * @syscap SystemCapability.Multimedia.Image.ImageSource 2427 * @since 6 2428 */ 2429 /** 2430 * ImageSource instance. 2431 * 2432 * @typedef ImageSource 2433 * @syscap SystemCapability.Multimedia.Image.ImageSource 2434 * @crossplatform 2435 * @since 10 2436 */ 2437 interface ImageSource { 2438 /** 2439 * Obtains information about an image with the specified sequence number and uses a callback 2440 * to return the result. 2441 * 2442 * @param { number } index Sequence number of an image. 2443 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 2444 * @syscap SystemCapability.Multimedia.Image.ImageSource 2445 * @since 6 2446 */ 2447 /** 2448 * Obtains information about an image with the specified sequence number and uses a callback 2449 * to return the result. 2450 * 2451 * @param { number } index Sequence number of an image. 2452 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 2453 * @syscap SystemCapability.Multimedia.Image.ImageSource 2454 * @crossplatform 2455 * @since 10 2456 */ 2457 getImageInfo(index: number, callback: AsyncCallback<ImageInfo>): void; 2458 2459 /** 2460 * Obtains information about this image and uses a callback to return the result. 2461 * 2462 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 2463 * @syscap SystemCapability.Multimedia.Image.ImageSource 2464 * @since 6 2465 */ 2466 /** 2467 * Obtains information about this image and uses a callback to return the result. 2468 * 2469 * @param { AsyncCallback<ImageInfo> } callback Callback used to return the image information. 2470 * @syscap SystemCapability.Multimedia.Image.ImageSource 2471 * @crossplatform 2472 * @since 10 2473 */ 2474 getImageInfo(callback: AsyncCallback<ImageInfo>): void; 2475 2476 /** 2477 * Get image information from image source. 2478 * 2479 * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. 2480 * @returns { Promise<ImageInfo> } A Promise instance used to return the image information. 2481 * @syscap SystemCapability.Multimedia.Image.ImageSource 2482 * @since 6 2483 */ 2484 /** 2485 * Get image information from image source. 2486 * 2487 * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. 2488 * @returns { Promise<ImageInfo> } A Promise instance used to return the image information. 2489 * @syscap SystemCapability.Multimedia.Image.ImageSource 2490 * @crossplatform 2491 * @since 10 2492 */ 2493 getImageInfo(index?: number): Promise<ImageInfo>; 2494 2495 /** 2496 * Creates a PixelMap object based on image decoding parameters. This method uses a promise to 2497 * return the object. 2498 * 2499 * @param { DecodingOptions } options Image decoding parameters. 2500 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 2501 * @syscap SystemCapability.Multimedia.Image.ImageSource 2502 * @since 7 2503 */ 2504 /** 2505 * Creates a PixelMap object based on image decoding parameters. This method uses a promise to 2506 * return the object. 2507 * 2508 * @param { DecodingOptions } options Image decoding parameters. 2509 * @returns { Promise<PixelMap> } A Promise instance used to return the PixelMap object. 2510 * @syscap SystemCapability.Multimedia.Image.ImageSource 2511 * @crossplatform 2512 * @since 10 2513 */ 2514 createPixelMap(options?: DecodingOptions): Promise<PixelMap>; 2515 2516 /** 2517 * Creates a PixelMap object. This method uses a callback to return the object. 2518 * 2519 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 2520 * @syscap SystemCapability.Multimedia.Image.ImageSource 2521 * @since 7 2522 */ 2523 /** 2524 * Creates a PixelMap object. This method uses a callback to return the object. 2525 * 2526 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 2527 * @syscap SystemCapability.Multimedia.Image.ImageSource 2528 * @crossplatform 2529 * @since 10 2530 */ 2531 createPixelMap(callback: AsyncCallback<PixelMap>): void; 2532 2533 /** 2534 * Creates a PixelMap object based on image decoding parameters. This method uses a callback to 2535 * return the object. 2536 * 2537 * @param { DecodingOptions } options Image decoding parameters. 2538 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 2539 * @syscap SystemCapability.Multimedia.Image.ImageSource 2540 * @since 7 2541 */ 2542 /** 2543 * Creates a PixelMap object based on image decoding parameters. This method uses a callback to 2544 * return the object. 2545 * 2546 * @param { DecodingOptions } options Image decoding parameters. 2547 * @param { AsyncCallback<PixelMap> } callback Callback used to return the PixelMap object. 2548 * @syscap SystemCapability.Multimedia.Image.ImageSource 2549 * @crossplatform 2550 * @since 10 2551 */ 2552 createPixelMap(options: DecodingOptions, callback: AsyncCallback<PixelMap>): void; 2553 2554 /** 2555 * Creates a PixelMap array based on image decoding parameters. This method uses a promise to 2556 * return the array. 2557 * 2558 * @param { DecodingOptions } options Image decoding parameters. 2559 * @returns { Promise<Array<PixelMap>> } A Promise instance used to return the PixelMap array. 2560 * @throws { BusinessError } 62980096 - If the operation failed. 2561 * @throws { BusinessError } 62980103 - If the image data unsupport. 2562 * @throws { BusinessError } 62980110 - If the image source data error. 2563 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2564 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2565 * @syscap SystemCapability.Multimedia.Image.ImageSource 2566 * @crossplatform 2567 * @since 10 2568 */ 2569 createPixelMapList(options?: DecodingOptions): Promise<Array<PixelMap>>; 2570 2571 /** 2572 * Creates a PixelMap array based on image decoding parameters. This method uses a callback to 2573 * return the array. 2574 * 2575 * @param { AsyncCallback<Array<PixelMap>> } callback Callback used to return the PixelMap array. 2576 * @throws { BusinessError } 62980096 - If the operation failed. 2577 * @throws { BusinessError } 62980103 - If the image data unsupport. 2578 * @throws { BusinessError } 62980110 - If the image source data error. 2579 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2580 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2581 * @syscap SystemCapability.Multimedia.Image.ImageSource 2582 * @crossplatform 2583 * @since 10 2584 */ 2585 createPixelMapList(callback: AsyncCallback<Array<PixelMap>>): void; 2586 2587 /** 2588 * Creates a PixelMap array based on image decoding parameters. This method uses a callback to 2589 * return the array. 2590 * 2591 * @param { DecodingOptions } options Image decoding parameters. 2592 * @param { AsyncCallback<Array<PixelMap>> } callback Callback used to return the PixelMap array. 2593 * @throws { BusinessError } 62980096 - If the operation failed. 2594 * @throws { BusinessError } 62980103 - If the image data unsupport. 2595 * @throws { BusinessError } 62980110 - If the image source data error. 2596 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2597 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2598 * @syscap SystemCapability.Multimedia.Image.ImageSource 2599 * @crossplatform 2600 * @since 10 2601 */ 2602 createPixelMapList(options: DecodingOptions, callback: AsyncCallback<Array<PixelMap>>): void; 2603 2604 /** 2605 * Obtains the array of delay time in an image. This method uses a promise to return the array. 2606 * 2607 * @returns { Promise<Array<number>> } A Promise instance used to return the array. 2608 * @throws { BusinessError } 62980096 - If the operation failed. 2609 * @throws { BusinessError } 62980110 - If the image source data error. 2610 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2611 * @throws { BusinessError } 62980113 - If the image format unknown. 2612 * @throws { BusinessError } 62980116 - If the image decode failed. 2613 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2614 * @throws { BusinessError } 62980122 - If the image decode head abnormal. 2615 * @syscap SystemCapability.Multimedia.Image.ImageSource 2616 * @crossplatform 2617 * @since 10 2618 */ 2619 getDelayTimeList(): Promise<Array<number>>; 2620 2621 /** 2622 * Obtains the array of delay time in an image. This method uses a callback to to return the array. 2623 * 2624 * @param { AsyncCallback<Array<number>> } callback Callback used to return the array. 2625 * @throws { BusinessError } 62980096 - If the operation failed. 2626 * @throws { BusinessError } 62980110 - If the image source data error. 2627 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2628 * @throws { BusinessError } 62980113 - If the image format unknown. 2629 * @throws { BusinessError } 62980116 - If the image decode failed. 2630 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2631 * @throws { BusinessError } 62980122 - If the image decode head abnormal. 2632 * @syscap SystemCapability.Multimedia.Image.ImageSource 2633 * @crossplatform 2634 * @since 10 2635 */ 2636 getDelayTimeList(callback: AsyncCallback<Array<number>>): void; 2637 2638 /** 2639 * Obtains the count of frame in an image. This method uses a promise to return the number. 2640 * 2641 * @returns { Promise<number> } A Promise instance used to return the number. 2642 * @throws { BusinessError } 62980096 - If the operation failed. 2643 * @throws { BusinessError } 62980110 - If the image source data error. 2644 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2645 * @throws { BusinessError } 62980113 - If the image format unknown. 2646 * @throws { BusinessError } 62980116 - If the image decode failed. 2647 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2648 * @throws { BusinessError } 62980122 - If the image decode head abnormal. 2649 * @syscap SystemCapability.Multimedia.Image.ImageSource 2650 * @crossplatform 2651 * @since 10 2652 */ 2653 getFrameCount(): Promise<number>; 2654 2655 /** 2656 * Obtains the count of frame in an image. This method uses a callback to to return the number. 2657 * 2658 * @param { AsyncCallback<number> } callback Callback used to return the number. 2659 * @throws { BusinessError } 62980096 - If the operation failed. 2660 * @throws { BusinessError } 62980110 - If the image source data error. 2661 * @throws { BusinessError } 62980111 - If the image source data incomplete. 2662 * @throws { BusinessError } 62980113 - If the image format unknown. 2663 * @throws { BusinessError } 62980116 - If the image decode failed. 2664 * @throws { BusinessError } 62980118 - If the image plugin create failed. 2665 * @throws { BusinessError } 62980122 - If the image decode head abnormal. 2666 * @syscap SystemCapability.Multimedia.Image.ImageSource 2667 * @crossplatform 2668 * @since 10 2669 */ 2670 getFrameCount(callback: AsyncCallback<number>): void; 2671 2672 /** 2673 * Obtains the value of a property in an image with the specified index. This method uses a 2674 * promise to return the property value in a string. 2675 * 2676 * @param { string } key Name of the property whose value is to be obtained. 2677 * @param { GetImagePropertyOptions } options Index of the image. 2678 * @returns { Promise<string> } A Promise instance used to return the property value. If the operation fails, the default value is returned. 2679 * @syscap SystemCapability.Multimedia.Image.ImageSource 2680 * @since 7 2681 */ 2682 /** 2683 * Obtains the value of a property in an image with the specified index. This method uses a 2684 * promise to return the property value in a string. 2685 * 2686 * @param { string } key Name of the property whose value is to be obtained. 2687 * @param { GetImagePropertyOptions } options Index of the image. 2688 * @returns { Promise<string> } A Promise instance used to return the property value. If the operation fails, the default value is returned. 2689 * @syscap SystemCapability.Multimedia.Image.ImageSource 2690 * @crossplatform 2691 * @since 10 2692 */ 2693 getImageProperty(key: string, options?: GetImagePropertyOptions): Promise<string>; 2694 2695 /** 2696 * Obtains the value of a property in this image. This method uses a callback to return the 2697 * property value in a string. 2698 * 2699 * @param { string } key Name of the property whose value is to be obtained. 2700 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, an error message is returned. 2701 * @syscap SystemCapability.Multimedia.Image.ImageSource 2702 * @since 7 2703 */ 2704 /** 2705 * Obtains the value of a property in this image. This method uses a callback to return the 2706 * property value in a string. 2707 * 2708 * @param { string } key Name of the property whose value is to be obtained. 2709 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, an error message is returned. 2710 * @syscap SystemCapability.Multimedia.Image.ImageSource 2711 * @crossplatform 2712 * @since 10 2713 */ 2714 getImageProperty(key: string, callback: AsyncCallback<string>): void; 2715 2716 /** 2717 * Obtains the value of a property in an image with the specified index. This method uses 2718 * a callback to return the property value in a string. 2719 * 2720 * @param { string } key Name of the property whose value is to be obtained. 2721 * @param { GetImagePropertyOptions } options Index of the image. 2722 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, the default value is returned. 2723 * @syscap SystemCapability.Multimedia.Image.ImageSource 2724 * @since 7 2725 */ 2726 /** 2727 * Obtains the value of a property in an image with the specified index. This method uses 2728 * a callback to return the property value in a string. 2729 * 2730 * @param { string } key Name of the property whose value is to be obtained. 2731 * @param { GetImagePropertyOptions } options Index of the image. 2732 * @param { AsyncCallback<string> } callback Callback used to return the property value. If the operation fails, the default value is returned. 2733 * @syscap SystemCapability.Multimedia.Image.ImageSource 2734 * @crossplatform 2735 * @since 10 2736 */ 2737 getImageProperty(key: string, options: GetImagePropertyOptions, callback: AsyncCallback<string>): void; 2738 2739 /** 2740 * Modify the value of a property in an image with the specified key. This method uses a 2741 * promise to return the property value in a string. 2742 * 2743 * @param { string } key Name of the property whose value is to be modified. 2744 * @param { string } value The value to be set to property. 2745 * @returns { Promise<void> } A Promise instance used to return the property value. 2746 * @syscap SystemCapability.Multimedia.Image.ImageSource 2747 * @since 9 2748 */ 2749 /** 2750 * Modify the value of a property in an image with the specified key. This method uses a 2751 * promise to return the property value in a string. 2752 * 2753 * @param { string } key Name of the property whose value is to be modified. 2754 * @param { string } value The value to be set to property. 2755 * @returns { Promise<void> } A Promise instance used to return the property value. 2756 * @syscap SystemCapability.Multimedia.Image.ImageSource 2757 * @crossplatform 2758 * @since 10 2759 */ 2760 modifyImageProperty(key: string, value: string): Promise<void>; 2761 2762 /** 2763 * Modify the value of a property in an image with the specified key. This method uses a callback to return the 2764 * property value in a string. 2765 * 2766 * @param { string } key Name of the property whose value is to be obtained. 2767 * @param { string } value The value to be set to property. 2768 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2769 * @syscap SystemCapability.Multimedia.Image.ImageSource 2770 * @since 9 2771 */ 2772 /** 2773 * Modify the value of a property in an image with the specified key. This method uses a callback to return the 2774 * property value in a string. 2775 * 2776 * @param { string } key Name of the property whose value is to be obtained. 2777 * @param { string } value The value to be set to property. 2778 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2779 * @syscap SystemCapability.Multimedia.Image.ImageSource 2780 * @crossplatform 2781 * @since 10 2782 */ 2783 modifyImageProperty(key: string, value: string, callback: AsyncCallback<void>): void; 2784 2785 /** 2786 * Update the data in the incremental ImageSource. 2787 * 2788 * @param { ArrayBuffer } buf The data to be updated. 2789 * @param { boolean } isFinished If is it finished. 2790 * @param { number } value The offset of data. 2791 * @param { number } length The length fo buf. 2792 * @returns { Promise<void> } A Promise instance used to return the property value. 2793 * @syscap SystemCapability.Multimedia.Image.ImageSource 2794 * @since 9 2795 */ 2796 /** 2797 * Update the data in the incremental ImageSource. 2798 * 2799 * @param { ArrayBuffer } buf The data to be updated. 2800 * @param { boolean } isFinished If is it finished. 2801 * @param { number } value The offset of data. 2802 * @param { number } length The length fo buf. 2803 * @returns { Promise<void> } A Promise instance used to return the property value. 2804 * @syscap SystemCapability.Multimedia.Image.ImageSource 2805 * @crossplatform 2806 * @since 10 2807 */ 2808 updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number): Promise<void>; 2809 2810 /** 2811 * Update the data in the incremental ImageSource. 2812 * 2813 * @param { ArrayBuffer } buf The data to be updated. 2814 * @param { boolean } isFinished If is it finished. 2815 * @param { number } value The offset of data. 2816 * @param { number } length The length fo buf. 2817 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2818 * @syscap SystemCapability.Multimedia.Image.ImageSource 2819 * @since 9 2820 */ 2821 /** 2822 * Update the data in the incremental ImageSource. 2823 * 2824 * @param { ArrayBuffer } buf The data to be updated. 2825 * @param { boolean } isFinished If is it finished. 2826 * @param { number } value The offset of data. 2827 * @param { number } length The length fo buf. 2828 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2829 * @syscap SystemCapability.Multimedia.Image.ImageSource 2830 * @crossplatform 2831 * @since 10 2832 */ 2833 updateData( 2834 buf: ArrayBuffer, 2835 isFinished: boolean, 2836 value: number, 2837 length: number, 2838 callback: AsyncCallback<void> 2839 ): void; 2840 2841 /** 2842 * Releases an ImageSource instance and uses a callback to return the result. 2843 * 2844 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2845 * @syscap SystemCapability.Multimedia.Image.ImageSource 2846 * @since 6 2847 */ 2848 /** 2849 * Releases an ImageSource instance and uses a callback to return the result. 2850 * 2851 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2852 * @syscap SystemCapability.Multimedia.Image.ImageSource 2853 * @crossplatform 2854 * @since 10 2855 */ 2856 release(callback: AsyncCallback<void>): void; 2857 2858 /** 2859 * Releases an ImageSource instance and uses a promise to return the result. 2860 * 2861 * @returns { Promise<void> } A Promise instance used to return the operation result. 2862 * @syscap SystemCapability.Multimedia.Image.ImageSource 2863 * @since 6 2864 */ 2865 /** 2866 * Releases an ImageSource instance and uses a promise to return the result. 2867 * 2868 * @returns { Promise<void> } A Promise instance used to return the operation result. 2869 * @syscap SystemCapability.Multimedia.Image.ImageSource 2870 * @crossplatform 2871 * @since 10 2872 */ 2873 release(): Promise<void>; 2874 2875 /** 2876 * Supported image formats. 2877 * 2878 * @type { Array<string> } 2879 * @syscap SystemCapability.Multimedia.Image.ImageSource 2880 * @since 6 2881 */ 2882 /** 2883 * Supported image formats. 2884 * 2885 * @type { Array<string> } 2886 * @syscap SystemCapability.Multimedia.Image.ImageSource 2887 * @crossplatform 2888 * @since 10 2889 */ 2890 readonly supportedFormats: Array<string>; 2891 } 2892 2893 /** 2894 * ImagePacker instance. 2895 * 2896 * @typedef ImagePacker 2897 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2898 * @since 6 2899 */ 2900 /** 2901 * ImagePacker instance. 2902 * 2903 * @typedef ImagePacker 2904 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2905 * @crossplatform 2906 * @since 10 2907 */ 2908 interface ImagePacker { 2909 /** 2910 * Compresses or packs an image and uses a callback to return the result. 2911 * 2912 * @param { ImageSource } source Image to be processed. 2913 * @param { PackingOption } option Option for image packing. 2914 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 2915 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2916 * @since 6 2917 */ 2918 /** 2919 * Compresses or packs an image and uses a callback to return the result. 2920 * 2921 * @param { ImageSource } source Image to be processed. 2922 * @param { PackingOption } option Option for image packing. 2923 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 2924 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2925 * @crossplatform 2926 * @since 10 2927 */ 2928 packing(source: ImageSource, option: PackingOption, callback: AsyncCallback<ArrayBuffer>): void; 2929 2930 /** 2931 * Compresses or packs an image and uses a promise to return the result. 2932 * 2933 * @param { ImageSource } source Image to be processed. 2934 * @param { PackingOption } option Option for image packing. 2935 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 2936 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2937 * @since 6 2938 */ 2939 /** 2940 * Compresses or packs an image and uses a promise to return the result. 2941 * 2942 * @param { ImageSource } source Image to be processed. 2943 * @param { PackingOption } option Option for image packing. 2944 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 2945 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2946 * @crossplatform 2947 * @since 10 2948 */ 2949 packing(source: ImageSource, option: PackingOption): Promise<ArrayBuffer>; 2950 2951 /** 2952 * Compresses or packs an image and uses a callback to return the result. 2953 * 2954 * @param { PixelMap } source PixelMap to be processed. 2955 * @param { PackingOption } option Option for image packing. 2956 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 2957 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2958 * @since 8 2959 */ 2960 /** 2961 * Compresses or packs an image and uses a callback to return the result. 2962 * 2963 * @param { PixelMap } source PixelMap to be processed. 2964 * @param { PackingOption } option Option for image packing. 2965 * @param { AsyncCallback<ArrayBuffer> } callback Callback used to return the packed data. 2966 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2967 * @crossplatform 2968 * @since 10 2969 */ 2970 packing(source: PixelMap, option: PackingOption, callback: AsyncCallback<ArrayBuffer>): void; 2971 2972 /** 2973 * Compresses or packs an image and uses a promise to return the result. 2974 * 2975 * @param { PixelMap } source PixelMap to be processed. 2976 * @param { PackingOption } option Option for image packing. 2977 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 2978 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2979 * @since 8 2980 */ 2981 /** 2982 * Compresses or packs an image and uses a promise to return the result. 2983 * 2984 * @param { PixelMap } source PixelMap to be processed. 2985 * @param { PackingOption } option Option for image packing. 2986 * @returns { Promise<ArrayBuffer> } A Promise instance used to return the compressed or packed data. 2987 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2988 * @crossplatform 2989 * @since 10 2990 */ 2991 packing(source: PixelMap, option: PackingOption): Promise<ArrayBuffer>; 2992 2993 /** 2994 * Releases an ImagePacker instance and uses a callback to return the result. 2995 * 2996 * @param { AsyncCallback<void> } callback Callback to return the operation result. 2997 * @syscap SystemCapability.Multimedia.Image.ImagePacker 2998 * @since 6 2999 */ 3000 /** 3001 * Releases an ImagePacker instance and uses a callback to return the result. 3002 * 3003 * @param { AsyncCallback<void> } callback Callback to return the operation result. 3004 * @syscap SystemCapability.Multimedia.Image.ImagePacker 3005 * @crossplatform 3006 * @since 10 3007 */ 3008 release(callback: AsyncCallback<void>): void; 3009 3010 /** 3011 * Releases an ImagePacker instance and uses a promise to return the result. 3012 * 3013 * @returns { Promise<void> } A Promise instance used to return the operation result. 3014 * @syscap SystemCapability.Multimedia.Image.ImagePacker 3015 * @since 6 3016 */ 3017 /** 3018 * Releases an ImagePacker instance and uses a promise to return the result. 3019 * 3020 * @returns { Promise<void> } A Promise instance used to return the operation result. 3021 * @syscap SystemCapability.Multimedia.Image.ImagePacker 3022 * @crossplatform 3023 * @since 10 3024 */ 3025 release(): Promise<void>; 3026 3027 /** 3028 * Supported image formats. 3029 * 3030 * @type { Array<string> } 3031 * @syscap SystemCapability.Multimedia.Image.ImagePacker 3032 * @since 6 3033 */ 3034 /** 3035 * Supported image formats. 3036 * 3037 * @type { Array<string> } 3038 * @syscap SystemCapability.Multimedia.Image.ImagePacker 3039 * @crossplatform 3040 * @since 10 3041 */ 3042 readonly supportedFormats: Array<string>; 3043 } 3044 3045 /** 3046 * Provides basic image operations, including obtaining image information, and reading and writing image data. 3047 * 3048 * @typedef Image 3049 * @syscap SystemCapability.Multimedia.Image.Core 3050 * @since 9 3051 */ 3052 interface Image { 3053 /** 3054 * Sets or gets the image area to crop, default is size. 3055 * 3056 * @type { Region } 3057 * @syscap SystemCapability.Multimedia.Image.Core 3058 * @since 9 3059 */ 3060 clipRect: Region; 3061 3062 /** 3063 * Image size. 3064 * 3065 * @type { Size } 3066 * @syscap SystemCapability.Multimedia.Image.Core 3067 * @since 9 3068 */ 3069 readonly size: Size; 3070 3071 /** 3072 * Image format. 3073 * 3074 * @type { number } 3075 * @syscap SystemCapability.Multimedia.Image.Core 3076 * @since 9 3077 */ 3078 readonly format: number; 3079 3080 /** 3081 * Get component buffer from image and uses a callback to return the result. 3082 * 3083 * @param { ComponentType } componentType The component type of image. 3084 * @param { AsyncCallback<Component> } callback Callback used to return the component buffer. 3085 * @syscap SystemCapability.Multimedia.Image.Core 3086 * @since 9 3087 */ 3088 getComponent(componentType: ComponentType, callback: AsyncCallback<Component>): void; 3089 3090 /** 3091 * Get component buffer from image and uses a promise to return the result. 3092 * 3093 * @param { ComponentType } componentType The component type of image. 3094 * @returns { Promise<Component> } A Promise instance used to return the component buffer. 3095 * @syscap SystemCapability.Multimedia.Image.Core 3096 * @since 9 3097 */ 3098 getComponent(componentType: ComponentType): Promise<Component>; 3099 3100 /** 3101 * Release current image to receive another and uses a callback to return the result. 3102 * 3103 * @param { AsyncCallback<void> } callback Callback to return the operation result. 3104 * @syscap SystemCapability.Multimedia.Image.Core 3105 * @since 9 3106 */ 3107 release(callback: AsyncCallback<void>): void; 3108 3109 /** 3110 * Release current image to receive another and uses a promise to return the result. 3111 * 3112 * @returns { Promise<void> } A Promise instance used to return the operation result. 3113 * @syscap SystemCapability.Multimedia.Image.Core 3114 * @since 9 3115 */ 3116 release(): Promise<void>; 3117 } 3118 3119 /** 3120 * Image receiver object. 3121 * 3122 * @typedef ImageReceiver 3123 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3124 * @since 9 3125 */ 3126 interface ImageReceiver { 3127 /** 3128 * Image size. 3129 * 3130 * @type { Size } 3131 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3132 * @since 9 3133 */ 3134 readonly size: Size; 3135 3136 /** 3137 * Image capacity. 3138 * 3139 * @type { number } 3140 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3141 * @since 9 3142 */ 3143 readonly capacity: number; 3144 3145 /** 3146 * Image format. 3147 * 3148 * @type { ImageFormat } 3149 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3150 * @since 9 3151 */ 3152 readonly format: ImageFormat; 3153 3154 /** 3155 * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface 3156 * and uses a callback to return the result. 3157 * 3158 * @param { AsyncCallback<string> } callback Callback used to return the surface id. 3159 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3160 * @since 9 3161 */ 3162 getReceivingSurfaceId(callback: AsyncCallback<string>): void; 3163 3164 /** 3165 * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface 3166 * and uses a promise to return the result. 3167 * 3168 * @returns { Promise<string> } A Promise instance used to return the surface id. 3169 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3170 * @since 9 3171 */ 3172 getReceivingSurfaceId(): Promise<string>; 3173 3174 /** 3175 * Get lasted image from receiver and uses a callback to return the result. 3176 * 3177 * @param { AsyncCallback<Image> } callback Callback used to return the latest image. 3178 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3179 * @since 9 3180 */ 3181 readLatestImage(callback: AsyncCallback<Image>): void; 3182 3183 /** 3184 * Get lasted image from receiver and uses a promise to return the result. 3185 * 3186 * @returns { Promise<Image> } A Promise instance used to return the latest image. 3187 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3188 * @since 9 3189 */ 3190 readLatestImage(): Promise<Image>; 3191 3192 /** 3193 * Get next image from receiver and uses a callback to return the result. 3194 * 3195 * @param { AsyncCallback<Image> } callback Callback used to return the next image. 3196 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3197 * @since 9 3198 */ 3199 readNextImage(callback: AsyncCallback<Image>): void; 3200 3201 /** 3202 * Get next image from receiver and uses a promise to return the result. 3203 * 3204 * @returns { Promise<Image> } A Promise instance used to return the next image. 3205 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3206 * @since 9 3207 */ 3208 readNextImage(): Promise<Image>; 3209 3210 /** 3211 * Subscribe callback when receiving an image 3212 * 3213 * @param { 'imageArrival' } type Callback used to return the next image. 3214 * @param { AsyncCallback<void> } callback Callback used to return image. 3215 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3216 * @since 9 3217 */ 3218 on(type: 'imageArrival', callback: AsyncCallback<void>): void; 3219 3220 /** 3221 * Release image receiver instance and uses a callback to return the result. 3222 * 3223 * @param { AsyncCallback<void> } callback Callback to return the operation result. 3224 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3225 * @since 9 3226 */ 3227 release(callback: AsyncCallback<void>): void; 3228 3229 /** 3230 * Release image receiver instance and uses a promise to return the result. 3231 * 3232 * @returns { Promise<void> } A Promise instance used to return the operation result. 3233 * @syscap SystemCapability.Multimedia.Image.ImageReceiver 3234 * @since 9 3235 */ 3236 release(): Promise<void>; 3237 } 3238 3239 /** 3240 * Image creator object. 3241 * 3242 * @typedef ImageCreator 3243 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3244 * @since 9 3245 */ 3246 interface ImageCreator { 3247 /** 3248 * Image capacity. 3249 * 3250 * @type { number } 3251 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3252 * @since 9 3253 */ 3254 readonly capacity: number; 3255 3256 /** 3257 * Image format. 3258 * 3259 * @type { ImageFormat } 3260 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3261 * @since 9 3262 */ 3263 readonly format: ImageFormat; 3264 3265 /** 3266 * Apply for new graphic buffer from free queue and use a callback to return the result. 3267 * 3268 * @param { AsyncCallback<Image> } callback Callback to return the operation result. 3269 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3270 * @since 9 3271 */ 3272 dequeueImage(callback: AsyncCallback<Image>): void; 3273 3274 /** 3275 * Apply for new graphic buffer from free queue and uses a promise to return the result. 3276 * 3277 * @returns { Promise<Image> } A Promise instance used to return the operation result. 3278 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3279 * @since 9 3280 */ 3281 dequeueImage(): Promise<Image>; 3282 3283 /** 3284 * Queue buffer to dirty queue and uses a callback to return the result. 3285 * 3286 * @param { Image } interface 3287 * @param { AsyncCallback<void> } callback Callback to return the operation result. 3288 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3289 * @since 9 3290 */ 3291 queueImage(interface: Image, callback: AsyncCallback<void>): void; 3292 3293 /** 3294 * Queue buffer to dirty queue and uses a promise to return the result. 3295 * 3296 * @param { Image } interface 3297 * @returns { Promise<void> } A Promise instance used to return the operation result. 3298 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3299 * @since 9 3300 */ 3301 queueImage(interface: Image): Promise<void>; 3302 3303 /** 3304 * Subscribe callback when releasing buffer 3305 * 3306 * @param { 'imageRelease' } type Callback used to return the operation result. 3307 * @param { AsyncCallback<void> } callback Callback used to return the operation result. 3308 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3309 * @since 9 3310 */ 3311 on(type: 'imageRelease', callback: AsyncCallback<void>): void; 3312 3313 /** 3314 * Releases buffer in bufferqueue instance and uses a callback to return the result. 3315 * 3316 * @param { AsyncCallback<void> } callback Callback to return the operation result. 3317 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3318 * @since 9 3319 */ 3320 release(callback: AsyncCallback<void>): void; 3321 3322 /** 3323 * Releases buffer in bufferqueue instance and uses a promise to return the result. 3324 * 3325 * @returns { Promise<void> } A Promise instance used to return the operation result. 3326 * @syscap SystemCapability.Multimedia.Image.ImageCreator 3327 * @since 9 3328 */ 3329 release(): Promise<void>; 3330 } 3331} 3332 3333export default image; 3334