From e6c468bd21c967f35006dcc3de7dc61f9a76140b Mon Sep 17 00:00:00 2001 From: zgf Date: Wed, 10 Jul 2024 11:11:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=94=B9=E4=B8=BA=E4=BB=85=E6=94=AF=E6=8C=81=E4=B8=BB?= =?UTF-8?q?=E5=9B=BE=E5=92=8C=E4=BF=AE=E6=94=B9requestInSteam=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zgf --- CHANGELOG.md | 2 ++ library/src/main/ets/ImageKnifeDispatcher.ets | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d1df1..c2583ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 3.0.0-rc.10 - 修复图形变换的闪退问题 +- 自定义下载customGetImage改为仅主图支持 +- 修改网络请求requestInStream配置 ## 3.0.0-rc.9 - 修复Resource类型$r(变量无法)加载 diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index 279706d..5cde439 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -383,7 +383,7 @@ async function requestJob(request: RequestJobRequest, requestList?: List { arrayBuffers.push(data) }); @@ -451,6 +443,15 @@ async function requestJob(request: RequestJobRequest, requestList?: List { if (data == 200) { From 348962e4c9946d7a1ab828e9525ed4945abc6a66 Mon Sep 17 00:00:00 2001 From: zgf Date: Fri, 12 Jul 2024 15:07:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=94=B9=E4=B8=BA=E4=BB=85=E6=94=AF=E6=8C=81=E4=B8=BB?= =?UTF-8?q?=E5=9B=BE=E5=92=8C=E4=BF=AE=E6=94=B9requestInSteam=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E3=80=81=E6=96=B0=E5=A2=9EColorFilter=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zgf --- CHANGELOG.md | 5 +++-- entry/src/main/ets/pages/SingleImage.ets | 9 ++++++++- library/oh-package.json5 | 2 +- library/src/main/ets/ImageKnifeDispatcher.ets | 2 +- library/src/main/ets/ImageKnifeOption.ets | 2 +- library/src/main/ets/components/ImageKnifeComponent.ets | 1 + 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2583ed..391ba62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ -## 3.0.0-rc.10 +## 3.0.0 - 修复图形变换的闪退问题 - 自定义下载customGetImage改为仅主图支持 -- 修改网络请求requestInStream配置 +- 修改网络请求requestInStream配置优先返回arraybuffer +- 新增ColorFilter属性 ## 3.0.0-rc.9 - 修复Resource类型$r(变量无法)加载 diff --git a/entry/src/main/ets/pages/SingleImage.ets b/entry/src/main/ets/pages/SingleImage.ets index 27fc019..5552cb7 100644 --- a/entry/src/main/ets/pages/SingleImage.ets +++ b/entry/src/main/ets/pages/SingleImage.ets @@ -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) diff --git a/library/oh-package.json5 b/library/oh-package.json5 index 653da3d..1975b91 100644 --- a/library/oh-package.json5 +++ b/library/oh-package.json5 @@ -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" }, diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index 5cde439..db17a57 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -449,7 +449,7 @@ async function requestJob(request: RequestJobRequest, requestList?: List void - + drawingColorFilter?:ColorFilter constructor() { } diff --git a/library/src/main/ets/components/ImageKnifeComponent.ets b/library/src/main/ets/components/ImageKnifeComponent.ets index 88467e7..57e7432 100644 --- a/library/src/main/ets/components/ImageKnifeComponent.ets +++ b/library/src/main/ets/components/ImageKnifeComponent.ets @@ -77,6 +77,7 @@ export struct ImageKnifeComponent { build() { Image(this.pixelMap) + .colorFilter(this.imageKnifeOption.drawingColorFilter) .objectFit(this.objectFit) .width(this.adaptiveWidth) .height(this.adaptiveHeight)