feat:Image add pixel API,pass pixels directly to Image
This commit is contained in:
7
doric-js/lib/src/util/resource.d.ts
vendored
7
doric-js/lib/src/util/resource.d.ts
vendored
@@ -51,5 +51,12 @@ export declare class BundleResource extends iOSResource {
|
||||
constructor(bundleName: string, fileName: string);
|
||||
}
|
||||
export declare class ArrayBufferResource extends Resource {
|
||||
data: ArrayBuffer;
|
||||
constructor(data: ArrayBuffer);
|
||||
toModel(): {
|
||||
data: ArrayBuffer;
|
||||
resId: string;
|
||||
type: string;
|
||||
identifier: string;
|
||||
};
|
||||
}
|
||||
|
@@ -74,5 +74,14 @@ export class BundleResource extends iOSResource {
|
||||
export class ArrayBufferResource extends Resource {
|
||||
constructor(data) {
|
||||
super("arrayBuffer", "");
|
||||
this.data = data;
|
||||
}
|
||||
toModel() {
|
||||
return {
|
||||
data: this.data,
|
||||
resId: this.resId,
|
||||
type: this.type,
|
||||
identifier: this.identifier,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
14
doric-js/lib/src/widget/image.d.ts
vendored
14
doric-js/lib/src/widget/image.d.ts
vendored
@@ -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;
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user