feat:Image add pixel API,pass pixels directly to Image

This commit is contained in:
pengfei.zhou
2021-11-19 14:30:24 +08:00
committed by osborn
parent 62cb618923
commit 190eb4afd7
16 changed files with 378 additions and 161 deletions

View File

@@ -8,6 +8,14 @@ export declare enum ScaleType {
ScaleAspectFill = 2
}
export declare class Image extends View {
/**
* Set pixels for image directly
*/
imagePixels?: {
width: number;
height: number;
pixels: ArrayBuffer;
};
/**
* This could be loaded by customized resource loader
*/
@@ -81,5 +89,11 @@ export declare class Image extends View {
isAnimating(context: BridgeContext): Promise<boolean>;
startAnimating(context: BridgeContext): Promise<any>;
stopAnimating(context: BridgeContext): Promise<any>;
getImageInfo(context: BridgeContext): Promise<{
width: number;
height: number;
mimeType: string;
}>;
getImagePixels(context: BridgeContext): Promise<ArrayBuffer>;
}
export declare function image(config: Partial<Image>): Image;

View File

@@ -42,7 +42,17 @@ export class Image extends View {
stopAnimating(context) {
return this.nativeChannel(context, "stopAnimating")();
}
getImageInfo(context) {
return this.nativeChannel(context, "getImageInfo")();
}
getImagePixels(context) {
return this.nativeChannel(context, "getImagePixels")();
}
}
__decorate([
Property,
__metadata("design:type", Object)
], Image.prototype, "imagePixels", void 0);
__decorate([
Property,
__metadata("design:type", Resource)