更新说明:

- 补充单个图片测试demo

Signed-off-by: 明月清风 <qiufeihu1@h-partners.com>
This commit is contained in:
明月清风 2024-05-08 18:14:09 +08:00
parent 7030f5f55a
commit dc96ec43b4
1 changed files with 5 additions and 4 deletions

View File

@ -29,8 +29,9 @@ struct SingleImage {
fs.writeSync(file.fd, icon.buffer); fs.writeSync(file.fd, icon.buffer);
fs.fsyncSync(file.fd); fs.fsyncSync(file.fd);
fs.closeSync(file); fs.closeSync(file);
getContext().resourceManager.getMediaContentSync( $r("app.media.aaa")) this.changePic(getContext().resourceManager.getMediaContentSync( $r("app.media.aaa"))
.buffer as ArrayBuffer; .buffer as ArrayBuffer);
} }
@ -84,12 +85,12 @@ struct SingleImage {
transformation: new BlurTransformation(10) transformation: new BlurTransformation(10)
} }
}).width(100).height(100) }).width(100).height(100)
Text("自定义下载") Text("pixelMap加载图片")
.fontSize(30) .fontSize(30)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
ImageKnifeComponent({ ImageKnifeComponent({
imageKnifeOption: { imageKnifeOption: {
loadSrc: this.pixelMap, loadSrc: this.pixelMap!,
placeholderSrc: $r("app.media.loading"), placeholderSrc: $r("app.media.loading"),
errorholderSrc: $r("app.media.app_icon"), errorholderSrc: $r("app.media.app_icon"),
objectFit: ImageFit.Contain, objectFit: ImageFit.Contain,