使用imageknife框架进行网络图片的加载和渲染 使用ImageKnifeComponent组件替代原生的Image组件,并配合使用ImageKnifeOption进行图片的加载监听网络图片的加载回调,获取到网络图片的PixelMap类型的数据使用系统的effectKit框架,支持从PixelMap对象中,获取平均色/主题色等/// 视图组件 ImageKnifeComponent({ imageKnifeOption: this.imageKnifeOption }) .size({ width: 38, height: 38 }) /// 配置图片组件加载回调 this.imageKnifeOption.onLoadListener = { onLoadSuccess: (data) => { const pixelMap = data as PixelMap effectKit.createColorPicker(pixelMap, (error, colorPicker) => { if (!error) { /// 获得主题色/平均色 const color = colorPicker.getAverageColor() } }) } }
imageknife
框架进行网络图片的加载和渲染使用
ImageKnifeComponent
组件替代原生的Image
组件,并配合使用ImageKnifeOption
进行图片的加载PixelMap
类型的数据使用系统的
effectKit
框架,支持从PixelMap
对象中,获取平均色/主题色等