import { Base64Resource, DrawableResource, Group, Panel, jsx, Color, layoutConfig, Image, RemoteResource, MainBundleResource, Scroller, VLayout, Text, Gravity, resourceLoader, imageDecoder, createRef, loge, } from "doric"; import { colors, label } from "./utils"; import { img_base64 } from "./image_base64"; @Entry export class ResourceDemo extends Panel { build(root: Group): void { const iv = createRef(); Image Demo {label("Button")} { const resource = new RemoteResource( "https://p.upyun.com/demo/webp/webp/jpg-0.webp" ); const rawData = await resourceLoader(context).load(resource); loge(rawData.byteLength); const imageInfo = await imageDecoder(context).getImageInfo( resource ); loge(imageInfo); const pixels = await imageDecoder(context).decodeToPixels(resource); const unit8Array = new Uint8Array(pixels); for (let i = 0; i < unit8Array.length; i += 4) { unit8Array[i] -= 20; } loge(pixels.byteLength); iv.current.image = resource; }} /> ; } }