feat:Remove Image's setImagePixels API
This commit is contained in:
parent
5b5500b6e0
commit
e9e2d14a9d
@ -606,15 +606,4 @@ public class ImageNode extends ViewNode<ImageView> {
|
|||||||
return new JavaValue();
|
return new JavaValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DoricMethod
|
|
||||||
public void setImagePixels(JSObject prop) {
|
|
||||||
int width = prop.asObject().getProperty("width").asNumber().toInt();
|
|
||||||
int height = prop.asObject().getProperty("height").asNumber().toInt();
|
|
||||||
byte[] pixels = prop.asObject().getProperty("pixels").asArrayBuffer().value();
|
|
||||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
|
||||||
ByteBuffer byteBuffer = ByteBuffer.wrap(pixels);
|
|
||||||
bitmap.copyPixelsFromBuffer(byteBuffer);
|
|
||||||
mView.setImageBitmap(bitmap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2316,14 +2316,6 @@ var Image = /** @class */ (function (_super) {
|
|||||||
Image.prototype.getImagePixels = function (context) {
|
Image.prototype.getImagePixels = function (context) {
|
||||||
return this.nativeChannel(context, "getImagePixels")();
|
return this.nativeChannel(context, "getImagePixels")();
|
||||||
};
|
};
|
||||||
Image.prototype.setImagePixels = function (context, imagePixels) {
|
|
||||||
if (Environment.platform === 'iOS') {
|
|
||||||
imagePixels.pixels = context.function2Id(function () {
|
|
||||||
return imagePixels.pixels;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this.nativeChannel(context, "setImagePixels")(imagePixels);
|
|
||||||
};
|
|
||||||
Image.prototype.toModel = function () {
|
Image.prototype.toModel = function () {
|
||||||
var ret = _super.prototype.toModel.call(this);
|
var ret = _super.prototype.toModel.call(this);
|
||||||
if (Environment.platform === 'iOS') {
|
if (Environment.platform === 'iOS') {
|
||||||
|
@ -1726,14 +1726,6 @@ class Image extends View {
|
|||||||
getImagePixels(context) {
|
getImagePixels(context) {
|
||||||
return this.nativeChannel(context, "getImagePixels")();
|
return this.nativeChannel(context, "getImagePixels")();
|
||||||
}
|
}
|
||||||
setImagePixels(context, imagePixels) {
|
|
||||||
if (Environment.platform === 'iOS') {
|
|
||||||
imagePixels.pixels = context.function2Id(() => {
|
|
||||||
return imagePixels.pixels;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this.nativeChannel(context, "setImagePixels")(imagePixels);
|
|
||||||
}
|
|
||||||
toModel() {
|
toModel() {
|
||||||
const ret = super.toModel();
|
const ret = super.toModel();
|
||||||
if (Environment.platform === 'iOS') {
|
if (Environment.platform === 'iOS') {
|
||||||
|
@ -3254,14 +3254,6 @@ class Image extends View {
|
|||||||
getImagePixels(context) {
|
getImagePixels(context) {
|
||||||
return this.nativeChannel(context, "getImagePixels")();
|
return this.nativeChannel(context, "getImagePixels")();
|
||||||
}
|
}
|
||||||
setImagePixels(context, imagePixels) {
|
|
||||||
if (Environment.platform === 'iOS') {
|
|
||||||
imagePixels.pixels = context.function2Id(() => {
|
|
||||||
return imagePixels.pixels;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this.nativeChannel(context, "setImagePixels")(imagePixels);
|
|
||||||
}
|
|
||||||
toModel() {
|
toModel() {
|
||||||
const ret = super.toModel();
|
const ret = super.toModel();
|
||||||
if (Environment.platform === 'iOS') {
|
if (Environment.platform === 'iOS') {
|
||||||
|
5
doric-js/index.d.ts
vendored
5
doric-js/index.d.ts
vendored
@ -714,11 +714,6 @@ declare module 'doric/lib/src/widget/image' {
|
|||||||
mimeType: string;
|
mimeType: string;
|
||||||
}>;
|
}>;
|
||||||
getImagePixels(context: BridgeContext): Promise<ArrayBuffer>;
|
getImagePixels(context: BridgeContext): Promise<ArrayBuffer>;
|
||||||
setImagePixels(context: BridgeContext, imagePixels: {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
pixels: ArrayBuffer;
|
|
||||||
}): Promise<void>;
|
|
||||||
toModel(): NativeViewModel;
|
toModel(): NativeViewModel;
|
||||||
}
|
}
|
||||||
export function image(config: Partial<Image>): Image;
|
export function image(config: Partial<Image>): Image;
|
||||||
|
5
doric-js/lib/src/widget/image.d.ts
vendored
5
doric-js/lib/src/widget/image.d.ts
vendored
@ -95,11 +95,6 @@ export declare class Image extends View {
|
|||||||
mimeType: string;
|
mimeType: string;
|
||||||
}>;
|
}>;
|
||||||
getImagePixels(context: BridgeContext): Promise<ArrayBuffer>;
|
getImagePixels(context: BridgeContext): Promise<ArrayBuffer>;
|
||||||
setImagePixels(context: BridgeContext, imagePixels: {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
pixels: ArrayBuffer;
|
|
||||||
}): Promise<void>;
|
|
||||||
toModel(): NativeViewModel;
|
toModel(): NativeViewModel;
|
||||||
}
|
}
|
||||||
export declare function image(config: Partial<Image>): Image;
|
export declare function image(config: Partial<Image>): Image;
|
||||||
|
@ -48,14 +48,6 @@ export class Image extends View {
|
|||||||
getImagePixels(context) {
|
getImagePixels(context) {
|
||||||
return this.nativeChannel(context, "getImagePixels")();
|
return this.nativeChannel(context, "getImagePixels")();
|
||||||
}
|
}
|
||||||
setImagePixels(context, imagePixels) {
|
|
||||||
if (Environment.platform === 'iOS') {
|
|
||||||
imagePixels.pixels = context.function2Id(() => {
|
|
||||||
return imagePixels.pixels;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this.nativeChannel(context, "setImagePixels")(imagePixels);
|
|
||||||
}
|
|
||||||
toModel() {
|
toModel() {
|
||||||
const ret = super.toModel();
|
const ret = super.toModel();
|
||||||
if (Environment.platform === 'iOS') {
|
if (Environment.platform === 'iOS') {
|
||||||
|
@ -150,22 +150,6 @@ export class Image extends View {
|
|||||||
return this.nativeChannel(context, "getImagePixels")()
|
return this.nativeChannel(context, "getImagePixels")()
|
||||||
}
|
}
|
||||||
|
|
||||||
setImagePixels(
|
|
||||||
context: BridgeContext,
|
|
||||||
imagePixels: {
|
|
||||||
width: number,
|
|
||||||
height: number,
|
|
||||||
pixels: ArrayBuffer
|
|
||||||
}): Promise<void> {
|
|
||||||
if (Environment.platform === 'iOS') {
|
|
||||||
(imagePixels.pixels as unknown as any) = context.function2Id(() => {
|
|
||||||
return imagePixels.pixels
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return this.nativeChannel(context, "setImagePixels")(imagePixels)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
toModel() {
|
toModel() {
|
||||||
const ret = super.toModel()
|
const ret = super.toModel()
|
||||||
if (Environment.platform === 'iOS') {
|
if (Environment.platform === 'iOS') {
|
||||||
|
8
doric-web/dist/index.js
vendored
8
doric-web/dist/index.js
vendored
@ -3328,14 +3328,6 @@ class Image extends View {
|
|||||||
getImagePixels(context) {
|
getImagePixels(context) {
|
||||||
return this.nativeChannel(context, "getImagePixels")();
|
return this.nativeChannel(context, "getImagePixels")();
|
||||||
}
|
}
|
||||||
setImagePixels(context, imagePixels) {
|
|
||||||
if (Environment.platform === 'iOS') {
|
|
||||||
imagePixels.pixels = context.function2Id(() => {
|
|
||||||
return imagePixels.pixels;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this.nativeChannel(context, "setImagePixels")(imagePixels);
|
|
||||||
}
|
|
||||||
toModel() {
|
toModel() {
|
||||||
const ret = super.toModel();
|
const ret = super.toModel();
|
||||||
if (Environment.platform === 'iOS') {
|
if (Environment.platform === 'iOS') {
|
||||||
|
4
doric-web/dist/index.js.map
vendored
4
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user