• 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';
17import image from './@ohos.multimedia.image';
18
19/**
20 * @name  effectKit
21 * @since 9
22 */
23declare namespace effectKit {
24
25  /**
26   * The Filter of FilterChain.
27   * @since 9
28   * @syscap SystemCapability.Multimedia.Image.Core
29   */
30  interface Filter {
31
32    /**
33    * A blur effect is added to the image.
34    * @since 9
35    * @syscap SystemCapability.Multimedia.Image.Core
36    * @param radius The degree of blur, the value is measured in pixels.
37    * @returns Filters for the current effect have been added.
38    */
39    blur(radius:number): Filter;
40
41    /**
42    * A Brightness effect is added to the image.
43    * @since 9
44    * @syscap SystemCapability.Multimedia.Image.Core
45    * @param bright The degree of light and darkness,the value range is 0 to 1.
46    * @returns Filters for the current effect have been added.
47    */
48    brightness(bright:number): Filter;
49
50    /**
51    * A Grayscale effect is added to the image.
52    * @since 9
53    * @syscap SystemCapability.Multimedia.Image.Core
54    * @returns Filters for the current effect have been added.
55    */
56    grayscale(): Filter;
57
58    /**
59    * Gets the PixelMap where all filter effects have been added to the image.
60    * @since 9
61    * @syscap SystemCapability.Multimedia.Image.Core
62    * @returns image.PixelMap.
63    */
64    getPixelMap(): image.PixelMap;
65  }
66
67  /**
68   * The color picker of an image.
69   * @since 9
70   * @syscap SystemCapability.Multimedia.Image.Core
71   */
72  interface ColorPicker {
73
74    /**
75     * get main color of an image
76     * @since 9
77     * @syscap SystemCapability.Multimedia.Image.Core
78     */
79    getMainColor(): Promise<Color>;
80
81    /**
82     * get main color of an image
83     * @since 9
84     * @syscap SystemCapability.Multimedia.Image.Core
85     */
86    getMainColorSync(): Color;
87  }
88
89  /**
90   * The color param.
91   * @since 9
92   * @syscap SystemCapability.Multimedia.Image.Core
93   */
94  interface Color {
95
96    /**
97     * Red
98     * @since 9
99     * @syscap SystemCapability.Multimedia.Image.Core
100     */
101    red: number;
102
103    /**
104     * Green
105     * @since 9
106     * @syscap SystemCapability.Multimedia.Image.Core
107     */
108    green: number;
109
110    /**
111     * Blue
112     * @since 9
113     * @syscap SystemCapability.Multimedia.Image.Core
114     */
115    blue: number;
116
117    /**
118     * Alpha
119     * @since 9
120     * @syscap SystemCapability.Multimedia.Image.Core
121     */
122    alpha: number;
123  }
124
125  /**
126   * Create a FilterChain to add multiple effects to an image.
127   * @since 9
128   * @syscap SystemCapability.Multimedia.Image.Core
129   * @param image.PixelMap.
130   * @returns Returns the head node of FilterChain.
131   */
132  function createEffect(source: image.PixelMap): Filter;
133
134  /**
135   * Create a color picker to get color of an image.
136   * @since 9
137   * @syscap SystemCapability.Multimedia.Image.Core
138   * @param image.PixelMap.
139   * @returns Returns the ColorPicker.
140   */
141  function createColorPicker(source: image.PixelMap): Promise<ColorPicker>;
142
143  /**
144   * Create a color picker to get color of an image.
145   * @since 9
146   * @syscap SystemCapability.Multimedia.Image.Core
147   * @param image.PixelMap.
148   * @returns Returns the ColorPicker.
149   */
150  function createColorPicker(source: image.PixelMap, callback: AsyncCallback<ColorPicker>): void;
151}
152
153export default  effectKit;
154