2020-04-16 19:21:24 +08:00
|
|
|
import { View } from "../ui/view";
|
2020-03-05 11:01:10 +08:00
|
|
|
import { Color } from "../util/color";
|
2020-01-03 14:44:51 +08:00
|
|
|
export declare enum ScaleType {
|
|
|
|
ScaleToFill = 0,
|
|
|
|
ScaleAspectFit = 1,
|
|
|
|
ScaleAspectFill = 2
|
|
|
|
}
|
2020-04-16 19:21:24 +08:00
|
|
|
export declare class Image extends View {
|
2020-01-03 14:44:51 +08:00
|
|
|
imageUrl?: string;
|
2020-03-12 19:56:47 +08:00
|
|
|
/**
|
|
|
|
* Read image from local path
|
|
|
|
* For android,it based on assets dir.
|
|
|
|
* For iOS,it based on main bundle dir.
|
|
|
|
*/
|
|
|
|
imagePath?: string;
|
|
|
|
/**
|
|
|
|
* Read image from resource
|
|
|
|
* For android,it will try to read from drawable.
|
|
|
|
* For iOS,it will try to read from Image.Assets.
|
|
|
|
*/
|
|
|
|
imageRes?: string;
|
2020-01-03 14:44:51 +08:00
|
|
|
imageBase64?: string;
|
|
|
|
scaleType?: ScaleType;
|
|
|
|
isBlur?: boolean;
|
2020-03-05 11:01:10 +08:00
|
|
|
/**
|
|
|
|
* Display while image is loading
|
|
|
|
* Local file name
|
|
|
|
*/
|
|
|
|
placeHolderImage?: string;
|
2020-05-11 11:18:30 +08:00
|
|
|
placeHolderImageBase64?: string;
|
2020-03-05 11:01:10 +08:00
|
|
|
/**
|
|
|
|
* Display while image is loading
|
|
|
|
* Color
|
|
|
|
* This priority is lower than placeHolderImage
|
|
|
|
*/
|
|
|
|
placeHolderColor?: Color;
|
|
|
|
/**
|
|
|
|
* Display while image is failed to load
|
|
|
|
* It can be file name in local path
|
|
|
|
*/
|
|
|
|
errorImage?: string;
|
2020-05-11 11:18:30 +08:00
|
|
|
errorImageBase64?: string;
|
2020-03-05 11:01:10 +08:00
|
|
|
/**
|
|
|
|
* Display while image is failed to load
|
|
|
|
* Color
|
|
|
|
* This priority is lower than errorImage
|
|
|
|
*/
|
|
|
|
errorColor?: Color;
|
2020-01-03 14:44:51 +08:00
|
|
|
loadCallback?: (image: {
|
|
|
|
width: number;
|
|
|
|
height: number;
|
|
|
|
} | undefined) => void;
|
2020-04-23 16:14:34 +08:00
|
|
|
/**
|
|
|
|
* Default is Environment.screenScale.
|
|
|
|
*/
|
|
|
|
imageScale?: number;
|
|
|
|
/**
|
|
|
|
* Unit in pixel
|
|
|
|
*/
|
2020-04-16 17:14:56 +08:00
|
|
|
stretchInset?: {
|
|
|
|
left: number;
|
|
|
|
top: number;
|
|
|
|
right: number;
|
|
|
|
bottom: number;
|
|
|
|
};
|
2020-01-03 14:44:51 +08:00
|
|
|
}
|
2020-04-16 19:21:24 +08:00
|
|
|
export declare function image(config: Partial<Image>): Image;
|