diff --git a/OAT.xml b/OAT.xml
index 10e5eb1..2966af2 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -32,6 +32,7 @@
+
diff --git a/entry/src/main/ets/pages/index.ets b/entry/src/main/ets/pages/index.ets
index a36d77a..317c270 100644
--- a/entry/src/main/ets/pages/index.ets
+++ b/entry/src/main/ets/pages/index.ets
@@ -45,6 +45,15 @@ struct IndexFunctionDemo {
headerOption: [this.headerOptions1]
};
+ @State imageKnifeOption3: ImageKnifeOption =
+ {
+ loadSrc: $r('app.media.yunHeic'),
+ placeholderSrc: $r('app.media.icon_loading'),
+ errorholderSrc: $r('app.media.icon_failed'),
+ };
+
+ @State flag: boolean = true;
+
build() {
Scroll() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
@@ -84,6 +93,15 @@ struct IndexFunctionDemo {
router.pushUrl({ url: "pages/imageknifeTestCaseIndex" });
}).margin({ top: 15 })
}.width('100%').height(60).backgroundColor(Color.Pink)
+
+ Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Button("heic图片测试")
+ .onClick(() => {
+ this.flag = !this.flag
+ }).margin({ top: 15 })
+ ImageKnifeComponent({ imageKnifeOption: this.imageKnifeOption3 }).width(300).height(300)
+ .visibility(this.flag ? Visibility.Hidden : Visibility.Visible)
+ }.width('100%').height(60).backgroundColor(Color.Pink)
}
}
.width('100%')
diff --git a/entry/src/main/resources/base/media/yunHeic.heic b/entry/src/main/resources/base/media/yunHeic.heic
new file mode 100644
index 0000000..161e3ca
Binary files /dev/null and b/entry/src/main/resources/base/media/yunHeic.heic differ
diff --git a/library/src/main/ets/components/imageknife/holder/ErrorHolderManager.ets b/library/src/main/ets/components/imageknife/holder/ErrorHolderManager.ets
index 6b460aa..68d3fe6 100644
--- a/library/src/main/ets/components/imageknife/holder/ErrorHolderManager.ets
+++ b/library/src/main/ets/components/imageknife/holder/ErrorHolderManager.ets
@@ -61,6 +61,7 @@ export class ErrorHolderManager {
case SupportFormat.gif:
case SupportFormat.tiff:
case SupportFormat.webp:
+ case SupportFormat.heic:
this.mediaImageProcess(onComplete, onError, arraybuffer, typeValue)
break;
default:
diff --git a/library/src/main/ets/components/imageknife/holder/PlaceHolderManager.ets b/library/src/main/ets/components/imageknife/holder/PlaceHolderManager.ets
index 651fec1..cd7723e 100644
--- a/library/src/main/ets/components/imageknife/holder/PlaceHolderManager.ets
+++ b/library/src/main/ets/components/imageknife/holder/PlaceHolderManager.ets
@@ -63,6 +63,7 @@ export class PlaceHolderManager {
case SupportFormat.gif:
case SupportFormat.tiff:
case SupportFormat.webp:
+ case SupportFormat.heic:
this.mediaImageProcess(onComplete, onError, arraybuffer, typeValue)
break;
default:
diff --git a/library/src/main/ets/components/imageknife/holder/RetryHolderManager.ets b/library/src/main/ets/components/imageknife/holder/RetryHolderManager.ets
index 8acfc20..86abf27 100644
--- a/library/src/main/ets/components/imageknife/holder/RetryHolderManager.ets
+++ b/library/src/main/ets/components/imageknife/holder/RetryHolderManager.ets
@@ -60,6 +60,7 @@ export class RetryHolderManager {
case SupportFormat.gif:
case SupportFormat.tiff:
case SupportFormat.webp:
+ case SupportFormat.heic:
this.mediaImageProcess(onComplete, onError, arraybuffer, typeValue)
break;
default:
diff --git a/library/src/main/ets/components/imageknife/utils/FileTypeUtil.ets b/library/src/main/ets/components/imageknife/utils/FileTypeUtil.ets
index 44e2b54..78e1cd7 100644
--- a/library/src/main/ets/components/imageknife/utils/FileTypeUtil.ets
+++ b/library/src/main/ets/components/imageknife/utils/FileTypeUtil.ets
@@ -26,6 +26,7 @@ export class FileTypeUtil {
'webp': [new Uint8Array([0x52, 0x49, 0x46, 0x46])],
'tiff': [new Uint8Array([0x49, 0x20, 0x49]), new Uint8Array([0x49, 0x49, 0x2A, 0x00]), new Uint8Array([0x4D, 0x4D, 0x00, 0x2A]), new Uint8Array([0x4D, 0x4D, 0x00, 0x2B])],
// 添加更多的文件类型和特征
+ 'heic': [new Uint8Array([0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, 0x68, 0x65, 0x69, 0x63, 0x00, 0x00, 0x00, 0x00])],
};
@@ -41,7 +42,8 @@ export class FileTypeUtil {
value == SupportFormat.webp ||
value == SupportFormat.bmp ||
value == SupportFormat.gif ||
- value == SupportFormat.svg
+ value == SupportFormat.svg ||
+ value == SupportFormat.heic
) {
return true;
}
@@ -106,5 +108,6 @@ export enum SupportFormat {
bmp = 'bmp',
gif = 'gif',
svg = 'svg',
- tiff = 'tiff'
+ tiff = 'tiff',
+ heic = 'heic'
}