!427 修复无法解析其他module的Resource格式图片

Merge pull request !427 from zgf/master
This commit is contained in:
openharmony_ci 2024-11-12 09:44:47 +00:00 committed by Gitee
commit 30c327747b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 39 additions and 3 deletions

View File

@ -1,6 +1,7 @@
## 3.2.0 ## 3.2.0
- Fix bug: PixelMap size exceeds the maximum value of memory cache and is not cached - Fix bug: PixelMap size exceeds the maximum value of memory cache and is not cached
- Dealing with exception scenarios where imageSource.getImageInfo return undefined - Dealing with exception scenarios where imageSource.getImageInfo return undefined
- Fix inability to parse Resource format images of other modules
## 3.2.0-rc.2 ## 3.2.0-rc.2
- Added callback information for image loading - Added callback information for image loading
@ -20,6 +21,33 @@
- Fixed bug for receive only the first onLoadStart for concurrent identical requests - Fixed bug for receive only the first onLoadStart for concurrent identical requests
- Modify the condition for determining whether to queue to be greater than or equal to maxRequests - Modify the condition for determining whether to queue to be greater than or equal to maxRequests
## 3.1.1-rc.1
- Photo reduction sampling
## 3.1.1-rc.0
- 重构代码抽取ImageKnifeDispatcher子线程requestJob相关代码到ImageKnifeLoader中降低函数复杂度
## 3.1.0
- 部分静态webp图片有delay属性导致识别成动图,改用getFrameCount识别
- 修复加载错误图后未去请求排队队列中的请求
- 子线程本地Resource参数类型转换成number
- 修改使用hilog记录日志默认打开debug级别的日志
- file格式图片fd同步close
- 解码pixelMap默认不可编辑图形变化可编辑
- 修改网络请求超时设置
## 3.1.0-rc.2
- 修复宽高不等svg图片显示有毛边
## 3.1.0-rc.1
- ImageKnifeAnimatorComponent新增开始、结束、暂停的回调事件
- 文件缓存数量负数和超过INT最大值时默认为INT最大值
## 3.1.0-rc.0
- ComponentV2装饰器适配
- imageKnifeOption={...}用法改为new ImageKnifeOption({...})
- animatorOption={...}用法改为new AnimatorOption({...})
## 3.0.3 ## 3.0.3
- Released version 3.0.3 - Released version 3.0.3

View File

@ -47,7 +47,7 @@ struct SingleImage {
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
ImageKnifeComponent({ ImageKnifeComponent({
imageKnifeOption: { imageKnifeOption: {
loadSrc: $r('app.media.svgSample'), loadSrc: $r(this.resource),
placeholderSrc: $r('app.media.loading'), placeholderSrc: $r('app.media.loading'),
errorholderSrc: $r('app.media.failed'), errorholderSrc: $r('app.media.failed'),
objectFit: ImageFit.Contain objectFit: ImageFit.Contain
@ -56,6 +56,14 @@ struct SingleImage {
.onClick(()=>{ .onClick(()=>{
this.DrawingColorFilter = drawing.ColorFilter.createBlendModeColorFilter(this.color, drawing.BlendMode.SRC_IN); this.DrawingColorFilter = drawing.ColorFilter.createBlendModeColorFilter(this.color, drawing.BlendMode.SRC_IN);
}) })
ImageKnifeComponent({
imageKnifeOption: {
loadSrc: $r('[sharedlibrary].media.pngSample'),
placeholderSrc: $r('app.media.loading'),
errorholderSrc: $r('app.media.failed'),
objectFit: ImageFit.Contain
}
}).width(100).height(100)
Text($r('app.string.Under_context_file')) Text($r('app.string.Under_context_file'))
.fontSize(30) .fontSize(30)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)

View File

@ -555,14 +555,14 @@ export class ImageKnifeLoader {
if (resBuf == undefined && request.onlyRetrieveFromCache != true && request.requestSource == ImageKnifeRequestSource.SRC) { if (resBuf == undefined && request.onlyRetrieveFromCache != true && request.requestSource == ImageKnifeRequestSource.SRC) {
if(request.src == -1) { if(request.src == -1) {
let resName = request.resName as string let resName = request.resName as string
resBuf = (await manager.getMediaByName(resName.substring(10))).buffer as ArrayBuffer resBuf = (await manager.getMediaByName(resName.substring(resName.lastIndexOf(".") + 1))).buffer as ArrayBuffer
} else { } else {
resBuf = manager.getMediaContentSync(request.src).buffer as ArrayBuffer resBuf = manager.getMediaContentSync(request.src).buffer as ArrayBuffer
} }
} else if (resBuf == undefined && request.requestSource != ImageKnifeRequestSource.SRC) { } else if (resBuf == undefined && request.requestSource != ImageKnifeRequestSource.SRC) {
if(request.src == -1) { if(request.src == -1) {
let resName = request.resName as string let resName = request.resName as string
resBuf = (await manager.getMediaByName(resName.substring(10))).buffer as ArrayBuffer resBuf = (await manager.getMediaByName(resName.substring(resName.lastIndexOf(".") + 1))).buffer as ArrayBuffer
} else { } else {
resBuf = manager.getMediaContentSync(request.src).buffer as ArrayBuffer resBuf = manager.getMediaContentSync(request.src).buffer as ArrayBuffer
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB