1.给所有的接口导出和引入加上type关键字

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2023-04-06 10:17:15 +08:00
parent f9137d11b3
commit 8a007854cd
20 changed files with 46 additions and 54 deletions

View File

@ -1,4 +1,15 @@
## 1.0.7
- 新增开发者可对图片缓存进行全局配置能力
- 新增对OpenHarmony图库的Uri数据加载的能力需要申请图库访问权限和文件读取权限动态申请图库访问权限
- 修复若干问题:
1.ImageKnifeOption的loadSrc为undefined导致的crash问题
2.ImageKnifeComponent直接绘制GIF图片格式第几帧的时候无法绘制问题。
## 1.0.6 ## 1.0.6
- 适配DevEco Studio 3.1Beta1及以上版本。 - 适配DevEco Studio 3.1Beta1及以上版本。
- 适配OpenHarmony SDK API version 9及以上版本。 - 适配OpenHarmony SDK API version 9及以上版本。

View File

@ -142,6 +142,7 @@ struct TestImageKnifeOptionChangedPage4 {
if(index<30){ if(index<30){
index++ index++
let nextFunc = this.drawMainAnimate.bind(this,index, context, scaleType, imagePixelMap, widthPixel, heightPixel, compWidth, compHeight) let nextFunc = this.drawMainAnimate.bind(this,index, context, scaleType, imagePixelMap, widthPixel, heightPixel, compWidth, compHeight)
// @ts-ignore
this.mTimerId = setTimeout(nextFunc, 1000/30.0) this.mTimerId = setTimeout(nextFunc, 1000/30.0)
}else{ }else{
// 不做处理 // 不做处理
@ -225,6 +226,7 @@ struct TestImageKnifeOptionChangedPage4 {
console.log('imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height + 'scaleType=' + scaleType) console.log('imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height + 'scaleType=' + scaleType)
let func = this.drawMainAnimate.bind(this,0, context, scaleType, data.drawPixelMap.imagePixelMap, imageInfo.size.width, imageInfo.size.height, compWidth, compHeight) let func = this.drawMainAnimate.bind(this,0, context, scaleType, data.drawPixelMap.imagePixelMap, imageInfo.size.width, imageInfo.size.height, compWidth, compHeight)
// @ts-ignore
this.mTimerId = setTimeout(func, 1000/30.0) this.mTimerId = setTimeout(func, 1000/30.0)
console.log('TestImageKnifeOptionChangedPage4 drawMainSource end!') console.log('TestImageKnifeOptionChangedPage4 drawMainSource end!')

View File

@ -15,7 +15,7 @@
import { NativeEglRender } from '../gl/NativeEglRender' import { NativeEglRender } from '../gl/NativeEglRender'
import { GPUFilterType } from '../gl/GPUFilterType' import { GPUFilterType } from '../gl/GPUFilterType'
import { Runnable } from '../interface/Runnable' import type { Runnable } from '../interface/Runnable'
import LinkedList from '@ohos.util.LinkedList'; import LinkedList from '@ohos.util.LinkedList';
import ArrayList from '@ohos.util.ArrayList'; import ArrayList from '@ohos.util.ArrayList';

View File

@ -27,16 +27,16 @@ export * from './src/main/ets/components/cache/diskstrategy/enum/AUTOMATIC'
export * from './src/main/ets/components/cache/diskstrategy/enum/DATA' export * from './src/main/ets/components/cache/diskstrategy/enum/DATA'
export * from './src/main/ets/components/cache/diskstrategy/enum/NONE' export * from './src/main/ets/components/cache/diskstrategy/enum/NONE'
export * from './src/main/ets/components/cache/diskstrategy/enum/RESOURCE' export * from './src/main/ets/components/cache/diskstrategy/enum/RESOURCE'
export * from './src/main/ets/components/cache/key/EngineKeyInterface' export type {EngineKeyInterface} from './src/main/ets/components/cache/key/EngineKeyInterface'
export * from './src/main/ets/components/cache/key/EngineKeyFactories' export * from './src/main/ets/components/cache/key/EngineKeyFactories'
/** /**
* compress * compress
*/ */
export * from './src/main/ets/components/imageknife/compress/CompressBuilder' export * from './src/main/ets/components/imageknife/compress/CompressBuilder'
export * from './src/main/ets/components/imageknife/compress/listener/OnCompressListener' export type {OnCompressListener} from './src/main/ets/components/imageknife/compress/listener/OnCompressListener'
export * from './src/main/ets/components/imageknife/compress/listener/OnRenameListener' export type {OnRenameListener} from './src/main/ets/components/imageknife/compress/listener/OnRenameListener'
export * from './src/main/ets/components/imageknife/compress/listener/CompressDataListener' export type {CompressDataListener} from './src/main/ets/components/imageknife/compress/listener/CompressDataListener'
export * from './src/main/ets/components/imageknife/compress/listener/CompressionPredicate' export * from './src/main/ets/components/imageknife/compress/listener/CompressionPredicate'
export * from './src/main/ets/components/imageknife/compress/provider/CompressAdapter' export * from './src/main/ets/components/imageknife/compress/provider/CompressAdapter'
export * from './src/main/ets/components/imageknife/compress/provider/CompressProvider' export * from './src/main/ets/components/imageknife/compress/provider/CompressProvider'
@ -55,7 +55,7 @@ export * from './src/main/ets/components/imageknife/crop/CropCallback'
/** /**
* transform * transform
*/ */
export * from './src/main/ets/components/imageknife/transform/BaseTransform' export type {BaseTransform} from './src/main/ets/components/imageknife/transform/BaseTransform'
export * from './src/main/ets/components/imageknife/transform/BlurTransformation' export * from './src/main/ets/components/imageknife/transform/BlurTransformation'
export * from './src/main/ets/components/imageknife/transform/BrightnessFilterTransformation' export * from './src/main/ets/components/imageknife/transform/BrightnessFilterTransformation'
export * from './src/main/ets/components/imageknife/transform/ContrastFilterTransformation' export * from './src/main/ets/components/imageknife/transform/ContrastFilterTransformation'
@ -99,10 +99,11 @@ export * from './src/main/ets/components/imageknife/ImageKnifeComponent'
export * from './src/main/ets/components/imageknife/ImageKnifeDrawFactory' export * from './src/main/ets/components/imageknife/ImageKnifeDrawFactory'
export * from './src/main/ets/components/imageknife/ImageKnifeOption' export * from './src/main/ets/components/imageknife/ImageKnifeOption'
export * from './src/main/ets/components/imageknife/ImageKnifeData' export * from './src/main/ets/components/imageknife/ImageKnifeData'
export * from './src/main/ets/components/imageknife/interface/IAllCacheInfoCallback' export type {IAllCacheInfoCallback} from './src/main/ets/components/imageknife/interface/IAllCacheInfoCallback'
export * from './src/main/ets/components/imageknife/interface/IParseImage' export type {AllCacheInfo} from './src/main/ets/components/imageknife/interface/IAllCacheInfoCallback'
export * from './src/main/ets/components/imageknife/networkmanage/IDataFetch' export type {IParseImage} from './src/main/ets/components/imageknife/interface/IParseImage'
export * from './src/main/ets/components/imageknife/requestmanage/ICache' export type {IDataFetch} from './src/main/ets/components/imageknife/networkmanage/IDataFetch'
export type {ICache} from './src/main/ets/components/imageknife/requestmanage/ICache'
export * from './src/main/ets/components/imageknife/utils/FileTypeUtil' export * from './src/main/ets/components/imageknife/utils/FileTypeUtil'
export * from './src/main/ets/components/imageknife/utils/ParseImageUtil' export * from './src/main/ets/components/imageknife/utils/ParseImageUtil'
@ -121,7 +122,7 @@ export {gifHandler} from './GifWorker'
// 自定义组件新增 // 自定义组件新增
// 自定义组件绘制生命周期 // 自定义组件绘制生命周期
export * from './src/main/ets/components/imageknife/interface/IDrawLifeCycle' export type {IDrawLifeCycle} from './src/main/ets/components/imageknife/interface/IDrawLifeCycle'
// 日志管理 // 日志管理
export * from './src/main/ets/components/imageknife/utils/LogUtil' export * from './src/main/ets/components/imageknife/utils/LogUtil'

View File

@ -16,12 +16,8 @@
"type": "module", "type": "module",
"version": "1.0.6", "version": "1.0.6",
"dependencies": { "dependencies": {
"pako": "^1.0.5",
"js-binary-schema-parser": "^2.0.3",
"@ohos/disklrucache": "^1.0.0", "@ohos/disklrucache": "^1.0.0",
"@ohos/svg": "1.1.0", "@ohos/svg": "1.1.0",
"crc-32": "^1.2.0",
"spark-md5": "^3.0.2",
"@ohos/gpu_transform": "^0.1.0" "@ohos/gpu_transform": "^0.1.0"
}, },
"tags": [ "tags": [

View File

@ -26,9 +26,9 @@ import {RequestManager} from "../imageknife/requestmanage/RequestManager"
import {NONE} from "../cache/diskstrategy/enum/NONE" import {NONE} from "../cache/diskstrategy/enum/NONE"
import {FileTypeUtil} from '../imageknife/utils/FileTypeUtil' import {FileTypeUtil} from '../imageknife/utils/FileTypeUtil'
import {DownloadClient} from '../imageknife/networkmanage/DownloadClient' import {DownloadClient} from '../imageknife/networkmanage/DownloadClient'
import {IDataFetch} from '../imageknife/networkmanage/IDataFetch' import type {IDataFetch} from '../imageknife/networkmanage/IDataFetch'
import {ParseResClient} from '../imageknife/resourcemanage/ParseResClient' import {ParseResClient} from '../imageknife/resourcemanage/ParseResClient'
import {IResourceFetch} from '../imageknife/resourcemanage/IResourceFetch' import type {IResourceFetch} from '../imageknife/resourcemanage/IResourceFetch'
import {ImageKnifeData,ImageKnifeType} from '../imageknife/ImageKnifeData' import {ImageKnifeData,ImageKnifeType} from '../imageknife/ImageKnifeData'
import {FileUtils} from '../cache/FileUtils' import {FileUtils} from '../cache/FileUtils'
import {FileReader} from '../cache/FileReader' import {FileReader} from '../cache/FileReader'

View File

@ -14,9 +14,9 @@
*/ */
import { DiskStrategy } from "../cache/diskstrategy/DiskStrategy" import { DiskStrategy } from "../cache/diskstrategy/DiskStrategy"
import { AsyncCallback } from "../imageknife/interface/asynccallback" import type { AsyncCallback } from "../imageknife/interface/asynccallback"
import { AsyncSuccess } from "../imageknife/interface/AsyncSuccess" import type { AsyncSuccess } from "../imageknife/interface/AsyncSuccess"
import { IAllCacheInfoCallback } from "../imageknife/interface/IAllCacheInfoCallback" import type { IAllCacheInfoCallback } from "../imageknife/interface/IAllCacheInfoCallback"
import { AUTOMATIC } from "../cache/diskstrategy/enum/AUTOMATIC" import { AUTOMATIC } from "../cache/diskstrategy/enum/AUTOMATIC"
import { BaseTransform } from "../imageknife/transform/BaseTransform" import { BaseTransform } from "../imageknife/transform/BaseTransform"
import { RotateImageTransformation } from "../imageknife/transform/RotateImageTransformation" import { RotateImageTransformation } from "../imageknife/transform/RotateImageTransformation"

View File

@ -1,18 +0,0 @@
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {ImageKnifeData} from '../ImageKnifeData'
export interface IDrawExtension{
<T>(context: CanvasRenderingContext2D,data: ImageKnifeData, imageKnifeOption:T, compWidth:number,compHeight:number, setGifTimeId?:(timeId:number)=>void)
}

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { IDataFetch } from '../networkmanage/IDataFetch' import type { IDataFetch } from '../networkmanage/IDataFetch'
import { RequestOption } from '../RequestOption' import { RequestOption } from '../RequestOption'
import { Md5 } from '../../cache/Md5' import { Md5 } from '../../cache/Md5'
import { FileUtils } from '../../cache/FileUtils' import { FileUtils } from '../../cache/FileUtils'

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { IDataFetch } from '../networkmanage/IDataFetch' import type { IDataFetch } from '../networkmanage/IDataFetch'
import { RequestOption } from '../RequestOption' import { RequestOption } from '../RequestOption'
import fs from '@ohos.file.fs'; import fs from '@ohos.file.fs';

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { IDataFetch } from '../networkmanage/IDataFetch' import type { IDataFetch } from '../networkmanage/IDataFetch'
import { RequestOption } from '../RequestOption' import { RequestOption } from '../RequestOption'
import { Md5 } from '../../cache/Md5' import { Md5 } from '../../cache/Md5'
import { FileUtils } from '../../cache/FileUtils' import { FileUtils } from '../../cache/FileUtils'

View File

@ -13,14 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
import { IDataFetch } from '../networkmanage/IDataFetch' import type { IDataFetch } from '../networkmanage/IDataFetch'
import { RequestOption } from '../RequestOption' import { RequestOption } from '../RequestOption'
import { Md5 } from '../../cache/Md5' import { Md5 } from '../../cache/Md5'
import { FileUtils } from '../../cache/FileUtils' import { FileUtils } from '../../cache/FileUtils'
import loadRequest from '@ohos.request'; import loadRequest from '@ohos.request';
// 数据加载器 // 数据加载器
export class NetworkDownloadClient { export class NetworkDownloadClient implements IDataFetch {
loadData(request: RequestOption, onComplete: (img: ArrayBuffer) => void, onError: (err: string) => void) { loadData(request: RequestOption, onComplete: (img: ArrayBuffer) => void, onError: (err: string) => void) {
let filename = Md5.hashStr(request.generateDataKey); let filename = Md5.hashStr(request.generateDataKey);
let downloadFolder = request.getFilesPath() + "/" + request.networkCacheFolder; let downloadFolder = request.getFilesPath() + "/" + request.networkCacheFolder;

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { ICache } from "../requestmanage/ICache" import type { ICache } from "../requestmanage/ICache"
import { DiskLruCache } from "@ohos/disklrucache" import { DiskLruCache } from "@ohos/disklrucache"
export class DiskCacheProxy implements ICache<string, ArrayBuffer> { export class DiskCacheProxy implements ICache<string, ArrayBuffer> {

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import {ICache} from "../requestmanage/ICache" import type {ICache} from "../requestmanage/ICache"
import {LruCache} from "../../cache/LruCache" import {LruCache} from "../../cache/LruCache"
export class MemoryCacheProxy <K, V> implements ICache<K, V> { export class MemoryCacheProxy <K, V> implements ICache<K, V> {

View File

@ -21,12 +21,12 @@ import {Md5} from "../../cache/Md5"
import{MemoryCacheProxy} from "../requestmanage/MemoryCacheProxy" import{MemoryCacheProxy} from "../requestmanage/MemoryCacheProxy"
import{DiskCacheProxy} from "../requestmanage/DiskCacheProxy" import{DiskCacheProxy} from "../requestmanage/DiskCacheProxy"
import{FileTypeUtil} from "../utils/FileTypeUtil" import{FileTypeUtil} from "../utils/FileTypeUtil"
import{IDataFetch} from "../../imageknife/networkmanage/IDataFetch" import type {IDataFetch} from "../../imageknife/networkmanage/IDataFetch"
import{IResourceFetch} from "../../imageknife/resourcemanage/IResourceFetch" import type {IResourceFetch} from "../../imageknife/resourcemanage/IResourceFetch"
import{ImageKnifeData,ImageKnifeType} from "../ImageKnifeData" import{ImageKnifeData,ImageKnifeType} from "../ImageKnifeData"
import {AllCacheInfo, IAllCacheInfoCallback} from "../../imageknife/interface/IAllCacheInfoCallback" import {AllCacheInfo} from "../../imageknife/interface/IAllCacheInfoCallback"
import{ParseImageUtil} from '../utils/ParseImageUtil' import{ParseImageUtil} from '../utils/ParseImageUtil'
import{IParseImage} from '../interface/IParseImage' import type {IParseImage} from '../interface/IParseImage'
import image from "@ohos.multimedia.image" import image from "@ohos.multimedia.image"
import { SVGParseImpl } from '../utils/svg/SVGParseImpl' import { SVGParseImpl } from '../utils/svg/SVGParseImpl'
import { GIFParseImpl } from '../utils/gif/GIFParseImpl' import { GIFParseImpl } from '../utils/gif/GIFParseImpl'

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import {IResourceFetch} from '../resourcemanage/IResourceFetch' import type {IResourceFetch} from '../resourcemanage/IResourceFetch'
import {ResourceTypeEts} from '../../imageknife/constants/ResourceTypeEts' import {ResourceTypeEts} from '../../imageknife/constants/ResourceTypeEts'
import resourceManager from '@ohos.resourceManager'; import resourceManager from '@ohos.resourceManager';

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import {IResourceFetch} from '../resourcemanage/IResourceFetch' import type {IResourceFetch} from '../resourcemanage/IResourceFetch'
import {ResourceTypeEts} from '../../imageknife/constants/ResourceTypeEts' import {ResourceTypeEts} from '../../imageknife/constants/ResourceTypeEts'
import {Base64} from '../../cache/Base64' import {Base64} from '../../cache/Base64'

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {DataCallBack} from "../interface/DataCallBack" import type {DataCallBack} from "../interface/DataCallBack"
export namespace ColorUtils { export namespace ColorUtils {

View File

@ -13,7 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import{IParseImage} from '../interface/IParseImage' import type {IParseImage} from '../interface/IParseImage'
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
export class ParseImageUtil implements IParseImage { export class ParseImageUtil implements IParseImage {

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {IParseSvg} from'./IParseSvg' import type {IParseSvg} from'./IParseSvg'
import {SVGImageView} from '@ohos/svg' import {SVGImageView} from '@ohos/svg'
export class SVGParseImpl implements IParseSvg{ export class SVGParseImpl implements IParseSvg{
parseSvg(imageinfo: ArrayBuffer,size?:{width:number,height:number}): Promise<PixelMap>{ parseSvg(imageinfo: ArrayBuffer,size?:{width:number,height:number}): Promise<PixelMap>{