This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-js/lib/src/widget/image.d.ts

68 lines
1.6 KiB
TypeScript
Raw Normal View History

import { View } from "../ui/view";
import { Color } from "../util/color";
2020-01-03 14:44:51 +08:00
export declare enum ScaleType {
ScaleToFill = 0,
ScaleAspectFit = 1,
ScaleAspectFill = 2
}
export declare class Image extends View {
2020-01-03 14:44:51 +08:00
imageUrl?: string;
/**
* 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;
/**
* Display while image is loading
* Local file name
*/
placeHolderImage?: string;
placeHolderImageBase64?: string;
/**
* 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;
errorImageBase64?: string;
/**
* 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
}
export declare function image(config: Partial<Image>): Image;