!74 library依赖更名为sharedlibrary

Merge pull request !74 from zhoulisheng2/master
This commit is contained in:
openharmony_ci 2023-12-08 02:24:28 +00:00 committed by Gitee
commit 70a1c0911e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
22 changed files with 65 additions and 28 deletions

2
NOTICE
View File

@ -148,7 +148,7 @@ http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
Java Author: Mario Klingemann <mario at quasimondo.com>
http://incubator.quasimondo.com
created Feburary 29, 2004
created February 29, 2004
port : Yahel Bouaziz <yahel at kayenko.com>
http://www.kayenko.com
ported april 5th, 2012

View File

@ -39,8 +39,8 @@
"srcPath": "./gpu_transform"
},
{
"name": "library",
"srcPath": "./library",
"name": "sharedlibrary",
"srcPath": "./sharedlibrary",
"targets": [
{
"name": "default",

View File

@ -6,8 +6,11 @@
"repository": {},
"version": "2.1.1-rc.4",
"dependencies": {
"@ohos/libraryimageknife": "file:../library",
// 如果测试entry的demo需要开启以下2个依赖, 然后点击entry勾选 Edit Configurations->点击Deploy Multi Hap->勾选Deploy Multi Hap Packages
// 然后点击module栏目 把library也勾选上,这样就可以在HSP场景下测试Entry里面的HSP场景
"@ohos/libraryimageknife": "file:../sharedlibrary",
"@ohos/disklrucache": "^2.0.2-rc.0",
// 下面这个依赖是为了跑XTS用例的需要跑XTS时,需要注释上面2个依赖单独使用imageknife依赖
"@ohos/imageknife": "file:../imageknife"
}
}
}

View File

@ -262,7 +262,7 @@ struct IndexFunctionDemo {
Button("进入HSP的library共享包")
.onClick(() => {
router.pushUrl({url:'@bundle:com.openharmony.imageknife/library/ets/pages/Index'})
router.pushUrl({url:'@bundle:com.openharmony.imageknife/sharedlibrary/ets/pages/Index'})
.then(()=>{
console.log('push page suceess')
})

View File

@ -23,6 +23,7 @@ import worker from '@ohos.worker'
@Component
struct TestImageKnifeOptionChangedPage {
svgUrl:string = ''
@State imageKnifeOption1: ImageKnifeOption =
{
loadSrc: $r('app.media.jpgSample'),
@ -139,10 +140,28 @@ struct TestImageKnifeOptionChangedPage {
errorholderSrc: $r('app.media.icon_failed')
};
}).margin({left:5}).backgroundColor(Color.Blue)
Button('svg')
Text("请先设置SVG图片的url地址")
TextArea({ placeholder: '请输入SVG图片的url地址' })
.placeholderColor("rgb(0,0,35)")
.placeholderFont({ size: 20, weight: 100, family: 'cursive', style: FontStyle.Italic })
.textAlign(TextAlign.Center)
.caretColor(Color.Blue)
.height(40)
.width(400)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontFamily("sans-serif")
.fontStyle(FontStyle.Normal)
.fontColor(Color.Red)
.onChange((value: string) => {
this.svgUrl = value
})
Button('svg')
.onClick(()=>{
this.imageKnifeOption1 = {
loadSrc: 'http://124.222.187.78/download/test.svg',
loadSrc: this.svgUrl,
placeholderSrc: $r('app.media.icon_loading'),
errorholderSrc: $r('app.media.icon_failed')

View File

@ -23,7 +23,7 @@ import { BusinessError } from '@ohos.base'
@Entry
@Component
struct TestPreloadPage {
svgUrl:string = ''
@State imageKnifeOption1: ImageKnifeOption =
{
loadSrc: $r('app.media.jpgSample'),
@ -255,13 +255,28 @@ struct TestPreloadPage {
}
.margin({ top: 15 })
Text("请先设置SVG图片的url地址")
TextArea({ placeholder: '请输入SVG图片的url地址' })
.placeholderColor("rgb(0,0,35)")
.placeholderFont({ size: 20, weight: 100, family: 'cursive', style: FontStyle.Italic })
.textAlign(TextAlign.Center)
.caretColor(Color.Blue)
.height(40)
.width(400)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontFamily("sans-serif")
.fontStyle(FontStyle.Normal)
.fontColor(Color.Red)
.onChange((value: string) => {
this.svgUrl = value
})
Flex({ direction: FlexDirection.Row }) {
Button('预加载网络资源svg')
.onClick(() => {
let request = new RequestOption();
request.load('http://124.222.187.78/download/test.svg')
request.load(this.svgUrl)
.setImageViewSize({ width: 300, height: 300 })
.addListener({callback:(err:BusinessError|string, data:ImageKnifeData) => {
if (err) {
@ -279,7 +294,7 @@ struct TestPreloadPage {
Button('网络资源svg')
.onClick(() => {
this.imageKnifeOption = {
loadSrc: 'http://124.222.187.78/download/test.svg',
loadSrc: this.svgUrl,
placeholderSrc: $r('app.media.icon_loading'),
errorholderSrc: $r('app.media.icon_failed'),

View File

@ -445,7 +445,7 @@ export struct ImageKnifeComponent {
LogUtil.log('ImageKnifeComponent default drawPlaceholder start!')
data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => {
LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
let scaleType = (typeof imageKnifeOption.placeholderScaleType == 'number') ? imageKnifeOption.placeholderScaleType : ScaleType.FIT_CENTER
context.save();
context.clearRect(0, 0, compWidth, compHeight)
@ -500,7 +500,7 @@ export struct ImageKnifeComponent {
LogUtil.log('ImageKnifeComponent default drawThumbSizeMultiplier start!')
data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => {
LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
let scaleType = (typeof imageKnifeOption.thumbSizeMultiplierScaleType == 'number') ? imageKnifeOption.thumbSizeMultiplierScaleType : ScaleType.FIT_CENTER
context.save();
context.clearRect(0, 0, compWidth, compHeight)
@ -553,7 +553,7 @@ export struct ImageKnifeComponent {
LogUtil.log('ImageKnifeComponent default drawErrorholder start!')
data.drawPixelMap?.imagePixelMap?.getImageInfo().then((imageInfo) => {
LogUtil.log('ImageKnifeComponent imageinfo widht =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
LogUtil.log('ImageKnifeComponent imageinfo width =' + imageInfo.size.width + ' height=' + imageInfo.size.height)
let scaleType = (typeof imageKnifeOption.errorholderSrcScaleType == 'number') ? imageKnifeOption.errorholderSrcScaleType : ScaleType.FIT_CENTER
context.save();
context.clearRect(0, 0, compWidth, compHeight)

View File

@ -27,13 +27,13 @@ export class LoadDataShareFileClient implements IDataFetch {
onComplete(buf);
fs.close(file.fd);
}).catch((err:BusinessError) => {
onError('LoadDataShareFileClient fs.read err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
onError('LoadDataShareFileClient fs.read err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
})
}).catch((err:BusinessError) => {
onError('LoadDataShareFileClient fs.stat err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
onError('LoadDataShareFileClient fs.stat err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
})
}).catch((err:BusinessError) => {
onError('LoadDataShareFileClient fs.open err happend uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
onError('LoadDataShareFileClient fs.open err happened uri=' + request.loadSrc + " err.msg=" + err?.message + " err.code=" + err?.code)
})
}
}

View File

@ -30,7 +30,7 @@ export namespace fastBlur {
//
// Java Author: Mario Klingemann <mario at quasimondo.com>
// http://incubator.quasimondo.com
// created Feburary 29, 2004
// created February 29, 2004
// port : Yahel Bouaziz <yahel at kayenko.com>
// http://www.kayenko.com
// ported april 5th, 2012

View File

@ -1,5 +1,5 @@
{
"name": "library",
"name": "sharedlibrary",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "./src/main/ets/Index.ets",

View File

@ -22,15 +22,15 @@ struct Index {
@State imageOption1:ImageKnifeOption = {
loadSrc: $r('app.media.icon'),
context: getContext(this).createModuleContext('library') as common.UIAbilityContext
context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext
}
@State imageOption2:ImageKnifeOption = {
loadSrc: $r('app.media.icon'),
context: getContext(this).createModuleContext('library') as common.UIAbilityContext
context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext
}
@State imageOption3:ImageKnifeOption = {
loadSrc: $r('app.media.icon'),
context: getContext(this).createModuleContext('library') as common.UIAbilityContext
context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext
}
build() {
@ -40,27 +40,27 @@ struct Index {
this.imageOption1 = {
loadSrc: $r('app.media.setting'),
// 只要涉及resource加载 在HSP中都要带上context属性
context: getContext(this).createModuleContext('library') as common.UIAbilityContext
context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext
}
})
ImageKnifeComponent({imageKnifeOption:this.imageOption1}).width(300).height(300).backgroundColor(Color.Pink)
Button('点击加载网络图片').onClick(()=>{
this.imageOption2 = {
loadSrc: 'https://hbimg.huabanimg.com/cc6af25f8d782d3cf3122bef4e61571378271145735e9-vEVggB',
context: getContext(this).createModuleContext('library') as common.UIAbilityContext
context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext
}
})
ImageKnifeComponent({imageKnifeOption:this.imageOption2}).width(300).height(300).backgroundColor(Color.Pink)
Button('点击加载本地文件').onClick(()=>{
getContext(this).createModuleContext('library').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{
getContext(this).createModuleContext('sharedlibrary').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{
let ctx = ImageKnifeGlobal.getInstance().getHapContext() as common.UIAbilityContext;
let path = ctx.filesDir+"/set.jpeg";
FileUtils.getInstance().writeFile(path,data.buffer)
FileUtils.getInstance().readFilePicAsync(path).then(buffer=>{
this.imageOption3 = {
loadSrc: path,
context: getContext(this).createModuleContext('library') as common.UIAbilityContext
context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext
}
})
})

View File

@ -1,6 +1,6 @@
{
"module": {
"name": "library",
"name": "sharedlibrary",
"type": "shared",
"description": "$string:shared_desc",
"deviceTypes": [

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB