• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 {CommonMethod, Color, ImageRepeat, ImageFit, Resource, PixelMap} from "./common";
17
18export declare enum ImageRenderMode {
19  Original,
20  Template
21}
22
23export declare enum ImageInterpolation {
24  None,
25  Low,
26  Medium,
27  High
28}
29
30export declare class ImageExtend<T> extends ImageAttribute<T> {
31}
32
33interface Image extends ImageAttribute<Image> {
34  (src: string | PixelMap | Resource): Image;
35}
36
37declare class ImageAttribute<T> extends CommonMethod<T> {
38  alt(value: string | Resource): T;
39
40  matchTextDirection(value: boolean): T;
41
42  fitOriginalSize(value: boolean): T;
43
44  fillColor(value: Color | number | string | Resource): T;
45
46  objectFit(value: ImageFit): T;
47
48  objectRepeat(value: ImageRepeat): T;
49
50  autoResize(value: boolean): T;
51
52  renderMode(value: ImageRenderMode): T;
53
54  interpolation(value: ImageInterpolation): T;
55
56  sourceSize(value: { width: number, height: number }): T;
57
58  onComplete(callback: (event?: { width: number, height: number, componentWidth: number, componentHeight: number, loadingStatus: number }) => void): T;
59
60  onError(callback: (event?: { componentWidth: number, componentHeight: number }) => void): T;
61
62  onFinish(event: () => void): T;
63}
64
65export declare const ImageInterface: Image;
66