-
Notifications
You must be signed in to change notification settings - Fork 948
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docs): update 3.0 upgrade guidelines md
- Loading branch information
1 parent
06806d9
commit 2815762
Showing
2 changed files
with
93 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# ImageDecoderAdapter | ||
|
||
--- | ||
|
||
## 背景 | ||
|
||
3.0我们在HippyEngine引擎初始化参数中增加了ImageDecoderAdapter的设置,如果有开发者业务中有使用到特殊格式的图片,如SharpP、avif等,可以通过设置ImageDecoderAdapter来对接你的自定义图片解码器,具体接口描述如下: | ||
|
||
## 3.0 图片解码Adapter接口定义 | ||
|
||
### ImageDecoderAdapter Public methods | ||
|
||
```java | ||
boolean preDecode(@NonNull byte[] data, | ||
@Nullable Map<String, Object> initProps, | ||
@NonNull ImageDataHolder imageHolder, | ||
@NonNull BitmapFactory.Options options); | ||
``` | ||
|
||
该接口在拉取到图片原始数据的时候会调用,解码的结果可以通过image data holder提供的setBitmap或者setDrawable接口设置到holder中,并且返回true,表示不需要sdk再做解码操作,如果返回false表示需要sdk做默认的解码操作。 | ||
|
||
```java | ||
void afterDecode(@Nullable Map<String, Object> initProps, | ||
@NonNull ImageDataHolder imageHolder, | ||
@NonNull BitmapFactory.Options options); | ||
``` | ||
|
||
|
||
该接口在解码结束后会调用,为开发者提供二次处理bitmap的机会, 比如要对bitmap做高斯模糊。 | ||
|
||
```java | ||
void destroyIfNeeded(); | ||
``` | ||
|
||
引擎退出销毁时调用,释放adapter可能占用的资源 |