修复宽高不等svg图片显示有毛边

Signed-off-by: zgf <zenggaofeng2@h-partners.com>
This commit is contained in:
zgf 2024-08-19 11:01:32 +08:00
parent fa59e2b9ac
commit 906337cc62
3 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,6 @@
## 3.1.0-rc.2
- 修复宽高不等svg图片显示有毛边
## 3.1.0-rc.1
- ImageKnifeAnimatorComponent新增开始、结束、暂停的回调事件
- 文件缓存数量负数和超过INT最大值时默认为INT最大值

View File

@ -14,7 +14,7 @@
"main": "index.ets",
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
"type": "module",
"version": "3.1.0-rc.1",
"version": "3.1.0-rc.2",
"dependencies": {
"@ohos/gpu_transform": "^1.0.2"
},

View File

@ -626,10 +626,12 @@ async function requestJob(request: RequestJobRequest, requestList?: List<ImageKn
};
}
} else if(typeValue == "svg") {
let size = (await imageSource.getImageInfo()).size
let scale = size.height / size.width
let hValue = Math.round(request.componentHeight);
let wValue = Math.round(request.componentWidth);
let defaultSize: image.Size = {
height: vp2px(hValue),
height: vp2px(wValue) * scale,
width: vp2px(wValue)
};
let opts: image.DecodingOptions = {