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

21
doric-js/index.d.ts vendored
View File

@@ -626,6 +626,14 @@ declare module 'doric/lib/src/widget/image' {
ScaleAspectFill = 2
}
export class Image extends View {
/**
* Set pixels for image directly
*/
imagePixels?: {
width: number;
height: number;
pixels: ArrayBuffer;
};
/**
* This could be loaded by customized resource loader
*/
@@ -699,6 +707,12 @@ declare module 'doric/lib/src/widget/image' {
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 function image(config: Partial<Image>): Image;
}
@@ -1751,7 +1765,14 @@ declare module 'doric/lib/src/util/resource' {
constructor(bundleName: string, fileName: string);
}
export class ArrayBufferResource extends Resource {
data: ArrayBuffer;
constructor(data: ArrayBuffer);
toModel(): {
data: ArrayBuffer;
resId: string;
type: string;
identifier: string;
};
}
}