feat:Image add pixel API,pass pixels directly to Image
This commit is contained in:
@@ -2248,10 +2248,20 @@ var BundleResource = /** @class */ (function (_super) {
|
||||
=======
|
||||
}(Resource));
|
||||
var ArrayBufferResource = /** @class */ (function (_super) {
|
||||
__extends$e(ArrayBufferResource, _super);
|
||||
__extends$f(ArrayBufferResource, _super);
|
||||
function ArrayBufferResource(data) {
|
||||
return _super.call(this, "arrayBuffer", "") || this;
|
||||
var _this = _super.call(this, "arrayBuffer", "") || this;
|
||||
_this.data = data;
|
||||
return _this;
|
||||
}
|
||||
ArrayBufferResource.prototype.toModel = function () {
|
||||
return {
|
||||
data: this.data,
|
||||
resId: this.resId,
|
||||
type: this.type,
|
||||
identifier: this.identifier,
|
||||
};
|
||||
};
|
||||
return ArrayBufferResource;
|
||||
}(Resource));
|
||||
>>>>>>> f476a5b0... feat:android support ArrayBuffer Resource
|
||||
@@ -2300,6 +2310,16 @@ var Image = /** @class */ (function (_super) {
|
||||
Image.prototype.stopAnimating = function (context) {
|
||||
return this.nativeChannel(context, "stopAnimating")();
|
||||
};
|
||||
Image.prototype.getImageInfo = function (context) {
|
||||
return this.nativeChannel(context, "getImageInfo")();
|
||||
};
|
||||
Image.prototype.getImagePixels = function (context) {
|
||||
return this.nativeChannel(context, "getImagePixels")();
|
||||
};
|
||||
__decorate$b([
|
||||
Property,
|
||||
__metadata$b("design:type", Object)
|
||||
], Image.prototype, "imagePixels", void 0);
|
||||
__decorate$b([
|
||||
Property,
|
||||
__metadata$b("design:type", Resource)
|
||||
|
@@ -1683,6 +1683,15 @@ class BundleResource extends iOSResource {
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1711,7 +1720,17 @@ 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$b([
|
||||
Property,
|
||||
__metadata$b("design:type", Object)
|
||||
], Image.prototype, "imagePixels", void 0);
|
||||
__decorate$b([
|
||||
Property,
|
||||
__metadata$b("design:type", Resource)
|
||||
|
@@ -3211,6 +3211,15 @@ class BundleResource extends iOSResource {
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3239,7 +3248,17 @@ 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$b([
|
||||
Property,
|
||||
__metadata$b("design:type", Object)
|
||||
], Image.prototype, "imagePixels", void 0);
|
||||
__decorate$b([
|
||||
Property,
|
||||
__metadata$b("design:type", Resource)
|
||||
|
21
doric-js/index.d.ts
vendored
21
doric-js/index.d.ts
vendored
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
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)
|
||||
|
@@ -85,8 +85,17 @@ export class BundleResource extends iOSResource {
|
||||
}
|
||||
|
||||
export class ArrayBufferResource extends Resource {
|
||||
data: ArrayBuffer
|
||||
constructor(data: ArrayBuffer) {
|
||||
super("arrayBuffer", "")
|
||||
this.data = data
|
||||
}
|
||||
toModel() {
|
||||
return {
|
||||
data: this.data,
|
||||
resId: this.resId,
|
||||
type: this.type,
|
||||
identifier: this.identifier,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -26,6 +26,11 @@ export enum ScaleType {
|
||||
}
|
||||
|
||||
export class Image extends View {
|
||||
/**
|
||||
* Set pixels for image directly
|
||||
*/
|
||||
@Property
|
||||
imagePixels?: { width: number, height: number, pixels: ArrayBuffer }
|
||||
/**
|
||||
* This could be loaded by customized resource loader
|
||||
*/
|
||||
@@ -132,6 +137,18 @@ export class Image extends View {
|
||||
stopAnimating(context: BridgeContext) {
|
||||
return this.nativeChannel(context, "stopAnimating")()
|
||||
}
|
||||
|
||||
getImageInfo(context: BridgeContext): Promise<{
|
||||
width: number,
|
||||
height: number,
|
||||
mimeType: string,
|
||||
}> {
|
||||
return this.nativeChannel(context, "getImageInfo")()
|
||||
}
|
||||
|
||||
getImagePixels(context: BridgeContext): Promise<ArrayBuffer> {
|
||||
return this.nativeChannel(context, "getImagePixels")()
|
||||
}
|
||||
}
|
||||
|
||||
export function image(config: Partial<Image>) {
|
||||
|
Reference in New Issue
Block a user