1/* 2* Copyright (c) 2022 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16/** 17 * @file 18 * @kit ArkGraphics2D 19 */ 20 21/*** if arkts 1.1 */ 22import { AsyncCallback } from './@ohos.base'; 23import image from './@ohos.multimedia.image'; 24/*** endif */ 25/*** if arkts 1.2 */ 26import image from './@ohos.multimedia.image'; 27/*** endif */ 28 29/** 30 * @namespace effectKit 31 * @since 9 32 */ 33/** 34 * @namespace effectKit 35 * @form 36 * @atomicservice 37 * @since 12 38 */ 39/** 40 * @namespace effectKit 41 * @crossplatform 42 * @form 43 * @atomicservice 44 * @since arkts {'1.1':'14', '1.2':'20'} 45 * @arkts 1.1&1.2 46 */ 47 48declare namespace effectKit { 49 50 /** 51 * The Filter of FilterChain. 52 * @typedef Filter 53 * @syscap SystemCapability.Multimedia.Image.Core 54 * @since 9 55 */ 56 /** 57 * The Filter of FilterChain. 58 * @typedef Filter 59 * @syscap SystemCapability.Multimedia.Image.Core 60 * @form 61 * @atomicservice 62 * @since 12 63 */ 64 /** 65 * A class used to add a specified effect to an image. Before calling any method of Filter, use createEffect to create a Filter instance. 66 * @typedef Filter 67 * @syscap SystemCapability.Multimedia.Image.Core 68 * @crossplatform 69 * @form 70 * @atomicservice 71 * @since arkts {'1.1':'14', '1.2':'20'} 72 * @arkts 1.1&1.2 73 */ 74 interface Filter { 75 76 /** 77 * A blur effect is added to the image. 78 * @param { number } radius - The degree of blur, the value is measured in pixels. 79 * @returns { Filter } Filters for the current effect have been added. 80 * @syscap SystemCapability.Multimedia.Image.Core 81 * @since 9 82 */ 83 /** 84 * A blur effect is added to the image. 85 * @param { number } radius - The degree of blur, the value is measured in pixels. 86 * @returns { Filter } Filters for the current effect have been added. 87 * @syscap SystemCapability.Multimedia.Image.Core 88 * @form 89 * @atomicservice 90 * @since 12 91 */ 92 /** 93 * Adds the blur effect to the filter linked list, and returns the head node of the linked list. 94 * @param { number } radius - Blur radius, in pixels. The blur effect is proportional to the configured value. 95 * A larger value indicates a more obvious effect. 96 * @returns { Filter } Final image effect. 97 * @syscap SystemCapability.Multimedia.Image.Core 98 * @crossplatform 99 * @form 100 * @atomicservice 101 * @since arkts {'1.1':'14', '1.2':'20'} 102 * @arkts 1.1&1.2 103 */ 104 blur(radius: number): Filter; 105 106 /** 107 * Adds the blur effect to the filter linked list, and returns the head node of the linked list. 108 * @param { number } radius - Blur radius, in pixels. The blur effect is proportional to the configured value. 109 * A larger value indicates a more obvious effect. 110 * @param { TileMode } tileMode - Tile mode of the shader effect. The blur effect of image edges is affected. Currently, 111 * only CPU rendering is supported. Therefore, the tile mode supports only DECAL. 112 * @returns { Filter } Final image effect. 113 * @syscap SystemCapability.Multimedia.Image.Core 114 * @since 14 115 */ 116 blur(radius: number, tileMode: TileMode): Filter; 117 118 /** 119 * A Brightness effect is added to the image. 120 * @param { number } bright - The degree of light and darkness,the value range is 0 to 1. 121 * @returns { Filter } Filters for the current effect have been added. 122 * @syscap SystemCapability.Multimedia.Image.Core 123 * @since 9 124 */ 125 /** 126 * A Brightness effect is added to the image. 127 * @param { number } bright - The degree of light and darkness,the value range is 0 to 1. 128 * @returns { Filter } Filters for the current effect have been added. 129 * @syscap SystemCapability.Multimedia.Image.Core 130 * @form 131 * @atomicservice 132 * @since 12 133 */ 134 /** 135 * Adds the brightness effect to the filter linked list, and returns the head node of the linked list. 136 * @param { number } bright - Brightness value, ranging from 0 to 1. When the value is 0, the image brightness remains unchanged. 137 * @returns { Filter } Final image effect. 138 * @syscap SystemCapability.Multimedia.Image.Core 139 * @crossplatform 140 * @form 141 * @atomicservice 142 * @since 14 143 */ 144 brightness(bright: number): Filter; 145 146 /** 147 * A Grayscale effect is added to the image. 148 * @returns { Filter } Filters for the current effect have been added. 149 * @syscap SystemCapability.Multimedia.Image.Core 150 * @since 9 151 */ 152 /** 153 * A Grayscale effect is added to the image. 154 * @returns { Filter } Filters for the current effect have been added. 155 * @syscap SystemCapability.Multimedia.Image.Core 156 * @form 157 * @atomicservice 158 * @since 12 159 */ 160 /** 161 * Adds the grayscale effect to the filter linked list, and returns the head node of the linked list. 162 * @returns { Filter } Final image effect. 163 * @syscap SystemCapability.Multimedia.Image.Core 164 * @crossplatform 165 * @form 166 * @atomicservice 167 * @since 14 168 */ 169 grayscale(): Filter; 170 171 /** 172 * A invert effect is added to the image. 173 * @returns { Filter } Filters for the current effect have been added. 174 * @syscap SystemCapability.Multimedia.Image.Core 175 * @since 12 176 */ 177 /** 178 * Adds the inversion effect to the filter linked list, and returns the head node of the linked list. 179 * @returns { Filter } Final image effect. 180 * @syscap SystemCapability.Multimedia.Image.Core 181 * @crossplatform 182 * @since 14 183 */ 184 invert(): Filter; 185 186 /** 187 * A custom effect is added to the image. 188 * 189 * @param { Array<number> } colorMatrix - A matrix of 5x4 size for create effect filter. 190 * @returns { Filter } Filters for the current effect have been added. 191 * @throws { BusinessError } 401 - Input parameter error. 192 * @syscap SystemCapability.Multimedia.Image.Core 193 * @since 12 194 */ 195 /** 196 * Adds a custom effect to the filter linked list, and returns the head node of the linked list. 197 * 198 * @param { Array<number> } colorMatrix - Custom color matrix. 199 * A 5 x 4 matrix can be created. The value range of the matrix element is [0, 1], 200 * where 0 indicates that the color channel is not involved in the calculation, 201 * and 1 indicates that the color channel is involved in the calculation and retains the original weight. 202 * @returns { Filter } Final image effect. 203 * @throws { BusinessError } 401 - Input parameter error. 204 * @syscap SystemCapability.Multimedia.Image.Core 205 * @crossplatform 206 * @since 14 207 */ 208 setColorMatrix(colorMatrix: Array<number>): Filter; 209 210 /** 211 * Obtains image.PixelMap of the source image to which the filter linked list is added. 212 * @returns { image.PixelMap } image.PixelMap. 213 * @syscap SystemCapability.Multimedia.Image.Core 214 * @since 9 215 * @deprecated since 11 216 * @useinstead effectKit.Filter#getEffectPixelMap 217 */ 218 getPixelMap(): image.PixelMap; 219 220 /** 221 * Gets the PixelMap where all filter effects have been added to the image. 222 * @returns { Promise<image.PixelMap> } - returns the PixelMap generated. 223 * @syscap SystemCapability.Multimedia.Image.Core 224 * @since 11 225 */ 226 /** 227 * Gets the PixelMap where all filter effects have been added to the image. 228 * @returns { Promise<image.PixelMap> } - returns the PixelMap generated. 229 * @syscap SystemCapability.Multimedia.Image.Core 230 * @form 231 * @atomicservice 232 * @since 12 233 */ 234 /** 235 * Obtains image.PixelMap of the source image to which the filter linked list is added. This API uses a promise to return the result. 236 * @returns { Promise<image.PixelMap> } - Promise used to return image.PixelMap of the source image. 237 * @syscap SystemCapability.Multimedia.Image.Core 238 * @crossplatform 239 * @form 240 * @atomicservice 241 * @since arkts {'1.1':'14', '1.2':'20'} 242 * @arkts 1.1&1.2 243 */ 244 getEffectPixelMap(): Promise<image.PixelMap>; 245 246 /** 247 * Gets the PixelMap where all filter effects have been added to the image. 248 * @param { boolean } useCpuRender - Whether to use cpu render. 249 * @returns { Promise<image.PixelMap> } - returns the PixelMap generated. 250 * @syscap SystemCapability.Multimedia.Image.Core 251 * @crossplatform 252 * @form 253 * @atomicservice 254 * @since 20 255 */ 256 getEffectPixelMap(useCpuRender : boolean): Promise<image.PixelMap>; 257 } 258 259 /** 260 * The color picker of an image. 261 * @typedef ColorPicker 262 * @syscap SystemCapability.Multimedia.Image.Core 263 * @since 9 264 */ 265 /** 266 * The color picker of an image. 267 * @typedef ColorPicker 268 * @syscap SystemCapability.Multimedia.Image.Core 269 * @form 270 * @atomicservice 271 * @since 12 272 */ 273 /** 274 * A class used to obtain the color from an image. Before calling any method of ColorPicker, use createColorPicker to create a ColorPicker instance. 275 * @typedef ColorPicker 276 * @syscap SystemCapability.Multimedia.Image.Core 277 * @crossplatform 278 * @form 279 * @atomicservice 280 * @since 14 281 */ 282 interface ColorPicker { 283 284 /** 285 * get main color of an image 286 * @returns { Promise<Color> } returns the MainColor generated. 287 * @syscap SystemCapability.Multimedia.Image.Core 288 * @since 9 289 */ 290 /** 291 * get main color of an image 292 * @returns { Promise<Color> } returns the MainColor generated. 293 * @syscap SystemCapability.Multimedia.Image.Core 294 * @form 295 * @atomicservice 296 * @since 12 297 */ 298 /** 299 * Obtains the main color from the image and writes the result to a Color instance. This API uses a promise to return the result. 300 * @returns { Promise<Color> } Promise used to return the color value of the main color. If the operation fails, an error message is returned. 301 * @syscap SystemCapability.Multimedia.Image.Core 302 * @crossplatform 303 * @form 304 * @atomicservice 305 * @since 14 306 */ 307 getMainColor(): Promise<Color>; 308 309 /** 310 * get main color of an image 311 * @returns { Color } Main color picked in the image. 312 * @syscap SystemCapability.Multimedia.Image.Core 313 * @since 9 314 */ 315 /** 316 * get main color of an image 317 * @returns { Color } Main color picked in the image. 318 * @syscap SystemCapability.Multimedia.Image.Core 319 * @form 320 * @atomicservice 321 * @since 12 322 */ 323 /** 324 * Obtains the main color from the image and writes the result to a Color instance. This API returns the result synchronously. 325 * @returns { Color } Color value of the main color. If the operation fails, null is returned. 326 * @syscap SystemCapability.Multimedia.Image.Core 327 * @crossplatform 328 * @form 329 * @atomicservice 330 * @since 14 331 */ 332 getMainColorSync(): Color; 333 334 /** 335 * Get largest proportion color of an image 336 * @returns { Color } Largest proportion color picked in the image. 337 * @syscap SystemCapability.Multimedia.Image.Core 338 * @since 10 339 */ 340 /** 341 * Get largest proportion color of an image 342 * @returns { Color } Largest proportion color picked in the image. 343 * @syscap SystemCapability.Multimedia.Image.Core 344 * @form 345 * @atomicservice 346 * @since 12 347 */ 348 /** 349 * Obtains the color with the largest proportion from the image and writes the result to a Color instance. This API returns the result synchronously. 350 * @returns { Color } Color value of the color with the largest proportion. If the operation fails, null is returned. 351 * @syscap SystemCapability.Multimedia.Image.Core 352 * @crossplatform 353 * @form 354 * @atomicservice 355 * @since 14 356 */ 357 getLargestProportionColor(): Color; 358 359 /** 360 * Get top proportion color of an image 361 * @param { number } colorCount - The number of colors to require, the value is 1 to 10. 362 * @returns { Array<Color | null> } An array of feature colors sorted by proportion, with a size equal to 363 * the minimum of colorCount and the actual number of extracted feature colors. 364 * @syscap SystemCapability.Multimedia.Image.Core 365 * @form 366 * @atomicservice 367 * @since 12 368 */ 369 /** 370 * Obtains a given number of colors with the top proportions in the image. This API returns the result synchronously. 371 * @param { number } colorCount - Number of colors to obtain. The value range is [1, 10]. If a non-integer is passed in, the value will be rounded down. 372 * @returns { Array<Color | null> } Array of colors, sorted by proportion. 373 * - If the number of colors obtained is less than the value of colorCount, the array size is the actual number obtained. 374 * - If the colors fail to be obtained or the number of colors obtained is less than 1, [null] is returned. 375 * - If the value of colorCount is greater than 10, an array holding the first 10 colors with the top proportions is returned. 376 * @syscap SystemCapability.Multimedia.Image.Core 377 * @crossplatform 378 * @form 379 * @atomicservice 380 * @since 14 381 */ 382 getTopProportionColors(colorCount: number): Array<Color | null>; 383 384 /** 385 * Get highest saturation color of an image 386 * @returns { Color } Highest saturation color picked in the image. 387 * @syscap SystemCapability.Multimedia.Image.Core 388 * @since 10 389 */ 390 /** 391 * Get highest saturation color of an image 392 * @returns { Color } Highest saturation color picked in the image. 393 * @syscap SystemCapability.Multimedia.Image.Core 394 * @form 395 * @atomicservice 396 * @since 12 397 */ 398 /** 399 * Obtains the color with the highest saturation from the image and writes the result to a Color instance. This API returns the result synchronously. 400 * @returns { Color } Color value of the color with the highest saturation. If the operation fails, null is returned. 401 * @syscap SystemCapability.Multimedia.Image.Core 402 * @crossplatform 403 * @form 404 * @atomicservice 405 * @since 14 406 */ 407 getHighestSaturationColor(): Color; 408 409 /** 410 * Get average color of an image 411 * @returns { Color } Average color calculated in the image. 412 * @syscap SystemCapability.Multimedia.Image.Core 413 * @since 10 414 */ 415 /** 416 * Get average color of an image 417 * @returns { Color } Average color calculated in the image. 418 * @syscap SystemCapability.Multimedia.Image.Core 419 * @form 420 * @atomicservice 421 * @since 12 422 */ 423 /** 424 * Obtains the average color from the image and writes the result to a Color instance. This API returns the result synchronously. 425 * @returns { Color } Average color value. If the operation fails, null is returned. 426 * @syscap SystemCapability.Multimedia.Image.Core 427 * @crossplatform 428 * @form 429 * @atomicservice 430 * @since 14 431 */ 432 getAverageColor(): Color; 433 434 /** 435 * Determine whether the color is black or white or gray 436 * @param { number } color - The 32 bit ARGB color to discriminate. 437 * @returns { boolean } Result of judging black, white and gray. 438 * @syscap SystemCapability.Multimedia.Image.Core 439 * @since 10 440 */ 441 /** 442 * Determine whether the color is black or white or gray 443 * @param { number } color - The 32 bit ARGB color to discriminate. 444 * @returns { boolean } Result of judging black, white and gray. 445 * @syscap SystemCapability.Multimedia.Image.Core 446 * @form 447 * @atomicservice 448 * @since 12 449 */ 450 /** 451 * Checks whether a color is black, white, and gray. 452 * @param { number } color - Color to check. The value range is [0x0, 0xFFFFFFFF]. 453 * @returns { boolean } Returns true if the image is black, white, and gray; returns false otherwise. 454 * @syscap SystemCapability.Multimedia.Image.Core 455 * @crossplatform 456 * @form 457 * @atomicservice 458 * @since 14 459 */ 460 isBlackOrWhiteOrGrayColor(color: number): boolean; 461 } 462 463 /** 464 * The color param. 465 * @typedef Color 466 * @syscap SystemCapability.Multimedia.Image.Core 467 * @since 9 468 */ 469 /** 470 * The color param. 471 * @typedef Color 472 * @syscap SystemCapability.Multimedia.Image.Core 473 * @form 474 * @atomicservice 475 * @since 12 476 */ 477 /** 478 * A class that stores the color picked. 479 * @typedef Color 480 * @syscap SystemCapability.Multimedia.Image.Core 481 * @crossplatform 482 * @form 483 * @atomicservice 484 * @since 14 485 */ 486 interface Color { 487 488 /** 489 * Red 490 * @type { number } 491 * @syscap SystemCapability.Multimedia.Image.Core 492 * @since 9 493 */ 494 /** 495 * Red 496 * @type { number } 497 * @syscap SystemCapability.Multimedia.Image.Core 498 * @form 499 * @atomicservice 500 * @since 12 501 */ 502 /** 503 * Value of the red component. The value range is [0x0, 0xFF]. 504 * @type { number } 505 * @syscap SystemCapability.Multimedia.Image.Core 506 * @crossplatform 507 * @form 508 * @atomicservice 509 * @since 14 510 */ 511 red: number; 512 513 /** 514 * Green 515 * @type { number } 516 * @syscap SystemCapability.Multimedia.Image.Core 517 * @since 9 518 */ 519 /** 520 * Green 521 * @type { number } 522 * @syscap SystemCapability.Multimedia.Image.Core 523 * @form 524 * @atomicservice 525 * @since 12 526 */ 527 /** 528 * Value of the green component. The value range is [0x0, 0xFF]. 529 * @type { number } 530 * @syscap SystemCapability.Multimedia.Image.Core 531 * @crossplatform 532 * @form 533 * @atomicservice 534 * @since 14 535 */ 536 green: number; 537 538 /** 539 * Blue 540 * @type { number } 541 * @syscap SystemCapability.Multimedia.Image.Core 542 * @since 9 543 */ 544 /** 545 * Blue 546 * @type { number } 547 * @syscap SystemCapability.Multimedia.Image.Core 548 * @form 549 * @atomicservice 550 * @since 12 551 */ 552 /** 553 * Value of the blue component. The value range is [0x0, 0xFF]. 554 * @type { number } 555 * @syscap SystemCapability.Multimedia.Image.Core 556 * @crossplatform 557 * @form 558 * @atomicservice 559 * @since 14 560 */ 561 blue: number; 562 563 /** 564 * Alpha 565 * @type { number } 566 * @syscap SystemCapability.Multimedia.Image.Core 567 * @since 9 568 */ 569 /** 570 * Alpha 571 * @type { number } 572 * @syscap SystemCapability.Multimedia.Image.Core 573 * @form 574 * @atomicservice 575 * @since 12 576 */ 577 /** 578 * Value of the alpha component. The value range is [0x0, 0xFF]. 579 * @type { number } 580 * @syscap SystemCapability.Multimedia.Image.Core 581 * @crossplatform 582 * @form 583 * @atomicservice 584 * @since 14 585 */ 586 alpha: number; 587 } 588 589 /** 590 * Create a FilterChain to add multiple effects to an image. 591 * @param { image.PixelMap } source - the source pixelmap. 592 * @returns { Filter } Returns the head node of FilterChain. 593 * @syscap SystemCapability.Multimedia.Image.Core 594 * @since 9 595 */ 596 /** 597 * Create a FilterChain to add multiple effects to an image. 598 * @param { image.PixelMap } source - the source pixelmap. 599 * @returns { Filter } Returns the head node of FilterChain. 600 * @syscap SystemCapability.Multimedia.Image.Core 601 * @form 602 * @atomicservice 603 * @since 12 604 */ 605 /** 606 * Creates a Filter instance based on a pixel map. 607 * @param { image.PixelMap } source - PixelMap instance created by the image module. An instance can be obtained 608 * by decoding an image or directly created. For details, see Image Overview. 609 * @returns { Filter } Head node of the filter linked list without any effect. If the operation fails, null is returned. 610 * @syscap SystemCapability.Multimedia.Image.Core 611 * @crossplatform 612 * @form 613 * @atomicservice 614 * @since arkts {'1.1':'14', '1.2':'20'} 615 * @arkts 1.1&1.2 616 */ 617 function createEffect(source: image.PixelMap): Filter; 618 619 /** 620 * Create a color picker to get color of an image. 621 * @param { image.PixelMap } source - the source pixelmap. 622 * @returns { Promise<ColorPicker> } - returns the ColorPicker generated. 623 * @throws { BusinessError } 401 - Input parameter error. 624 * @syscap SystemCapability.Multimedia.Image.Core 625 * @since 9 626 */ 627 /** 628 * Create a color picker to get color of an image. 629 * @param { image.PixelMap } source - the source pixelmap. 630 * @returns { Promise<ColorPicker> } - returns the ColorPicker generated. 631 * @throws { BusinessError } 401 - Input parameter error. 632 * @syscap SystemCapability.Multimedia.Image.Core 633 * @form 634 * @atomicservice 635 * @since 12 636 */ 637 /** 638 * Creates a ColorPicker instance based on a pixel map. This API uses a promise to return the result. 639 * @param { image.PixelMap } source - PixelMap instance created by the image module. An instance can be 640 * obtained by decoding an image or directly created. For details, see Image Overview. 641 * @returns { Promise<ColorPicker> } - Promise used to return the ColorPicker instance created. 642 * @throws { BusinessError } 401 - Input parameter error. 643 * @syscap SystemCapability.Multimedia.Image.Core 644 * @crossplatform 645 * @form 646 * @atomicservice 647 * @since 14 648 */ 649 function createColorPicker(source: image.PixelMap): Promise<ColorPicker>; 650 651 /** 652 * Create a color picker to get color of an image. 653 * @param { image.PixelMap } source - the source pixelmap. 654 * @param { Array<number> } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, 655 * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. 656 * @returns { Promise<ColorPicker> } - returns the ColorPicker generated. 657 * @throws { BusinessError } 401 - Input parameter error. 658 * @syscap SystemCapability.Multimedia.Image.Core 659 * @since 10 660 */ 661 /** 662 * Create a color picker to get color of an image. 663 * @param { image.PixelMap } source - the source pixelmap. 664 * @param { Array<number> } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, 665 * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. 666 * @returns { Promise<ColorPicker> } - returns the ColorPicker generated. 667 * @throws { BusinessError } 401 - Input parameter error. 668 * @syscap SystemCapability.Multimedia.Image.Core 669 * @form 670 * @atomicservice 671 * @since 12 672 */ 673 /** 674 * Creates a ColorPicker instance for the selected region based on a pixel map. This API uses a promise to return the result. 675 * @param { image.PixelMap } source - PixelMap instance created by the image module. An instance can be obtained by decoding 676 * an image or directly created. For details, see Image Overview. 677 * @param { Array<number> } region - Region of the image from which the color is picked. 678 * The array consists of four elements, representing the left, top, right, and bottom positions of the image, respectively. 679 * The value of each element must be in the range [0, 1]. The leftmost and topmost positions of the image correspond to 0, 680 * and the rightmost and bottom positions correspond to 1. In the array, the third element must be greater than the first element, 681 * and the fourth element must be greater than the second element. 682 * @returns { Promise<ColorPicker> } - Promise used to return the ColorPicker instance created. 683 * @throws { BusinessError } 401 - Input parameter error. 684 * @syscap SystemCapability.Multimedia.Image.Core 685 * @crossplatform 686 * @form 687 * @atomicservice 688 * @since 14 689 */ 690 function createColorPicker(source: image.PixelMap, region: Array<number>): Promise<ColorPicker>; 691 692 /** 693 * Create a color picker to get color of an image. 694 * @param { image.PixelMap } source - the source pixelmap. 695 * @param { AsyncCallback<ColorPicker> } callback - the callback of createColorPicker. 696 * @throws { BusinessError } 401 - Input parameter error. 697 * @syscap SystemCapability.Multimedia.Image.Core 698 * @since 9 699 */ 700 /** 701 * Create a color picker to get color of an image. 702 * @param { image.PixelMap } source - the source pixelmap. 703 * @param { AsyncCallback<ColorPicker> } callback - the callback of createColorPicker. 704 * @throws { BusinessError } 401 - Input parameter error. 705 * @syscap SystemCapability.Multimedia.Image.Core 706 * @form 707 * @atomicservice 708 * @since 12 709 */ 710 /** 711 * Creates a ColorPicker instance based on a pixel map. This API uses an asynchronous callback to return the result. 712 * @param { image.PixelMap } source - PixelMap instance created by the image module. An instance can be obtained by 713 * decoding an image or directly created. For details, see Image Overview. 714 * @param { AsyncCallback<ColorPicker> } callback - the callback of createColorPicker. 715 * @throws { BusinessError } 401 - Input parameter error. 716 * @syscap SystemCapability.Multimedia.Image.Core 717 * @crossplatform 718 * @form 719 * @atomicservice 720 * @since 14 721 */ 722 function createColorPicker(source: image.PixelMap, callback: AsyncCallback<ColorPicker>): void; 723 724 /** 725 * Create a color picker to get color of an image. 726 * @param { image.PixelMap } source - the source pixelmap. 727 * @param { Array<number> } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, 728 * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. 729 * @param { AsyncCallback<ColorPicker> } callback - the callback of createColorPicker. 730 * @throws { BusinessError } 401 - Input parameter error. 731 * @syscap SystemCapability.Multimedia.Image.Core 732 * @since 10 733 */ 734 /** 735 * Create a color picker to get color of an image. 736 * @param { image.PixelMap } source - the source pixelmap. 737 * @param { Array<number> } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, 738 * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. 739 * @param { AsyncCallback<ColorPicker> } callback - the callback of createColorPicker. 740 * @throws { BusinessError } 401 - Input parameter error. 741 * @syscap SystemCapability.Multimedia.Image.Core 742 * @form 743 * @atomicservice 744 * @since 12 745 */ 746 /** 747 * Creates a ColorPicker instance for the selected region based on a pixel map. This API uses an asynchronous callback to return the result. 748 * @param { image.PixelMap } source - PixelMap instance created by the image module. An instance can be obtained by decoding an 749 * image or directly created. For details, see Image Overview.PixelMap instance created by the image module. An instance can be 750 * obtained by decoding an image or directly created. For details, see Image Overview. 751 * @param { Array<number> } region - Region of the image from which the color is picked. 752 * The array consists of four elements, representing the left, top, right, and bottom positions of the image, respectively. 753 * The value of each element must be in the range [0, 1]. The leftmost and topmost positions of the image correspond to 0, 754 * and the rightmost and bottom positions correspond to 1. In the array, the third element must be greater than the first element, 755 * and the fourth element must be greater than the second element. 756 * @param { AsyncCallback<ColorPicker> } callback - Callback used to return the ColorPicker instance created. 757 * @throws { BusinessError } 401 - Input parameter error. 758 * @syscap SystemCapability.Multimedia.Image.Core 759 * @crossplatform 760 * @form 761 * @atomicservice 762 * @since 14 763 */ 764 function createColorPicker(source: image.PixelMap, region: Array<number>, callback: AsyncCallback<ColorPicker>): void; 765 766 /** 767 * Enumerates the tile modes of the shader effect. 768 * 769 * @enum { number } 770 * @syscap SystemCapability.Multimedia.Image.Core 771 * @since 14 772 */ 773 enum TileMode { 774 /** 775 * Replicates the edge color if the shader effect draws outside of its original boundary. 776 * 777 * @syscap SystemCapability.Multimedia.Image.Core 778 * @since 14 779 */ 780 CLAMP = 0, 781 782 /** 783 * Repeats the shader effect in both horizontal and vertical directions. 784 * 785 * @syscap SystemCapability.Multimedia.Image.Core 786 * @since 14 787 */ 788 REPEAT = 1, 789 790 /** 791 * Repeats the shader effect in both horizontal and vertical directions, alternating mirror images. 792 * 793 * @syscap SystemCapability.Multimedia.Image.Core 794 * @since 14 795 */ 796 MIRROR = 2, 797 798 /** 799 * Renders the shader effect only within the original boundary. 800 * 801 * @syscap SystemCapability.Multimedia.Image.Core 802 * @since 14 803 */ 804 DECAL = 3, 805 } 806} 807 808export default effectKit; 809