1 | import { View } from '../core/view';
|
2 | import { Style } from '../styling/style';
|
3 | import { ImageSource } from '../../image-source';
|
4 | import { ImageAsset } from '../../image-asset';
|
5 | import { Color } from '../../color';
|
6 | import { Property, InheritedCssProperty } from '../core/properties';
|
7 | import { CoreTypes } from '../../core-types';
|
8 |
|
9 | /**
|
10 | * Represents a class that provides functionality for loading and streching image(s).
|
11 | */
|
12 | export class Image extends View {
|
13 | /**
|
14 | * Gets the native [android widget](http://developer.android.com/reference/android/widget/ImageView.html) that represents the user interface for this component. Valid only when running on Android OS.
|
15 | */
|
16 | android: any /* android.widget.ImageView */;
|
17 |
|
18 | /**
|
19 | * Gets the native iOS [UIImageView](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImageView_Class/) that represents the user interface for this component. Valid only when running on iOS.
|
20 | */
|
21 | ios: any /* UIImageView */;
|
22 |
|
23 | /**
|
24 | * Gets or sets the image source of the image.
|
25 | */
|
26 | imageSource: ImageSource;
|
27 |
|
28 | /**
|
29 | * Gets or sets the source of the Image. This can be either an URL string or a native image instance.
|
30 | */
|
31 | src: string | ImageSource | ImageAsset;
|
32 |
|
33 | /**
|
34 | * Gets a value indicating if the image is currently loading.
|
35 | */
|
36 | readonly isLoading: boolean;
|
37 |
|
38 | /**
|
39 | * Gets or sets the image stretch mode.
|
40 | */
|
41 | stretch: CoreTypes.ImageStretchType;
|
42 |
|
43 | /**
|
44 | * Gets or sets the loading strategy for images on the local file system:
|
45 | * - **sync** - blocks the UI if necessary to display immediately, good for small icons.
|
46 | * - **async** *(default)* - will load in the background, may appear with short delay, good for large images.
|
47 | * When loading images from web they are always loaded **async** no matter of loadMode value.
|
48 | */
|
49 | loadMode: 'sync' | 'async';
|
50 |
|
51 | /**
|
52 | * A color used to tint template images.
|
53 | */
|
54 | tintColor: Color;
|
55 |
|
56 | /**
|
57 | * Gets or sets the desired decode height of the image.
|
58 | * This property is Android specific.
|
59 | */
|
60 | decodeHeight: CoreTypes.LengthType;
|
61 |
|
62 | /**
|
63 | * Gets or sets the desired decode width of the image.
|
64 | * This property is Android specific.
|
65 | */
|
66 | decodeWidth: CoreTypes.LengthType;
|
67 | }
|
68 |
|
69 | export const imageSourceProperty: Property<Image, ImageSource>;
|
70 | export const srcProperty: Property<Image, string | ImageSource | ImageAsset>;
|
71 | export const isLoadingProperty: Property<Image, string>;
|
72 | export const loadMode: Property<Image, 'sync' | 'async'>;
|
73 | export const stretchProperty: Property<Image, CoreTypes.ImageStretchType>;
|
74 | export const tintColorProperty: InheritedCssProperty<Style, Color>;
|
75 | export const decodeHeightProperty: Property<Image, CoreTypes.LengthType>;
|
76 | export const decodeWidthProperty: Property<Image, CoreTypes.LengthType>;
|