feat: Image add setImagePixels API,iOS receive ArrayBuffer directly
This commit is contained in:
		
							
								
								
									
										8
									
								
								doric-js/lib/src/widget/image.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								doric-js/lib/src/widget/image.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,4 @@ | ||||
| import { View, NativeViewModel } from "../ui/view"; | ||||
| import { View } from "../ui/view"; | ||||
| import { Color } from "../util/color"; | ||||
| import { BridgeContext } from "../runtime/global"; | ||||
| import { Resource } from "../util/resource"; | ||||
| @@ -95,6 +95,10 @@ export declare class Image extends View { | ||||
|         mimeType: string; | ||||
|     }>; | ||||
|     getImagePixels(context: BridgeContext): Promise<ArrayBuffer>; | ||||
|     toModel(): NativeViewModel; | ||||
|     setImagePixels(context: BridgeContext, image: { | ||||
|         width: number; | ||||
|         height: number; | ||||
|         pixels: ArrayBuffer; | ||||
|     }): Promise<void>; | ||||
| } | ||||
| export declare function image(config: Partial<Image>): Image; | ||||
|   | ||||
| @@ -48,14 +48,8 @@ export class Image extends View { | ||||
|     getImagePixels(context) { | ||||
|         return this.nativeChannel(context, "getImagePixels")(); | ||||
|     } | ||||
|     toModel() { | ||||
|         const ret = super.toModel(); | ||||
|         if (Reflect.has(ret.props, "imagePixels")) { | ||||
|             const imagePixels = Reflect.get(ret.props, "imagePixels"); | ||||
|             const pixels = imagePixels.pixels; | ||||
|             imagePixels.pixels = this.callback2Id(() => pixels); | ||||
|         } | ||||
|         return ret; | ||||
|     setImagePixels(context, image) { | ||||
|         return this.nativeChannel(context, "setImagePixels")(image); | ||||
|     } | ||||
| } | ||||
| __decorate([ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user