• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 './basic';
17
18/**
19 * @name image
20 * @since 6
21 * @import import image from '@ohos.multimedia.image';
22 */
23declare namespace image {
24
25  /**
26   * Enumerates pixel map formats.
27   * @since 7
28   * @syscap SystemCapability.Multimedia.Image.Core
29   */
30  enum PixelMapFormat {
31    /**
32     * Indicates an unknown format.
33     * @since 7
34     * @syscap SystemCapability.Multimedia.Image.Core
35     */
36    UNKNOWN = 0,
37
38    /**
39     * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded
40     * from the higher-order to the lower-order bits: red is stored with 5 bits of precision,
41     * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision.
42     * @since 7
43     * @syscap SystemCapability.Multimedia.Image.Core
44     */
45    RGB_565 = 2,
46
47    /**
48     * Indicates that each pixel is stored on 32 bits. Components R, G, B, and A each occupies 8 bits
49     * and are stored from the higher-order to the lower-order bits.
50     * @since 7
51     * @syscap SystemCapability.Multimedia.Image.Core
52     */
53    RGBA_8888 = 3,
54
55    /**
56     * Indicates that each pixel is stored on 32 bits. Components B, G, R, and A each occupies 8 bits
57     * and are stored from the higher-order to the lower-order bits.
58     * @since 9
59     * @syscap SystemCapability.Multimedia.Image.Core
60     */
61    BGRA_8888 = 4,
62
63    /**
64     * Indicates that each pixel is stored on 24 bits. Only the R, G, and B each occupies 8 bits
65     * and are stored from the higher-order to the lower-order bits.
66     * @since 9
67     * @syscap SystemCapability.Multimedia.Image.Core
68     */
69    RGB_888 = 5,
70
71    /**
72     * Indicates that each pixel is stored on 8 bits. Only the ALPHA which occupies 8 bits
73     * and is stored from the higher-order to the lower-order bits.
74     * @since 9
75     * @syscap SystemCapability.Multimedia.Image.Core
76     */
77    ALPHA_8 = 6,
78
79    /**
80     * Indicates that each pixel is stored on 32 bits. Components B, G, R, and A each occupies 8 bits
81     * and are stored from the higher-order to the lower-order bits in F16.
82     * @since 9
83     * @syscap SystemCapability.Multimedia.Image.Core
84     */
85    RGBA_F16 = 7,
86
87    /**
88     * Indicates that The storage order is to store Y first and then V U alternately each occupies 8 bits
89     * and are stored from the higher-order to the lower-order bits.
90     * @since 9
91     * @syscap SystemCapability.Multimedia.Image.Core
92     */
93    NV21 = 8,
94
95    /**
96     * Indicates that The storage order is to store Y first and then U V alternately each occupies 8 bits
97     * and are stored from the higher-order to the lower-order bits.
98     * @since 9
99     * @syscap SystemCapability.Multimedia.Image.Core
100     */
101    NV12 = 9,
102  }
103
104  /**
105   * Describes the size of an image.
106   * @since 6
107   * @syscap SystemCapability.Multimedia.Image.Core
108   */
109  interface Size {
110    /**
111     * Height
112     * @since 6
113     * @syscap SystemCapability.Multimedia.Image.Core
114     */
115    height: number;
116
117    /**
118     * Width
119     * @since 6
120     * @syscap SystemCapability.Multimedia.Image.Core
121     */
122    width: number;
123  }
124
125  /**
126   * Enumerates exchangeable image file format (Exif) information types of an image.
127   * @since 7
128   * @syscap SystemCapability.Multimedia.Image.Core
129   */
130  enum PropertyKey {
131    /**
132     * Number of bits in each pixel of an image.
133     * @since 7
134     * @syscap SystemCapability.Multimedia.Image.Core
135     */
136    BITS_PER_SAMPLE = "BitsPerSample",
137
138    /**
139     * Image rotation mode.
140     * @since 7
141     * @syscap SystemCapability.Multimedia.Image.Core
142     */
143    ORIENTATION = "Orientation",
144
145    /**
146     * Image length.
147     * @since 7
148     * @syscap SystemCapability.Multimedia.Image.Core
149     */
150    IMAGE_LENGTH = "ImageLength",
151
152    /**
153     * Image width.
154     * @since 7
155     * @syscap SystemCapability.Multimedia.Image.Core
156     */
157    IMAGE_WIDTH = "ImageWidth",
158
159    /**
160     * GPS latitude.
161     * @since 7
162     * @syscap SystemCapability.Multimedia.Image.Core
163     */
164    GPS_LATITUDE = "GPSLatitude",
165
166    /**
167     * GPS longitude.
168     * @since 7
169     * @syscap SystemCapability.Multimedia.Image.Core
170     */
171    GPS_LONGITUDE = "GPSLongitude",
172
173    /**
174     * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude.
175     * @since 7
176     * @syscap SystemCapability.Multimedia.Image.Core
177     */
178    GPS_LATITUDE_REF = "GPSLatitudeRef",
179
180    /**
181     * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude.
182     * @since 7
183     * @syscap SystemCapability.Multimedia.Image.Core
184     */
185    GPS_LONGITUDE_REF = "GPSLongitudeRef",
186
187    /**
188     * Shooting time
189     * @since 9
190     * @syscap SystemCapability.Multimedia.Image.Core
191     */
192    DATE_TIME_ORIGINAL = "DateTimeOriginal",
193
194    /**
195     * Exposure time
196     * @since 9
197     * @syscap SystemCapability.Multimedia.Image.Core
198     */
199    EXPOSURE_TIME = "ExposureTime",
200
201    /**
202     * Scene type
203     * @since 9
204     * @syscap SystemCapability.Multimedia.Image.Core
205     */
206    SCENE_TYPE = "SceneType",
207
208    /**
209     * ISO speedratings
210     * @since 9
211     * @syscap SystemCapability.Multimedia.Image.Core
212     */
213    ISO_SPEED_RATINGS = "ISOSpeedRatings",
214
215    /**
216     * Aperture value
217     * @since 9
218     * @syscap SystemCapability.Multimedia.Image.Core
219     */
220    F_NUMBER = "FNumber",
221  }
222
223  /**
224   * Enum for image formats.
225   * @since 9
226   * @syscap SystemCapability.Multimedia.Image.Core
227   */
228   enum ImageFormat {
229    /**
230     * YCBCR422 semi-planar format.
231     * @since 9
232     * @syscap SystemCapability.Multimedia.Image.Core
233     */
234    YCBCR_422_SP = 1000,
235
236    /**
237     * JPEG encoding format.
238     * @since 9
239     * @syscap SystemCapability.Multimedia.Image.Core
240     */
241    JPEG = 2000
242  }
243
244  /**
245   * Enumerates alpha types.
246   * @since 9
247   * @syscap SystemCapability.Multimedia.Image.Core
248   */
249  enum AlphaType {
250    /**
251     * Indicates an unknown alpha type.
252     * @since 9
253     * @syscap SystemCapability.Multimedia.Image.Core
254     */
255    UNKNOWN = 0,
256
257    /**
258     * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque.
259     * @since 9
260     * @syscap SystemCapability.Multimedia.Image.Core
261     */
262    OPAQUE = 1,
263
264    /**
265     * Indicates that RGB components of each pixel in the image are premultiplied by alpha.
266     * @since 9
267     * @syscap SystemCapability.Multimedia.Image.Core
268     */
269    PREMUL = 2,
270
271    /**
272     * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha.
273     * @since 9
274     * @syscap SystemCapability.Multimedia.Image.Core
275     */
276    UNPREMUL = 3
277  }
278
279  /**
280   * Enum for image scale mode.
281   * @since 9
282   * @syscap SystemCapability.Multimedia.Image.Core
283   */
284  enum ScaleMode {
285    /**
286     * Indicates the effect that fits the image into the target size.
287     * @since 9
288     * @syscap SystemCapability.Multimedia.Image.Core
289     */
290    FIT_TARGET_SIZE = 0,
291
292    /**
293     * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area.
294     * @since 9
295     * @syscap SystemCapability.Multimedia.Image.Core
296     */
297    CENTER_CROP = 1,
298  }
299
300  /**
301   * The component type of image.
302   * @since 9
303   * @syscap SystemCapability.Multimedia.Image.ImageReceiver
304   */
305  enum ComponentType {
306    /**
307     * Luma info.
308     * @since 9
309     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
310     */
311    YUV_Y = 1,
312
313    /**
314     * Chrominance info.
315     * @since 9
316     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
317     */
318    YUV_U = 2,
319
320    /**
321     * Chroma info.
322     * @since 9
323     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
324     */
325    YUV_V = 3,
326
327    /**
328     * Jpeg type.
329     * @since 9
330     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
331     */
332    JPEG = 4,
333  }
334
335  /**
336   * Describes region information.
337   * @since 8
338   * @syscap SystemCapability.Multimedia.Image.Core
339   */
340  interface Region {
341    /**
342     * Image size.
343     * @since 7
344     * @syscap SystemCapability.Multimedia.Image.Core
345     */
346    size: Size;
347
348    /**
349     * x-coordinate at the upper left corner of the image.
350     * @since 7
351     * @syscap SystemCapability.Multimedia.Image.Core
352     */
353    x: number;
354
355    /**
356     * y-coordinate at the upper left corner of the image.
357     * @since 7
358     * @syscap SystemCapability.Multimedia.Image.Core
359     */
360    y: number;
361  }
362
363  /**
364   * Describes area information in an image.
365   * @since 7
366   * @syscap SystemCapability.Multimedia.Image.Core
367   */
368  interface PositionArea {
369    /**
370     * Image data that will be read or written.
371     * @since 7
372     * @syscap SystemCapability.Multimedia.Image.Core
373     */
374    pixels: ArrayBuffer;
375
376    /**
377     * Offset for data reading.
378     * @since 7
379     * @syscap SystemCapability.Multimedia.Image.Core
380     */
381    offset: number;
382
383    /**
384     * Number of bytes to read.
385     * @since 7
386     * @syscap SystemCapability.Multimedia.Image.Core
387     */
388    stride: number;
389
390    /**
391     * Region to read.
392     * @since 7
393     * @syscap SystemCapability.Multimedia.Image.Core
394     */
395    region: Region;
396  }
397
398  /**
399   * Describes image information.
400   * @since 6
401   * @syscap SystemCapability.Multimedia.Image.Core
402   */
403  interface ImageInfo {
404    /**
405     * Indicates image dimensions specified by a {@link Size} interface.
406     * @since 6
407     * @syscap SystemCapability.Multimedia.Image.Core
408     */
409    size: Size;
410
411    /**
412     * Indicates image default density.
413     * @since 9
414     * @syscap SystemCapability.Multimedia.Image.Core
415     */
416    density: number;
417  }
418
419  /**
420   * Describes the option for image packing.
421   * @since 6
422   * @syscap SystemCapability.Multimedia.Image.ImagePacker
423   */
424  interface PackingOption {
425    /**
426     * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg.
427     * @since 6
428     * @syscap SystemCapability.Multimedia.Image.ImagePacker
429     */
430    format: string;
431
432    /**
433     * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better
434     * image quality but larger space occupied.
435     * @since 6
436     * @syscap SystemCapability.Multimedia.Image.ImagePacker
437     */
438    quality: number;
439
440    /**
441     * BufferSize of the target image. The value is an integer which better not be too big.
442     * if this bufferSize is less than or equal to 0, it will be converted to 10MB.
443     * image quality but larger space occupied.
444     * @since 9
445     * @syscap SystemCapability.Multimedia.Image.ImagePacker
446     */
447    bufferSize?: number;
448  }
449
450  /**
451   * Describes image properties.
452   * @since 7
453   * @syscap SystemCapability.Multimedia.Image.ImageSource
454   */
455  interface GetImagePropertyOptions {
456    /**
457     * Index of an image.
458     * @since 7
459     * @syscap SystemCapability.Multimedia.Image.ImageSource
460     */
461    index?: number;
462
463    /**
464     * Default property value.
465     * @since 7
466     * @syscap SystemCapability.Multimedia.Image.ImageSource
467     */
468    defaultValue?: string;
469  }
470
471  /**
472   * Describes image decoding parameters.
473   * @since 7
474   * @syscap SystemCapability.Multimedia.Image.ImageSource
475   */
476  interface DecodingOptions {
477    /**
478     * Number of image frames.
479     * @since 7
480     * @syscap SystemCapability.Multimedia.Image.ImageSource
481     */
482    index?: number;
483
484    /**
485     * Sampling ratio of the image pixel map.
486     * @since 7
487     * @syscap SystemCapability.Multimedia.Image.ImageSource
488     */
489    sampleSize?: number;
490
491    /**
492     * Rotation angle of the image pixel map. The value ranges from 0 to 360.
493     * @since 7
494     * @syscap SystemCapability.Multimedia.Image.ImageSource
495     */
496    rotate?: number;
497
498    /**
499     * Whether the image pixel map is editable.
500     * @since 7
501     * @syscap SystemCapability.Multimedia.Image.ImageSource
502     */
503    editable?: boolean;
504
505    /**
506     * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded
507     * based on the original image size.
508     * @since 7
509     * @syscap SystemCapability.Multimedia.Image.ImageSource
510     */
511    desiredSize?: Size;
512
513    /**
514     * Cropping region of the image pixel map.
515     * @since 7
516     * @syscap SystemCapability.Multimedia.Image.ImageSource
517     */
518    desiredRegion?: Region;
519
520    /**
521     * Data format of the image pixel map.
522     * @since 7
523     * @syscap SystemCapability.Multimedia.Image.ImageSource
524     */
525    desiredPixelFormat?: PixelMapFormat;
526
527    /**
528     * The density for image pixel map.
529     * @since 9
530     * @syscap SystemCapability.Multimedia.Image.ImageSource
531     */
532    fitDensity?: number;
533  }
534
535  /**
536   * Describes image color components.
537   * @since 9
538   * @syscap SystemCapability.Multimedia.Image.Core
539   */
540   interface Component {
541    /**
542     * Component type.
543     * @since 9
544     * @syscap SystemCapability.Multimedia.Image.Core
545     */
546    readonly componentType: ComponentType;
547
548    /**
549     * Row stride.
550     * @since 9
551     * @syscap SystemCapability.Multimedia.Image.Core
552     */
553    readonly rowStride: number;
554
555    /**
556     * Pixel stride.
557     * @since 9
558     * @syscap SystemCapability.Multimedia.Image.Core
559     */
560    readonly pixelStride: number;
561
562    /**
563     * Component buffer.
564     * @since 9
565     * @syscap SystemCapability.Multimedia.Image.Core
566     */
567    readonly byteBuffer: ArrayBuffer;
568  }
569
570  /**
571   * Initialization options for pixelmap.
572   * @since 8
573   * @syscap SystemCapability.Multimedia.Image.Core
574   */
575  interface InitializationOptions {
576    /**
577     * PixelMap size.
578     * @since 8
579     * @syscap SystemCapability.Multimedia.Image.Core
580     */
581    size: Size;
582
583    /**
584     * PixelMap expected format.
585     * @since 8
586     * @syscap SystemCapability.Multimedia.Image.Core
587     */
588    pixelFormat?: PixelMapFormat;
589
590    /**
591     * Editable or not.
592     * @since 8
593     * @syscap SystemCapability.Multimedia.Image.Core
594     */
595    editable?: boolean;
596
597    /**
598     * PixelMap expected alpha type.
599     * @since 9
600     * @syscap SystemCapability.Multimedia.Image.Core
601     */
602    alphaType?: AlphaType;
603
604    /**
605     * PixelMap expected scaling effect.
606     * @since 9
607     * @syscap SystemCapability.Multimedia.Image.Core
608     */
609    scaleMode?: ScaleMode;
610  }
611
612  /**
613   * Initialization options for ImageSource.
614   * @since 9
615   * @syscap SystemCapability.Multimedia.Image.Core
616   */
617  interface SourceOptions {
618    /**
619     * The density for ImageSource.
620     * @since 9
621     * @syscap SystemCapability.Multimedia.Image.Core
622     */
623    sourceDensity: number;
624
625    /**
626     * PixelMap expected format.
627     * @since 9
628     * @syscap SystemCapability.Multimedia.Image.Core
629     */
630    sourcePixelFormat?: PixelMapFormat;
631
632    /**
633     * PixelMap size.
634     * @since 9
635     * @syscap SystemCapability.Multimedia.Image.Core
636     */
637    sourceSize?: Size;
638  }
639
640  /**
641   * Create pixelmap by data buffer.
642   * @since 8
643   * @syscap SystemCapability.Multimedia.Image.Core
644   */
645  function createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback<PixelMap>): void;
646
647  /**
648   * Create pixelmap by data buffer.
649   * @since 8
650   * @syscap SystemCapability.Multimedia.Image.Core
651   */
652  function createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise<PixelMap>;
653
654  /**
655   * Creates an ImageSource instance based on the URI.
656   * @since 6
657   * @syscap SystemCapability.Multimedia.Image.ImageSource
658   * @param uri Image source URI.
659   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
660   */
661  function createImageSource(uri: string): ImageSource;
662
663  /**
664   * Creates an ImageSource instance based on the URI.
665   * @since 9
666   * @syscap SystemCapability.Multimedia.Image.ImageSource
667   * @param uri Image source URI.
668   * @param options The config of Image source.
669   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
670   */
671  function createImageSource(uri: string, options: SourceOptions): ImageSource;
672
673  /**
674   * Creates an ImageSource instance based on the file descriptor.
675   * @since 7
676   * @syscap SystemCapability.Multimedia.Image.ImageSource
677   * @param fd ID of a file descriptor.
678   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
679   */
680  function createImageSource(fd: number): ImageSource;
681
682  /**
683   * Creates an ImageSource instance based on the file descriptor.
684   * @since 9
685   * @syscap SystemCapability.Multimedia.Image.ImageSource
686   * @param fd ID of a file descriptor.
687   * @param options The config of Image source.
688   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
689   */
690  function createImageSource(fd: number, options: SourceOptions): ImageSource;
691
692  /**
693   * Creates an ImageSource instance based on the buffer.
694   * @since 9
695   * @syscap SystemCapability.Multimedia.Image.ImageSource
696   * @param buf The buffer of the image.
697   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
698   */
699  function createImageSource(buf: ArrayBuffer): ImageSource;
700
701  /**
702   * Creates an ImageSource instance based on the buffer.
703   * @since 9
704   * @syscap SystemCapability.Multimedia.Image.ImageSource
705   * @param buf The buffer of the image.
706   * @param options The config of Image source.
707   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
708   */
709  function createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource;
710
711  /**
712   * Creates an ImageSource instance based on the buffer in incremental.
713   * @since 9
714   * @syscap SystemCapability.Multimedia.Image.ImageSource
715   * @param buf The buffer of the image.
716   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
717   */
718  function CreateIncrementalSource(buf: ArrayBuffer): ImageSource;
719
720  /**
721   * Creates an ImageSource instance based on the buffer in incremental.
722   * @since 9
723   * @syscap SystemCapability.Multimedia.Image.ImageSource
724   * @param buf The buffer of the image.
725   * @param options The config of source.
726   * @return Returns the ImageSource instance if the operation is successful; returns null otherwise.
727   */
728  function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource;
729
730  /**
731   * Creates an ImagePacker instance.
732   * @since 6
733   * @syscap SystemCapability.Multimedia.Image.ImagePacker
734   * @return Returns the ImagePacker instance if the operation is successful; returns null otherwise.
735   */
736  function createImagePacker(): ImagePacker;
737
738  /**
739   * Creates an ImageReceiver instance.
740   * @since 9
741   * @syscap SystemCapability.Multimedia.Image.ImageReceiver
742   * @param width The default width in pixels of the Images that this receiver will produce.
743   * @param height The default height in pixels of the Images that this receiver will produce.
744   * @param format The format of the Image that this receiver will produce. This must be one of the
745   *            {@link ImageFormat} constants.
746   * @param capacity The maximum number of images the user will want to access simultaneously.
747   * @return Returns the ImageReceiver instance if the operation is successful; returns null otherwise.
748   */
749  function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver;
750
751  /**
752   * Creates an ImageCreator instance.
753   * @since 9
754   * @syscap SystemCapability.Multimedia.Image.ImageCreator
755   * @param width The default width in pixels of the Images that this creator will produce.
756   * @param height The default height in pixels of the Images that this creator will produce.
757   * @param format The format of the Image that this creator will produce. This must be one of the
758   *            {@link ImageFormat} constants.
759   * @param capacity The maximum number of images the user will want to access simultaneously.
760   * @return Returns the ImageCreator instance if the operation is successful; returns null otherwise.
761   */
762  function createImageCreator(width: number, height: number, format: number, capacity: number): ImageCreator;
763
764  /**
765   * PixelMap instance.
766   * @since 7
767   * @syscap SystemCapability.Multimedia.Image.Core
768   */
769  interface PixelMap {
770    /**
771     * Whether the image pixel map can be edited.
772     * @since 7
773     * @syscap SystemCapability.Multimedia.Image.Core
774     */
775    readonly isEditable: boolean;
776
777    /**
778     * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses
779     * a promise to return the result.
780     * @since 7
781     * @syscap SystemCapability.Multimedia.Image.Core
782     * @param dst A buffer to which the image pixel map data will be written.
783     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
784     */
785    readPixelsToBuffer(dst: ArrayBuffer): Promise<void>;
786
787    /**
788     * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses
789     * a callback to return the result.
790     * @since 7
791     * @syscap SystemCapability.Multimedia.Image.Core
792     * @param dst A buffer to which the image pixel map data will be written.
793     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
794     */
795    readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback<void>): void;
796
797    /**
798     * Reads image pixel map data in an area. This method uses a promise to return the data read.
799     * @since 7
800     * @syscap SystemCapability.Multimedia.Image.Core
801     * @param area Area from which the image pixel map data will be read.
802     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
803     */
804    readPixels(area: PositionArea): Promise<void>;
805
806    /**
807     * Reads image pixel map data in an area. This method uses a callback to return the data read.
808     * @since 7
809     * @syscap SystemCapability.Multimedia.Image.Core
810     * @param area Area from which the image pixel map data will be read.
811     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
812     */
813    readPixels(area: PositionArea, callback: AsyncCallback<void>): void;
814
815    /**
816     * Writes image pixel map data to the specified area. This method uses a promise to return
817     * the operation result.
818     * @since 7
819     * @syscap SystemCapability.Multimedia.Image.Core
820     * @param area Area to which the image pixel map data will be written.
821     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
822     */
823    writePixels(area: PositionArea): Promise<void>;
824
825    /**
826     * Writes image pixel map data to the specified area. This method uses a callback to return
827     * the operation result.
828     * @since 7
829     * @syscap SystemCapability.Multimedia.Image.Core
830     * @param area Area to which the image pixel map data will be written.
831     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
832     */
833    writePixels(area: PositionArea, callback: AsyncCallback<void>): void;
834
835    /**
836     * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method
837     * uses a promise to return the result.
838     * @since 7
839     * @syscap SystemCapability.Multimedia.Image.Core
840     * @param src A buffer from which the image data will be read.
841     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
842     */
843    writeBufferToPixels(src: ArrayBuffer): Promise<void>;
844
845    /**
846     * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method
847     * uses a callback to return the result.
848     * @since 7
849     * @syscap SystemCapability.Multimedia.Image.Core
850     * @param src A buffer from which the image data will be read.
851     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
852     */
853    writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback<void>): void;
854
855    /**
856     * Obtains pixel map information about this image. This method uses a promise to return the information.
857     * @since 7
858     * @syscap SystemCapability.Multimedia.Image.Core
859     * @return A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned.
860     */
861    getImageInfo(): Promise<ImageInfo>;
862
863    /**
864     * Obtains pixel map information about this image. This method uses a callback to return the information.
865     * @since 7
866     * @syscap SystemCapability.Multimedia.Image.Core
867     * @param callback Callback used to return the image pixel map information. If the operation fails, an error message is returned.
868     */
869    getImageInfo(callback: AsyncCallback<ImageInfo>): void;
870
871    /**
872     * Obtains the number of bytes in each line of the image pixel map.
873     * @since 7
874     * @syscap SystemCapability.Multimedia.Image.Core
875     * @return Number of bytes in each line.
876     */
877    getBytesNumberPerRow(): number;
878
879    /**
880     * Obtains the total number of bytes of the image pixel map.
881     * @since 7
882     * @syscap SystemCapability.Multimedia.Image.Core
883     * @return Total number of bytes.
884     */
885    getPixelBytesNumber(): number;
886
887    /**
888     * Obtains the density of the image pixel map.
889     * @since 9
890     * @syscap SystemCapability.Multimedia.Image.Core
891     * @return The number of density.
892     */
893    getDensity():number;
894
895    /**
896     * Set the transparent rate of pixel map. This method uses a callback to return the operation result.
897     * @since 9
898     * @syscap SystemCapability.Multimedia.Image.Core
899     * @param rate The value of transparent rate.
900     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
901     */
902    opacity(rate: number, callback: AsyncCallback<void>): void;
903
904    /**
905     * Set the transparent rate of pixel map. This method uses a promise to return the result.
906     * @since 9
907     * @syscap SystemCapability.Multimedia.Image.Core
908     * @param rate The value of transparent rate.
909     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
910     */
911    opacity(rate: number): Promise<void>;
912
913    /**
914     * Obtains new pixel map with allpha information. This method uses a promise to return the information.
915     * @since 9
916     * @syscap SystemCapability.Multimedia.Image.Core
917     * @return A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned.
918     */
919    createAlphaPixelmap(): Promise<PixelMap>;
920
921    /**
922     * Obtains new pixel map with allpha information. This method uses a callback to return the information.
923     * @since 9
924     * @syscap SystemCapability.Multimedia.Image.Core
925     * @param callback Callback used to return the new image pixel map. If the operation fails, an error message is returned.
926     */
927    createAlphaPixelmap(callback: AsyncCallback<PixelMap>): void;
928
929    /**
930     * Image zoom in width and height. This method uses a callback to return the operation result.
931     * @since 9
932     * @syscap SystemCapability.Multimedia.Image.Core
933     * @param x The zoom value of width.
934	 * @param y The zoom value of height.
935     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
936     */
937    scale(x: number, y: number, callback: AsyncCallback<void>): void;
938
939    /**
940     * Image zoom in width and height. This method uses a promise to return the result.
941     * @since 9
942     * @syscap SystemCapability.Multimedia.Image.Core
943     * @param x The zoom value of width.
944	 * @param y The zoom value of height.
945     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
946     */
947    scale(x: number, y: number): Promise<void>;
948
949    /**
950     * Image position transformation. This method uses a callback to return the operation result.
951     * @since 9
952     * @syscap SystemCapability.Multimedia.Image.Core
953     * @param x The position value of width.
954	 * @param y The position value of height.
955     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
956     */
957    translate(x: number, y: number, callback: AsyncCallback<void>): void;
958
959    /**
960     * Image position transformation. This method uses a promise to return the result.
961     * @since 9
962     * @syscap SystemCapability.Multimedia.Image.Core
963     * @param x The position value of width.
964	 * @param y The position value of height.
965     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
966     */
967    translate(x: number, y: number): Promise<void>;
968
969    /**
970     * Image rotation. This method uses a callback to return the operation result.
971     * @since 9
972     * @syscap SystemCapability.Multimedia.Image.Core
973     * @param angle The rotation angle.
974     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
975     */
976    rotate(angle: number, callback: AsyncCallback<void>): void;
977
978    /**
979     * Image rotation. This method uses a promise to return the result.
980     * @since 9
981     * @syscap SystemCapability.Multimedia.Image.Core
982     * @param angle The rotation angle.
983     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
984     */
985    rotate(angle: number): Promise<void>;
986
987    /**
988     * Image flipping. This method uses a callback to return the operation result.
989     * @since 9
990     * @syscap SystemCapability.Multimedia.Image.Core
991     * @param horizontal Is flip in horizontal.
992     * @param vertical Is flip in vertical.
993     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
994     */
995    flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback<void>): void;
996
997    /**
998     * Image flipping. This method uses a promise to return the result.
999     * @since 9
1000     * @syscap SystemCapability.Multimedia.Image.Core
1001     * @param horizontal Is flip in horizontal.
1002     * @param vertical Is flip in vertical.
1003     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
1004     */
1005    flip(horizontal: boolean, vertical: boolean): Promise<void>;
1006
1007    /**
1008     * Crop the image. This method uses a callback to return the operation result.
1009     * @since 9
1010     * @syscap SystemCapability.Multimedia.Image.Core
1011     * @param region The region to crop.
1012     * @param callback Callback used to return the operation result. If the operation fails, an error message is returned.
1013     */
1014    crop(region: Region, callback: AsyncCallback<void>): void;
1015
1016    /**
1017     * Crop the image. This method uses a promise to return the result.
1018     * @since 9
1019     * @syscap SystemCapability.Multimedia.Image.Core
1020     * @param region The region to crop.
1021     * @return A Promise instance used to return the operation result. If the operation fails, an error message is returned.
1022     */
1023    crop(region: Region): Promise<void>;
1024
1025    /**
1026     * Releases this PixelMap object. This method uses a callback to return the result.
1027     * @since 7
1028     * @syscap SystemCapability.Multimedia.Image.Core
1029     * @param callback Callback invoked for instance release. If the operation fails, an error message is returned.
1030     */
1031    release(callback: AsyncCallback<void>): void;
1032
1033    /**
1034     * Releases this PixelMap object. This method uses a promise to return the result.
1035     * @since 7
1036     * @syscap SystemCapability.Multimedia.Image.Core
1037     * @return A Promise instance used to return the instance release result. If the operation fails, an error message is returned.
1038     */
1039    release(): Promise<void>;
1040  }
1041
1042  /**
1043   * ImageSource instance.
1044   * @since 6
1045   * @syscap SystemCapability.Multimedia.Image.ImageSource
1046   */
1047  interface ImageSource {
1048    /**
1049     * Obtains information about an image with the specified sequence number and uses a callback
1050     * to return the result.
1051     * @since 6
1052     * @syscap SystemCapability.Multimedia.Image.ImageSource
1053     * @param index Sequence number of an image.
1054     * @param callback Callback used to return the image information.
1055     */
1056    getImageInfo(index: number, callback: AsyncCallback<ImageInfo>): void;
1057
1058    /**
1059     * Obtains information about this image and uses a callback to return the result.
1060     * @since 6
1061     * @syscap SystemCapability.Multimedia.Image.ImageSource
1062     * @param callback Callback used to return the image information.
1063     */
1064    getImageInfo(callback: AsyncCallback<ImageInfo>): void;
1065
1066    /**
1067     * Get image information from image source.
1068     * @since 6
1069     * @syscap SystemCapability.Multimedia.Image.ImageSource
1070     * @param index Sequence number of an image. If this parameter is not specified, the default value 0 is used.
1071     * @return A Promise instance used to return the image information.
1072     */
1073    getImageInfo(index?: number): Promise<ImageInfo>;
1074
1075    /**
1076     * Creates a PixelMap object based on image decoding parameters. This method uses a promise to
1077     * return the object.
1078     * @since 7
1079     * @syscap SystemCapability.Multimedia.Image.ImageSource
1080     * @param options Image decoding parameters.
1081     * @return A Promise instance used to return the PixelMap object.
1082     */
1083    createPixelMap(options?: DecodingOptions): Promise<PixelMap>;
1084
1085    /**
1086     * Creates a PixelMap object. This method uses a callback to return the object.
1087     * @since 7
1088     * @syscap SystemCapability.Multimedia.Image.ImageSource
1089     * @param callback Callback used to return the PixelMap object.
1090     */
1091    createPixelMap(callback: AsyncCallback<PixelMap>): void;
1092
1093    /**
1094     * Creates a PixelMap object based on image decoding parameters. This method uses a callback to
1095     * return the object.
1096     * @since 7
1097     * @syscap SystemCapability.Multimedia.Image.ImageSource
1098     * @param options Image decoding parameters.
1099     * @param callback Callback used to return the PixelMap object.
1100     */
1101    createPixelMap(options: DecodingOptions, callback: AsyncCallback<PixelMap>): void;
1102
1103    /**
1104     * Obtains the value of a property in an image with the specified index. This method uses a
1105     * promise to return the property value in a string.
1106     * @since 7
1107     * @syscap SystemCapability.Multimedia.Image.ImageSource
1108     * @param key Name of the property whose value is to be obtained.
1109     * @param options Index of the image.
1110     * @return A Promise instance used to return the property value. If the operation fails, the default value is returned.
1111     */
1112    getImageProperty(key: string, options?: GetImagePropertyOptions): Promise<string>;
1113
1114    /**
1115     * Obtains the value of a property in this image. This method uses a callback to return the
1116     * property value in a string.
1117     * @since 7
1118     * @syscap SystemCapability.Multimedia.Image.ImageSource
1119     * @param key Name of the property whose value is to be obtained.
1120     * @param callback Callback used to return the property value. If the operation fails, an error message is returned.
1121     */
1122    getImageProperty(key: string, callback: AsyncCallback<string>): void;
1123
1124    /**
1125     * Obtains the value of a property in an image with the specified index. This method uses
1126     * a callback to return the property value in a string.
1127     * @since 7
1128     * @syscap SystemCapability.Multimedia.Image.ImageSource
1129     * @param key Name of the property whose value is to be obtained.
1130     * @param options Index of the image.
1131     * @param callback Callback used to return the property value. If the operation fails, the default value is returned.
1132     */
1133    getImageProperty(key: string, options: GetImagePropertyOptions, callback: AsyncCallback<string>): void;
1134
1135    /**
1136     * Modify the value of a property in an image with the specified key. This method uses a
1137     * promise to return the property value in a string.
1138     * @since 9
1139     * @syscap SystemCapability.Multimedia.Image.ImageSource
1140     * @param key Name of the property whose value is to be modified.
1141     * @param value The value to be set to property.
1142     * @return A Promise instance used to return the property value.
1143     */
1144    modifyImageProperty(key: string, value: string): Promise<void>;
1145
1146    /**
1147     * Modify the value of a property in an image with the specified key. This method uses a callback to return the
1148     * property value in a string.
1149     * @since 9
1150     * @syscap SystemCapability.Multimedia.Image.ImageSource
1151     * @param key Name of the property whose value is to be obtained.
1152     * @param value The value to be set to property.
1153     * @param callback Callback to return the operation result.
1154     */
1155    modifyImageProperty(key: string, value: string, callback: AsyncCallback<void>): void;
1156
1157    /**
1158     * Update the data in the incremental ImageSource.
1159     * @since 9
1160     * @syscap SystemCapability.Multimedia.Image.ImageSource
1161     * @param buf The data to be updated.
1162     * @param isFinished If is it finished.
1163     * @param value The offset of data.
1164     * @param length The length fo buf.
1165     * @return A Promise instance used to return the property value.
1166     */
1167    updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number): Promise<void>;
1168
1169    /**
1170     * Update the data in the incremental ImageSource.
1171     * @since 9
1172     * @syscap SystemCapability.Multimedia.Image.ImageSource
1173     * @param buf The data to be updated.
1174     * @param isFinished If is it finished.
1175     * @param value The offset of data.
1176     * @param length The length fo buf.
1177     * @param callback Callback to return the operation result.
1178     */
1179    updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback<void>): void;
1180
1181    /**
1182     * Releases an ImageSource instance and uses a callback to return the result.
1183     * @since 6
1184     * @syscap SystemCapability.Multimedia.Image.ImageSource
1185     * @param callback Callback to return the operation result.
1186     */
1187    release(callback: AsyncCallback<void>): void;
1188
1189    /**
1190     * Releases an ImageSource instance and uses a promise to return the result.
1191     * @since 6
1192     * @syscap SystemCapability.Multimedia.Image.ImageSource
1193     * @return A Promise instance used to return the operation result.
1194     */
1195    release(): Promise<void>;
1196
1197    /**
1198     * Supported image formats.
1199     * @since 6
1200     * @syscap SystemCapability.Multimedia.Image.ImageSource
1201     */
1202    readonly supportedFormats: Array<string>;
1203  }
1204
1205  /**
1206   * ImagePacker instance.
1207   * @since 6
1208   * @syscap SystemCapability.Multimedia.Image.ImagePacker
1209   */
1210  interface ImagePacker {
1211    /**
1212     * Compresses or packs an image and uses a callback to return the result.
1213     * @since 6
1214     * @syscap SystemCapability.Multimedia.Image.ImagePacker
1215     * @param source Image to be processed.
1216     * @param option Option for image packing.
1217     * @param callback Callback used to return the packed data.
1218     */
1219    packing(source: ImageSource, option: PackingOption, callback: AsyncCallback<ArrayBuffer>): void;
1220
1221    /**
1222     * Compresses or packs an image and uses a promise to return the result.
1223     * @since 6
1224     * @syscap SystemCapability.Multimedia.Image.ImagePacker
1225     * @param source Image to be processed.
1226     * @param option Option for image packing.
1227     * @return A Promise instance used to return the compressed or packed data.
1228     */
1229    packing(source: ImageSource, option: PackingOption): Promise<ArrayBuffer>;
1230
1231    /**
1232     * Compresses or packs an image and uses a callback to return the result.
1233     * @since 8
1234     * @syscap SystemCapability.Multimedia.Image.ImagePacker
1235     * @param source PixelMap to be processed.
1236     * @param option Option for image packing.
1237     * @param callback Callback used to return the packed data.
1238     */
1239     packing(source: PixelMap, option: PackingOption, callback: AsyncCallback<ArrayBuffer>): void;
1240
1241     /**
1242      * Compresses or packs an image and uses a promise to return the result.
1243      * @since 8
1244      * @syscap SystemCapability.Multimedia.Image.ImagePacker
1245      * @param source PixelMap to be processed.
1246      * @param option Option for image packing.
1247      * @return A Promise instance used to return the compressed or packed data.
1248      */
1249     packing(source: PixelMap, option: PackingOption): Promise<ArrayBuffer>;
1250
1251    /**
1252     * Releases an ImagePacker instance and uses a callback to return the result.
1253     * @since 6
1254     * @syscap SystemCapability.Multimedia.Image.ImagePacker
1255     * @param callback Callback to return the operation result.
1256     */
1257    release(callback: AsyncCallback<void>): void;
1258
1259    /**
1260     * Releases an ImagePacker instance and uses a promise to return the result.
1261     * @since 6
1262     * @syscap SystemCapability.Multimedia.Image.ImagePacker
1263     * @return A Promise instance used to return the operation result.
1264     */
1265    release(): Promise<void>;
1266
1267    /**
1268     * Supported image formats.
1269     * @since 6
1270     * @syscap SystemCapability.Multimedia.Image.ImagePacker
1271     */
1272    readonly supportedFormats: Array<string>;
1273  }
1274
1275  /**
1276   * Provides basic image operations, including obtaining image information, and reading and writing image data.
1277   * @since 9
1278   * @syscap SystemCapability.Multimedia.Image.Core
1279   */
1280  interface Image {
1281    /**
1282     * Sets or gets the image area to crop, default is size.
1283     * @since 9
1284     * @syscap SystemCapability.Multimedia.Image.Core
1285     */
1286    clipRect: Region;
1287
1288    /**
1289     * Image size.
1290     * @since 9
1291     * @syscap SystemCapability.Multimedia.Image.Core
1292     */
1293    readonly size: Size;
1294
1295    /**
1296     * Image format.
1297     * @since 9
1298     * @syscap SystemCapability.Multimedia.Image.Core
1299     */
1300    readonly format: number;
1301
1302    /**
1303     * Get component buffer from image and uses a callback to return the result.
1304     * @since 9
1305     * @syscap SystemCapability.Multimedia.Image.Core
1306     * @param componentType The component type of image.
1307     * @param callback Callback used to return the component buffer.
1308     */
1309    getComponent(componentType: ComponentType, callback: AsyncCallback<Component>): void;
1310
1311    /**
1312     * Get component buffer from image and uses a promise to return the result.
1313     * @since 9
1314     * @syscap SystemCapability.Multimedia.Image.Core
1315     * @param componentType The component type of image.
1316     * @return A Promise instance used to return the component buffer.
1317     */
1318    getComponent(componentType: ComponentType): Promise<Component>;
1319
1320    /**
1321     * Release current image to receive another and uses a callback to return the result.
1322     * @since 9
1323     * @syscap SystemCapability.Multimedia.Image.Core
1324     * @param callback Callback to return the operation result.
1325     */
1326    release(callback: AsyncCallback<void>): void;
1327
1328    /**
1329     * Release current image to receive another and uses a promise to return the result.
1330     * @since 9
1331     * @syscap SystemCapability.Multimedia.Image.Core
1332     * @return A Promise instance used to return the operation result.
1333     */
1334    release(): Promise<void>;
1335  }
1336
1337  /**
1338   * Image receiver object.
1339   * @since 9
1340   * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1341   */
1342  interface ImageReceiver {
1343    /**
1344     * Image size.
1345     * @since 9
1346     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1347     */
1348    readonly size: Size;
1349
1350    /**
1351     * Image capacity.
1352     * @since 9
1353     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1354     */
1355    readonly capacity: number;
1356
1357    /**
1358     * Image format.
1359     * @since 9
1360     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1361     */
1362    readonly format: ImageFormat;
1363
1364    /**
1365     * get an id which indicates a surface and can be used to set to Camera or other component can receive a surface
1366     * and uses a callback to return the result.
1367     * @since 9
1368     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1369     * @param callback Callback used to return the surface id.
1370     */
1371    getReceivingSurfaceId(callback: AsyncCallback<string>): void;
1372
1373    /**
1374     * get an id which indicates a surface and can be used to set to Camera or other component can receive a surface
1375     * and uses a promise to return the result.
1376     * @since 9
1377     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1378     * @return A Promise instance used to return the surface id.
1379     */
1380    getReceivingSurfaceId(): Promise<string>;
1381
1382    /**
1383     * Get lasted image from receiver and uses a callback to return the result.
1384     * @since 9
1385     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1386     * @param callback Callback used to return the latest image.
1387     */
1388    readLatestImage(callback: AsyncCallback<Image>): void;
1389
1390    /**
1391     * Get lasted image from receiver and uses a promise to return the result.
1392     * @since 9
1393     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1394     * @return A Promise instance used to return the latest image.
1395     */
1396    readLatestImage(): Promise<Image>;
1397
1398    /**
1399     * Get next image from receiver and uses a callback to return the result.
1400     * @since 9
1401     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1402     * @param callback Callback used to return the next image.
1403     */
1404    readNextImage(callback: AsyncCallback<Image>): void;
1405
1406    /**
1407     * Get next image from receiver and uses a promise to return the result.
1408     * @since 9
1409     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1410     * @return A Promise instance used to return the next image.
1411     */
1412    readNextImage(): Promise<Image>;
1413
1414    /**
1415     * Subscribe callback when receiving an image
1416     * @since 9
1417     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1418     * @param type Callback used to return the next image.
1419     * @param callback Callback used to return image.
1420     */
1421    on(type: 'imageArrival', callback: AsyncCallback<void>): void;
1422
1423    /**
1424     * Release image receiver instance and uses a callback to return the result.
1425     * @since 9
1426     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1427     * @param callback Callback to return the operation result.
1428     */
1429    release(callback: AsyncCallback<void>): void;
1430
1431    /**
1432     * Release image receiver instance and uses a promise to return the result.
1433     * @since 9
1434     * @syscap SystemCapability.Multimedia.Image.ImageReceiver
1435     * @return A Promise instance used to return the operation result.
1436     */
1437    release(): Promise<void>;
1438  }
1439
1440  /**
1441   * Image creator object.
1442   * @since 9
1443   * @syscap SystemCapability.Multimedia.Image.ImageCreator
1444   */
1445  interface ImageCreator {
1446    /**
1447     * Image capacity.
1448     * @since 9
1449     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1450     */
1451    readonly capacity: number;
1452
1453    /**
1454     * Image format.
1455     * @since 9
1456     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1457     */
1458    readonly format: ImageFormat;
1459
1460    /**
1461     * apply for new graphic buffer from free queue and uses a callback to return the result.
1462     * @since 9
1463     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1464     * @param callback Callback to return the operation result.
1465     */
1466    dequeueImage(callback: AsyncCallback<Image>): void;
1467
1468    /**
1469     * apply for new graphic buffer from free queue and uses a promise to return the result.
1470     * @since 9
1471     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1472     * @return A Promise instance used to return the operation result.
1473     */
1474    dequeueImage(): Promise<Image>;
1475
1476    /**
1477     * queue buffer to dirty queue and uses a callback to return the result.
1478     * @since 9
1479     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1480     * @param callback Callback to return the operation result.
1481     */
1482    queueImage(interface: Image, callback: AsyncCallback<void>): void;
1483
1484    /**
1485     * queue buffer to dirty queue and uses a promise to return the result.
1486     * @since 9
1487     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1488     * @return A Promise instance used to return the operation result.
1489     */
1490    queueImage(interface: Image): Promise<void>;
1491
1492    /**
1493     * Subscribe callback when releasing buffer
1494     * @since 9
1495     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1496     * @param type Callback used to return the operation result.
1497     * @param callback Callback used to return the operation result.
1498     */
1499    on(type: 'imageRelease', callback: AsyncCallback<void>): void;
1500
1501    /**
1502     * Releases buffer in bufferqueue instance and uses a callback to return the result.
1503     * @since 9
1504     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1505     * @param callback Callback to return the operation result.
1506     */
1507    release(callback: AsyncCallback<void>): void;
1508
1509    /**
1510     * Releases buffer in bufferqueue instance and uses a promise to return the result.
1511     * @since 9
1512     * @syscap SystemCapability.Multimedia.Image.ImageCreator
1513     * @return A Promise instance used to return the operation result.
1514     */
1515    release(): Promise<void>;
1516  }
1517}
1518
1519export default image;
1520