diff --git a/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets b/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets index 78fb9bc..448e170 100644 --- a/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets +++ b/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets @@ -286,11 +286,11 @@ struct IndexFunctionDemo { router.pushUrl({ url: "pages/testManyGifLoadWithPage" }); }).margin({ top: 5, left: 3 }) }.width('100%').height(60).backgroundColor(Color.Pink) - Text("测试图片抗锯齿").fontSize(15) + Text('测试图片抗锯齿').fontSize(15) Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Button("测试图片抗锯齿") + Button('测试图片抗锯齿') .onClick(() => { - router.pushUrl({ url: "pages/testImageAntiAliasingWithPage" }); + router.pushUrl({ url: 'pages/testImageAntiAliasingWithPage' }); }).margin({ top: 5, left: 3 }) }.width('100%').height(60).backgroundColor(Color.Pink) } diff --git a/entry/src/main/ets/pages/testImageAntiAliasingWithPage.ets b/entry/src/main/ets/pages/testImageAntiAliasingWithPage.ets index bc9713a..823b7fa 100644 --- a/entry/src/main/ets/pages/testImageAntiAliasingWithPage.ets +++ b/entry/src/main/ets/pages/testImageAntiAliasingWithPage.ets @@ -12,10 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {ImageKnifeComponent} from '@ohos/libraryimageknife' -import {ImageKnifeOption} from '@ohos/libraryimageknife' -import {RotateImageTransformation} from '@ohos/libraryimageknife' -import {RoundedCornersTransformation} from '@ohos/libraryimageknife' +import { ImageKnifeComponent } from '@ohos/libraryimageknife' +import { ImageKnifeOption } from '@ohos/libraryimageknife' +import { RotateImageTransformation } from '@ohos/libraryimageknife' +import { RoundedCornersTransformation } from '@ohos/libraryimageknife' @Entry @Component @@ -23,28 +23,24 @@ struct TestImageAntiAliasingWithPage { @State imageKnifeOption1: ImageKnifeOption = { loadSrc: "https://thirdwx.qlogo.cn/mmopen/xxxxx", - placeholderSrc: $r('app.media.icon_loading'), errorholderSrc: $r('app.media.icon_failed'), }; @State imageKnifeOption: ImageKnifeOption = { loadSrc: "https://hbimg.huabanimg.com/xxxxx", - placeholderSrc: $r('app.media.icon_loading'), errorholderSrc: $r('app.media.icon_failed'), }; @State imageKnifeOption3: ImageKnifeOption = { loadSrc: "https://hbimg.huabanimg.com/xxxxx", - placeholderSrc: $r('app.media.icon_loading'), errorholderSrc: $r('app.media.icon_failed'), }; @State imageKnifeOption4: ImageKnifeOption = { loadSrc: "https://hbimg.huabanimg.com/xxxxx", - placeholderSrc: $r('app.media.icon_loading'), errorholderSrc: $r('app.media.icon_failed'), }; @@ -54,7 +50,9 @@ struct TestImageAntiAliasingWithPage { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { ImageKnifeComponent({ imageKnifeOption: this.imageKnifeOption1 }).width(600).height(600) Image($r('app.media.icon_failed')) - .width(600).height(600).margin(15) + .width(600) + .height(600) + .margin(15) .overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) .interpolation(ImageInterpolation.High) } diff --git a/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets b/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets index 0ac6b28..629800e 100644 --- a/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets +++ b/library/src/main/ets/components/imageknife/ImageKnifeComponent.ets @@ -115,10 +115,9 @@ export struct ImageKnifeComponent { } }) .onReady(() => { - let ctx = this.context - ctx.imageSmoothingEnabled = true - ctx.imageSmoothingQuality = 'high' - + let ctx = this.context; + ctx.imageSmoothingEnabled = true; + ctx.imageSmoothingQuality = 'high'; this.canvasHasReady = true; if (this.onReadyNext) { LogUtil.log('ImageKnifeComponent onReadyNext is running!')