自定义下载改为仅支持主图和修改requestInSteam配置、新增ColorFilter属性
Signed-off-by: zgf <zenggaofeng2@h-partners.com>
This commit is contained in:
parent
e6c468bd21
commit
348962e4c9
|
@ -1,7 +1,8 @@
|
|||
## 3.0.0-rc.10
|
||||
## 3.0.0
|
||||
- 修复图形变换的闪退问题
|
||||
- 自定义下载customGetImage改为仅主图支持
|
||||
- 修改网络请求requestInStream配置
|
||||
- 修改网络请求requestInStream配置优先返回arraybuffer
|
||||
- 新增ColorFilter属性
|
||||
|
||||
## 3.0.0-rc.9
|
||||
- 修复Resource类型$r(变量无法)加载
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
import { ImageKnifeComponent,BlurTransformation } from '@ohos/libraryimageknife';
|
||||
import fs from '@ohos.file.fs';
|
||||
import image from '@ohos.multimedia.image';
|
||||
import { common2D, drawing } from '@kit.ArkGraphics2D';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
|
@ -23,6 +24,8 @@ struct SingleImage {
|
|||
scroller: Scroller = new Scroller;
|
||||
localFile: string = getContext(this).filesDir + "/icon.png"
|
||||
@State pixelMap:PixelMap | undefined = undefined;
|
||||
@State DrawingColorFilter: ColorFilter | undefined = undefined
|
||||
private color: common2D.Color = { alpha: 255, red: 255, green: 0, blue: 0 };
|
||||
aboutToAppear(): void {
|
||||
// 拷贝本地文件
|
||||
let icon: Uint8Array = getContext(this).resourceManager.getMediaContentSync($r("app.media.startIcon"));
|
||||
|
@ -47,9 +50,13 @@ struct SingleImage {
|
|||
loadSrc: $r(this.resource),
|
||||
placeholderSrc: $r("app.media.loading"),
|
||||
errorholderSrc: $r("app.media.failed"),
|
||||
objectFit: ImageFit.Contain
|
||||
objectFit: ImageFit.Contain,
|
||||
drawingColorFilter:this.DrawingColorFilter
|
||||
}
|
||||
}).width(100).height(100)
|
||||
.onClick(()=>{
|
||||
this.DrawingColorFilter = drawing.ColorFilter.createBlendModeColorFilter(this.color, drawing.BlendMode.SRC_IN);
|
||||
})
|
||||
Text("本地context files下文件")
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"main": "index.ets",
|
||||
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
||||
"type": "module",
|
||||
"version": "3.0.0-rc.10",
|
||||
"version": "3.0.0",
|
||||
"dependencies": {
|
||||
"@ohos/gpu_transform": "^1.0.2"
|
||||
},
|
||||
|
|
|
@ -449,7 +449,7 @@ async function requestJob(request: RequestJobRequest, requestList?: List<ImageKn
|
|||
expectDataType: http.HttpDataType.ARRAY_BUFFER,
|
||||
connectTimeout: 6000,
|
||||
readTimeout: 6000,
|
||||
usingProtocol:http.HttpProtocol.HTTP1_1
|
||||
// usingProtocol:http.HttpProtocol.HTTP1_1
|
||||
// header: new Header('application/json')
|
||||
});
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ export class ImageKnifeOption {
|
|||
transformation?: PixelMapTransformation
|
||||
onLoadListener?: OnLoadCallBack | undefined;
|
||||
onComplete?:(event:EventImage | undefined) => void
|
||||
|
||||
drawingColorFilter?:ColorFilter
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ export struct ImageKnifeComponent {
|
|||
|
||||
build() {
|
||||
Image(this.pixelMap)
|
||||
.colorFilter(this.imageKnifeOption.drawingColorFilter)
|
||||
.objectFit(this.objectFit)
|
||||
.width(this.adaptiveWidth)
|
||||
.height(this.adaptiveHeight)
|
||||
|
|
Loading…
Reference in New Issue