mirror of
https://gitee.com/openharmony-tpc/ImageKnife.git
synced 2026-07-16 22:48:44 +08:00
@@ -46,22 +46,22 @@ struct ImageAnimatorPage {
|
||||
build() {
|
||||
Column(){
|
||||
Flex(){
|
||||
Button("播放").onClick(()=>{
|
||||
Button($r('app.string.Play')).onClick(()=>{
|
||||
this.animatorOption.state = AnimationStatus.Running
|
||||
})
|
||||
Button("暂停").onClick(()=>{
|
||||
Button($r('app.string.Pause')).onClick(()=>{
|
||||
this.animatorOption.state = AnimationStatus.Paused
|
||||
})
|
||||
Button("停止").onClick(()=>{
|
||||
Button($r('app.string.Stop')).onClick(()=>{
|
||||
this.animatorOption.state = AnimationStatus.Stopped
|
||||
})
|
||||
Button("无限循环").onClick(()=>{
|
||||
Button($r('app.string.Infinite_loop')).onClick(()=>{
|
||||
this.animatorOption.iterations = -1
|
||||
})
|
||||
Button("播放一次").onClick(()=>{
|
||||
Button($r('app.string.Play_once')).onClick(()=>{
|
||||
this.animatorOption.iterations = 1
|
||||
})
|
||||
Button("播放两次").onClick(()=>{
|
||||
Button($r('app.string.Play_twice')).onClick(()=>{
|
||||
this.animatorOption.iterations = 2
|
||||
})
|
||||
}
|
||||
@@ -72,7 +72,7 @@ struct ImageAnimatorPage {
|
||||
errorholderSrc:$r('app.media.failed')
|
||||
}),animatorOption:this.animatorOption
|
||||
}).width(200).height(200).backgroundColor(Color.Orange).margin({top:30})
|
||||
Text("动画显示第一帧").fontSize(20)
|
||||
Text($r('app.string.Display_the_first_frame')).fontSize(20)
|
||||
ImageKnifeAnimatorComponent({
|
||||
imageKnifeOption:new ImageKnifeOption({
|
||||
loadSrc:"https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658",
|
||||
@@ -80,7 +80,7 @@ struct ImageAnimatorPage {
|
||||
errorholderSrc:$r('app.media.failed')
|
||||
}),animatorOption:this.animatorOption1
|
||||
}).width(200).height(200).backgroundColor(Color.Orange).margin({top:30})
|
||||
Text("动画显示最后一帧").fontSize(20)
|
||||
Text($r('app.string.Display_the_last_frame')).fontSize(20)
|
||||
ImageKnifeAnimatorComponent({
|
||||
imageKnifeOption:new ImageKnifeOption({
|
||||
loadSrc:"https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658",
|
||||
|
||||
@@ -18,6 +18,10 @@ import router from '@system.router';
|
||||
@ComponentV2
|
||||
struct Index {
|
||||
|
||||
getResourceString(res:Resource){
|
||||
return getContext().resourceManager.getStringSync(res.id)
|
||||
}
|
||||
|
||||
|
||||
aboutToAppear(): void {
|
||||
|
||||
@@ -26,100 +30,100 @@ struct Index {
|
||||
build() {
|
||||
Scroll(){
|
||||
Column() {
|
||||
Button("测试ImageAnimator组件").onClick(()=>{
|
||||
Button($r('app.string.Test_ImageAnimator')).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/ImageAnimatorPage',
|
||||
});
|
||||
})
|
||||
Button("测试加载多张相同图片").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_multiple_images')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestCommonImage',
|
||||
});
|
||||
})
|
||||
Button("测试占位图Task报错").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_Task_error')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestTaskResourcePage',
|
||||
});
|
||||
})
|
||||
Button("测试HSP场景预加载").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_HSP')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestHspPreLoadImage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("单个图片使用").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_SingleImage')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/SingleImage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("全局自定义下载").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_custom_download')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestSetCustomImagePage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("多图 + LazyForEach").margin({top:10}).onClick(()=>{
|
||||
Button(this.getResourceString($r('app.string.Multiple_images')) + " + LazyForEach").margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/ManyPhotoShowPage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("多图 + reuse + LazyForeach").margin({top:10}).onClick(()=>{
|
||||
Button(this.getResourceString($r('app.string.Multiple_images')) + " + reuse + LazyForeach").margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/UserPage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("长图显示").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Display_long_image')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/LongImagePage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("缩放图片").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Image_scaling')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TransformPage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("消息+List").margin({top:10}).onClick(()=>{
|
||||
Button(this.getResourceString($r('app.string.Message_list')) + " + List").margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestImageFlash',
|
||||
|
||||
});
|
||||
})
|
||||
Button("自定义缓存key").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Custom_cache_key')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/SignatureTestPage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("预加载图片到文件缓存").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Preloading_images_to_cache')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestPrefetchToFileCache',
|
||||
|
||||
});
|
||||
})
|
||||
Button("从缓存获取图片显示").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Retrieve_image_display_from_cache')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestIsUrlExist',
|
||||
|
||||
});
|
||||
})
|
||||
Button("测试单个请求头").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_single_request_header')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestHeader',
|
||||
|
||||
});
|
||||
})
|
||||
Button("测试写入缓存策略").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_write_cache_strategy')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestWriteCacheStage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("图片变换").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Image_Transformation')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/ImageTransformation',
|
||||
|
||||
@@ -127,7 +131,7 @@ struct Index {
|
||||
|
||||
})
|
||||
|
||||
Button("不同的ObjectFit").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Different_ObjectFit')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/ObjectFitPage',
|
||||
|
||||
@@ -135,24 +139,24 @@ struct Index {
|
||||
|
||||
})
|
||||
|
||||
Button('测试图片加载成功/失败事件').margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_image_loading_success_or_failure_events')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/LoadStatePage',
|
||||
})
|
||||
})
|
||||
|
||||
Button('测试移除图片缓存接口').margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_removing_image_cache_interface')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestRemoveCache',
|
||||
});
|
||||
})
|
||||
Button("测试错误图显示").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_error_image_display')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/TestErrorHolderPage',
|
||||
|
||||
});
|
||||
})
|
||||
Button("测试媒体url").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Test_media_URL')).margin({top:10}).onClick(()=>{
|
||||
router.push({
|
||||
uri: 'pages/dataShareUriLoadPage',
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ struct LoadStatePage {
|
||||
Text('测试失败场景请先关闭网络,并保证本地没有此网络图片的缓存')
|
||||
.margin({ top: 20 })
|
||||
Row() {
|
||||
Button('测试失败/成功场景')
|
||||
Button($r('app.string.Test_failure_success'))
|
||||
.onClick(() => {
|
||||
this.ImageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: "https://www.openharmony.cn/_nuxt/img/logo.dcf95b3.png",
|
||||
@@ -82,7 +82,7 @@ struct LoadStatePage {
|
||||
Text(this.typeValue)
|
||||
ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(this.currentHeight).width(this.currentWidth)
|
||||
.margin({ top: 20 })
|
||||
Button("自定义下载失败").onClick(()=>{
|
||||
Button($r('app.string.Custom_download_failed')).onClick(()=>{
|
||||
this.imageKnifeOption1 = new ImageKnifeOption({
|
||||
loadSrc: "abc",
|
||||
placeholderSrc:$r('app.media.loading'),
|
||||
|
||||
@@ -27,7 +27,7 @@ struct ObjectFitPage {
|
||||
build() {
|
||||
Column() {
|
||||
|
||||
Button("主图Fill拉伸填充").onClick(()=>{
|
||||
Button($r('app.string.Main_image_Fill')).onClick(()=>{
|
||||
this.imageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: $r("app.media.app_icon"),
|
||||
placeholderSrc: $r("app.media.loading"),
|
||||
@@ -36,7 +36,7 @@ struct ObjectFitPage {
|
||||
})
|
||||
})
|
||||
|
||||
Button("占位图Contain保持比例填充").margin({top:10}).onClick(async () => {
|
||||
Button($r('app.string.Maintain_proportion_filling')).margin({top:10}).onClick(async () => {
|
||||
ImageKnife.getInstance().removeAllMemoryCache()
|
||||
await ImageKnife.getInstance().removeAllFileCache()
|
||||
|
||||
@@ -50,7 +50,7 @@ struct ObjectFitPage {
|
||||
})
|
||||
|
||||
|
||||
Button("错误图None不变化").margin({top:10}).onClick(() => {
|
||||
Button($r('app.string.Error_graph_None')).margin({top:10}).onClick(() => {
|
||||
this.imageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: "http://xxxxx",
|
||||
placeholderSrc: $r("app.media.loading"),
|
||||
|
||||
@@ -33,9 +33,9 @@ struct SignatureTestPage {
|
||||
Scroll() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
|
||||
Text("key固定为 1").fontSize(15)
|
||||
Text($r('app.string.The_key_fixed_1')).fontSize(15)
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Button("加载")
|
||||
Button($r('app.string.Load'))
|
||||
.onClick(() => {
|
||||
this.imageKnifeOption1 = new ImageKnifeOption({
|
||||
loadSrc: 'https://img-blog.csdn.net/20140514114029140',
|
||||
@@ -46,9 +46,9 @@ struct SignatureTestPage {
|
||||
ImageKnifeComponent({ imageKnifeOption: this.imageKnifeOption1 }).width(300).height(300)
|
||||
}.width('100%').backgroundColor(Color.Pink)
|
||||
|
||||
Text("key每次变化:时间戳").fontSize(15)
|
||||
Text($r('app.string.The_key_changes_timestamp')).fontSize(15)
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Button("加载")
|
||||
Button($r('app.string.Load'))
|
||||
.onClick(() => {
|
||||
this.imageKnifeOption2 = new ImageKnifeOption({
|
||||
loadSrc: 'https://img-blog.csdn.net/20140514114029140',
|
||||
|
||||
@@ -42,7 +42,7 @@ struct SingleImage {
|
||||
build() {
|
||||
Scroll(this.scroller) {
|
||||
Column() {
|
||||
Text("本地资源svg图片")
|
||||
Text($r('app.string.Local_SVG'))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
ImageKnifeComponent({
|
||||
@@ -56,7 +56,7 @@ struct SingleImage {
|
||||
.onClick(()=>{
|
||||
this.DrawingColorFilter = drawing.ColorFilter.createBlendModeColorFilter(this.color, drawing.BlendMode.SRC_IN);
|
||||
})
|
||||
Text("本地context files下文件")
|
||||
Text($r('app.string.Under_context_file'))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
ImageKnifeComponent({
|
||||
@@ -67,7 +67,7 @@ struct SingleImage {
|
||||
objectFit: ImageFit.Contain
|
||||
})
|
||||
}).width(100).height(100)
|
||||
Text("网络图片")
|
||||
Text($r('app.string.Network_images'))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
ImageKnifeComponent({
|
||||
@@ -79,7 +79,7 @@ struct SingleImage {
|
||||
progressListener:(progress:number)=>{console.info("ImageKnife:: call back progress = " + progress)}
|
||||
})
|
||||
}).width(100).height(100)
|
||||
Text("自定义下载")
|
||||
Text($r('app.string.Custom_network_download'))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
ImageKnifeComponent({
|
||||
@@ -92,7 +92,7 @@ struct SingleImage {
|
||||
transformation: new BlurTransformation(10)
|
||||
})
|
||||
}).width(100).height(100)
|
||||
Text("pixelMap加载图片")
|
||||
Text($r('app.string.PixelMap_loads_images'))
|
||||
.fontSize(30)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
ImageKnifeComponent({
|
||||
|
||||
@@ -111,12 +111,12 @@ struct ImageTestPage {
|
||||
})
|
||||
}
|
||||
Row(){
|
||||
Text("点击尺寸加50")
|
||||
Text($r('app.string.Click_on_add'))
|
||||
.onClick(()=> {
|
||||
this.imageSize = this.imageSize + 50
|
||||
})
|
||||
.width('50%').backgroundColor(0x88ff0000).textAlign(TextAlign.Center).height(50)
|
||||
Text("点击尺寸减50")
|
||||
Text($r('app.string.Click_on_reduce'))
|
||||
.onClick(()=> {
|
||||
this.imageSize = Math.max(this.imageSize - 50, 0)
|
||||
})
|
||||
|
||||
@@ -28,11 +28,11 @@ struct TestIsUrlExist {
|
||||
build() {
|
||||
Column() {
|
||||
Flex() {
|
||||
Button("预加载gif图").onClick(() => {
|
||||
Button($r('app.string.Preloading_GIF')).onClick(() => {
|
||||
this.imageKnifeOption.loadSrc =
|
||||
"https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658"
|
||||
})
|
||||
Button("内存缓存获取gif").onClick(() => {
|
||||
Button($r('app.string.Retrieve_GIF_from_memory')).onClick(() => {
|
||||
ImageKnife.getInstance()
|
||||
.getCacheImage("https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658",
|
||||
CacheStrategy.Memory)
|
||||
@@ -40,7 +40,7 @@ struct TestIsUrlExist {
|
||||
this.source = data !== undefined ? data.source : $r("app.media.startIcon")
|
||||
})
|
||||
})
|
||||
Button("文件缓存获取gif").onClick(() => {
|
||||
Button($r('app.string.Retrieve_GIF_from_disk')).onClick(() => {
|
||||
ImageKnife.getInstance()
|
||||
.getCacheImage("https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658",
|
||||
CacheStrategy.File)
|
||||
@@ -51,11 +51,11 @@ struct TestIsUrlExist {
|
||||
}
|
||||
|
||||
Flex() {
|
||||
Button("预加载静态图").onClick(() => {
|
||||
Button($r('app.string.Preloading_static_images')).onClick(() => {
|
||||
this.imageKnifeOption.loadSrc =
|
||||
'https://hbimg.huabanimg.com/95a6d37a39aa0b70d48fa18dc7df8309e2e0e8e85571e-x4hhks_fw658/format/webp'
|
||||
})
|
||||
Button("内存缓存获取").onClick(() => {
|
||||
Button($r('app.string.Retrieve_images_from_memory')).onClick(() => {
|
||||
ImageKnife.getInstance()
|
||||
.getCacheImage('https://hbimg.huabanimg.com/95a6d37a39aa0b70d48fa18dc7df8309e2e0e8e85571e-x4hhks_fw658/format/webp',
|
||||
CacheStrategy.Memory)
|
||||
@@ -63,7 +63,7 @@ struct TestIsUrlExist {
|
||||
this.source = data!.source
|
||||
})
|
||||
})
|
||||
Button("文件缓存获取").onClick(() => {
|
||||
Button($r('app.string.Retrieve_images_from_disk')).onClick(() => {
|
||||
ImageKnife.getInstance()
|
||||
.getCacheImage('https://hbimg.huabanimg.com/95a6d37a39aa0b70d48fa18dc7df8309e2e0e8e85571e-x4hhks_fw658/format/webp',
|
||||
CacheStrategy.File)
|
||||
|
||||
@@ -32,13 +32,13 @@ struct TestPrefetchToFileCachePage {
|
||||
}
|
||||
build() {
|
||||
Column() {
|
||||
Button("url预加载图片到文件缓存").margin({top:10}).onClick(async ()=>{
|
||||
Button($r('app.string.Preloading_images_to_file_cache_using_URL')).margin({top:10}).onClick(async ()=>{
|
||||
await this.preload("https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658")
|
||||
})
|
||||
Button("option预加载图片到文件缓存").margin({top:10}).onClick(async ()=>{
|
||||
Button($r('app.string.Preloading_images_to_file_cache_using_option')).margin({top:10}).onClick(async ()=>{
|
||||
await this.preload1("https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658")
|
||||
})
|
||||
Button("加载图片(预加载后可断网加载)").margin({top:10}).onClick(()=>{
|
||||
Button($r('app.string.Load_image_offline_after_preloading')).margin({top:10}).onClick(()=>{
|
||||
this.imageKnifeOption.loadSrc = "https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658"
|
||||
})
|
||||
ImageKnifeComponent({
|
||||
|
||||
@@ -17,6 +17,11 @@ import { ImageKnifeComponent, ImageKnife, ImageKnifeOption } from '@ohos/library
|
||||
@Entry
|
||||
@ComponentV2
|
||||
struct TestSetCustomImagePage {
|
||||
|
||||
getResourceString(res:Resource){
|
||||
return getContext().resourceManager.getStringSync(res.id)
|
||||
}
|
||||
|
||||
@Local imageKnifeOption: ImageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: $r('app.media.startIcon'),
|
||||
placeholderSrc: $r('app.media.loading')
|
||||
@@ -29,19 +34,19 @@ struct TestSetCustomImagePage {
|
||||
}
|
||||
build() {
|
||||
Column() {
|
||||
Button("自定义下载a").onClick(()=>{
|
||||
Button(this.getResourceString($r('app.string.Custom_network_download')) + " a").onClick(()=>{
|
||||
this.imageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: "aaa",
|
||||
placeholderSrc: $r('app.media.loading')
|
||||
})
|
||||
})
|
||||
Button("自定义下载b").onClick(()=>{
|
||||
Button(this.getResourceString($r('app.string.Custom_network_download')) + " b").onClick(()=>{
|
||||
this.imageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: "bbb",
|
||||
placeholderSrc: $r('app.media.loading')
|
||||
})
|
||||
})
|
||||
Button("自定义下载c").onClick(()=>{
|
||||
Button(this.getResourceString($r('app.string.Custom_network_download')) + " c").onClick(()=>{
|
||||
this.imageKnifeOption = new ImageKnifeOption({
|
||||
loadSrc: "ccc",
|
||||
placeholderSrc: $r('app.media.loading')
|
||||
|
||||
@@ -35,7 +35,7 @@ struct TestWriteCacheStage {
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Button("写入内存文件缓存").margin({top:10}).onClick(async ()=>{
|
||||
Button($r('app.string.Write_memory_and_file')).margin({top:10}).onClick(async ()=>{
|
||||
this.imageKnifeOption1 = new ImageKnifeOption({
|
||||
loadSrc:'https://hbimg.huabanimg.com/95a6d37a39aa0b70d48fa18dc7df8309e2e0e8e85571e-x4hhks_fw658/format/webp',
|
||||
placeholderSrc:$r('app.media.loading'),
|
||||
@@ -46,7 +46,7 @@ struct TestWriteCacheStage {
|
||||
ImageKnifeComponent({
|
||||
imageKnifeOption: this.imageKnifeOption1
|
||||
}).width(200).height(200).margin({top:10})
|
||||
Button("写入内存缓存").margin({top:10}).onClick(async ()=>{
|
||||
Button($r('app.string.Write_memory')).margin({top:10}).onClick(async ()=>{
|
||||
this.imageKnifeOption2 = new ImageKnifeOption({
|
||||
loadSrc:"https://hbimg.huabanimg.com/cc6af25f8d782d3cf3122bef4e61571378271145735e9-vEVggB",
|
||||
placeholderSrc:$r('app.media.loading'),
|
||||
@@ -57,7 +57,7 @@ struct TestWriteCacheStage {
|
||||
ImageKnifeComponent({
|
||||
imageKnifeOption: this.imageKnifeOption2
|
||||
}).width(200).height(200).margin({top:10})
|
||||
Button("写入文件缓存").margin({top:10}).onClick(async ()=>{
|
||||
Button($r('app.string.Write_file')).margin({top:10}).onClick(async ()=>{
|
||||
this.imageKnifeOption3 = new ImageKnifeOption({
|
||||
loadSrc:'https://img-blog.csdn.net/20140514114029140',
|
||||
placeholderSrc:$r('app.media.loading'),
|
||||
|
||||
@@ -34,12 +34,12 @@ struct TransformPage {
|
||||
ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(200).width(200)
|
||||
.transform(this.matrix1)
|
||||
// Image($r('app.media.rabbit')).objectFit(ImageFit.Contain).height(200).width(200).transform(this.matrix1)
|
||||
Button("放大").onClick(()=>{
|
||||
Button($r('app.string.Enlarge')).onClick(()=>{
|
||||
this.custom_scale = this.custom_scale * 2
|
||||
this.matrix1 = matrix4.identity().scale({ x: this.custom_scale, y: this.custom_scale })
|
||||
})
|
||||
|
||||
Button("缩小").onClick(()=>{
|
||||
Button($r('app.string.Reduce')).onClick(()=>{
|
||||
this.custom_scale = this.custom_scale / 2
|
||||
this.matrix1 = matrix4.identity().scale({ x: this.custom_scale, y: this.custom_scale })
|
||||
})
|
||||
|
||||
@@ -32,9 +32,9 @@ struct DataShareUriLoadPage {
|
||||
build() {
|
||||
Scroll() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Text("获取媒体图库的uri用ImageKnife展示").fontSize(15)
|
||||
Text($r('app.string.Retrieve_media_gallery')).fontSize(15)
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Button("点击加载Uri并展示")
|
||||
Button($r('app.string.Click_load_Uri'))
|
||||
.onClick(async () => {
|
||||
let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
|
||||
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
|
||||
|
||||
@@ -19,6 +19,246 @@
|
||||
{
|
||||
"name": "app_permission_READ_IMAGEVIDEO",
|
||||
"value": "获取读媒体资源权限"
|
||||
},
|
||||
{
|
||||
"name": "Test_ImageAnimator",
|
||||
"value": "Test ImageAnimator component"
|
||||
},
|
||||
{
|
||||
"name": "Test_multiple_images",
|
||||
"value": "Test loading multiple identical images"
|
||||
},
|
||||
{
|
||||
"name": "Test_Task_error",
|
||||
"value": "Test placeholder map Task error"
|
||||
},
|
||||
{
|
||||
"name": "Test_HSP",
|
||||
"value": "Test HSP scene preloading"
|
||||
},
|
||||
{
|
||||
"name": "Test_SingleImage",
|
||||
"value": "SingleImage"
|
||||
},
|
||||
{
|
||||
"name": "Test_custom_download",
|
||||
"value": "Global custom download"
|
||||
},
|
||||
{
|
||||
"name": "Multiple_images",
|
||||
"value": "Multiple images"
|
||||
},
|
||||
{
|
||||
"name": "Display_long_image",
|
||||
"value": "Display long image"
|
||||
},
|
||||
{
|
||||
"name": "Image_scaling",
|
||||
"value": "Image scaling"
|
||||
},
|
||||
{
|
||||
"name": "Message_list",
|
||||
"value": "Message list"
|
||||
},
|
||||
{
|
||||
"name": "Custom_cache_key",
|
||||
"value": "Custom cache key"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_images_to_cache",
|
||||
"value": "Preloading images to file cache"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_image_display_from_cache",
|
||||
"value": "Retrieve image display from cache"
|
||||
},
|
||||
{
|
||||
"name": "Test_single_request_header",
|
||||
"value": "Test a single request header"
|
||||
},
|
||||
{
|
||||
"name": "Test_write_cache_strategy",
|
||||
"value": "Test write cache strategy"
|
||||
},
|
||||
{
|
||||
"name": "Image_Transformation",
|
||||
"value": "Image Transformation"
|
||||
},
|
||||
{
|
||||
"name": "Different_ObjectFit",
|
||||
"value": "Different ObjectFit"
|
||||
},
|
||||
{
|
||||
"name": "Test_image_loading_success_or_failure_events",
|
||||
"value": "Test image loading success/failure events"
|
||||
},
|
||||
{
|
||||
"name": "Test_removing_image_cache_interface",
|
||||
"value": "Test removing image cache interface"
|
||||
},
|
||||
{
|
||||
"name": "Test_error_image_display",
|
||||
"value": "Test error image display"
|
||||
},
|
||||
{
|
||||
"name": "Test_media_URL",
|
||||
"value": "Test media URL"
|
||||
},
|
||||
{
|
||||
"name": "Display_the_first_frame",
|
||||
"value": "Display the first frame of the animation"
|
||||
},
|
||||
{
|
||||
"name": "Display_the_last_frame",
|
||||
"value": "Display the last frame of the animation"
|
||||
},
|
||||
{
|
||||
"name": "Play",
|
||||
"value": "Play"
|
||||
},
|
||||
{
|
||||
"name": "Pause",
|
||||
"value": "Pause"
|
||||
},
|
||||
{
|
||||
"name": "Stop",
|
||||
"value": "Stop"
|
||||
},
|
||||
{
|
||||
"name": "Infinite_loop",
|
||||
"value": "Infinite loop"
|
||||
},
|
||||
{
|
||||
"name": "Play_once",
|
||||
"value": "Play once"
|
||||
},
|
||||
{
|
||||
"name": "Play_twice",
|
||||
"value": "Play twice"
|
||||
},
|
||||
{
|
||||
"name": "Local_SVG",
|
||||
"value": "Local SVG image"
|
||||
},
|
||||
{
|
||||
"name": "Under_context_file",
|
||||
"value": "Files under context file"
|
||||
},
|
||||
{
|
||||
"name": "Network_images",
|
||||
"value": "Network images"
|
||||
},
|
||||
{
|
||||
"name": "Custom_network_download",
|
||||
"value": "Custom network download"
|
||||
},
|
||||
{
|
||||
"name": "PixelMap_loads_images",
|
||||
"value": "PixelMap loads images"
|
||||
},
|
||||
{
|
||||
"name": "Enlarge",
|
||||
"value": "Enlarge"
|
||||
},
|
||||
{
|
||||
"name": "Reduce",
|
||||
"value": "Reduce"
|
||||
},
|
||||
{
|
||||
"name": "Click_on_add",
|
||||
"value": "Click on the size to add 50"
|
||||
},
|
||||
{
|
||||
"name": "Click_on_reduce",
|
||||
"value": "Click to reduce size by 50"
|
||||
},
|
||||
{
|
||||
"name": "The_key_fixed_1",
|
||||
"value": "The key is fixed at 1"
|
||||
},
|
||||
{
|
||||
"name": "The_key_changes_timestamp",
|
||||
"value": "Key changes every time: timestamp"
|
||||
},
|
||||
{
|
||||
"name": "Load",
|
||||
"value": "Load"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_images_to_file_cache_using_URL",
|
||||
"value": "Preloading images to file cache using URL"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_images_to_file_cache_using_option",
|
||||
"value": "Preloading images to file cache using option"
|
||||
},
|
||||
{
|
||||
"name": "Load_image_offline_after_preloading",
|
||||
"value": "Load image (can be loaded offline after preloading)"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_GIF",
|
||||
"value": "Preloading GIF"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_GIF_from_memory",
|
||||
"value": "Retrieve GIF from memory cache"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_GIF_from_disk",
|
||||
"value": "Retrieve GIF from disk cache"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_static_images",
|
||||
"value": "Preloading static images"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_images_from_memory",
|
||||
"value": "Retrieve images from memory cache"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_images_from_disk",
|
||||
"value": "Retrieve images from memory disk"
|
||||
},
|
||||
{
|
||||
"name": "Write_memory_and_file",
|
||||
"value": "Write to memory and file cache"
|
||||
},
|
||||
{
|
||||
"name": "Write_memory",
|
||||
"value": "Write to memory cache"
|
||||
},
|
||||
{
|
||||
"name": "Write_file",
|
||||
"value": "Write to file cache"
|
||||
},
|
||||
{
|
||||
"name": "Main_image_Fill",
|
||||
"value": "Main image Fill Stretch Fill"
|
||||
},
|
||||
{
|
||||
"name": "Maintain_proportion_filling",
|
||||
"value": "Maintain proportion filling in the placeholder map 'Include'"
|
||||
},
|
||||
{
|
||||
"name": "Error_graph_None",
|
||||
"value": "Error graph None remains unchanged"
|
||||
},
|
||||
{
|
||||
"name": "Test_failure_success",
|
||||
"value": "Test failure/success"
|
||||
},
|
||||
{
|
||||
"name": "Custom_download_failed",
|
||||
"value": "Custom download failed"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_media_gallery",
|
||||
"value": "Retrieve the URI of the media gallery and display it using ImageKnife"
|
||||
},
|
||||
{
|
||||
"name": "Click_load_Uri",
|
||||
"value": "Click to load Uri and display"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -19,6 +19,242 @@
|
||||
{
|
||||
"name": "app_permission_READ_IMAGEVIDEO",
|
||||
"value": "获取读媒体资源权限"
|
||||
},
|
||||
{
|
||||
"name": "Test_ImageAnimator",
|
||||
"value": "测试ImageAnimator组件"
|
||||
},
|
||||
{
|
||||
"name": "Test_multiple_images",
|
||||
"value": "测试加载多张相同图片"
|
||||
},
|
||||
{
|
||||
"name": "Test_Task_error",
|
||||
"value": "测试占位图Task报错"
|
||||
},
|
||||
{
|
||||
"name": "Test_HSP",
|
||||
"value": "测试HSP场景预加载"
|
||||
},
|
||||
{
|
||||
"name": "Test_SingleImage",
|
||||
"value": "单个图片使用"
|
||||
},
|
||||
{
|
||||
"name": "Test_custom_download",
|
||||
"value": "全局自定义下载"
|
||||
},
|
||||
{
|
||||
"name": "Multiple_images",
|
||||
"value": "多图"
|
||||
},
|
||||
{
|
||||
"name": "Display_long_image",
|
||||
"value": "长图显示"
|
||||
},
|
||||
{
|
||||
"name": "Image_scaling",
|
||||
"value": "缩放图片"
|
||||
},
|
||||
{
|
||||
"name": "Message_list",
|
||||
"value": "消息列表"
|
||||
},
|
||||
{
|
||||
"name": "Custom_cache_key",
|
||||
"value": "自定义缓存key"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_images_to_cache",
|
||||
"value": "预加载图片到文件缓存"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_image_display_from_cache",
|
||||
"value": "从缓存获取图片显示"
|
||||
},
|
||||
{
|
||||
"name": "Test_single_request_header",
|
||||
"value": "测试单个请求头"
|
||||
},
|
||||
{
|
||||
"name": "Test_write_cache_strategy",
|
||||
"value": "测试写入缓存策略"
|
||||
},
|
||||
{
|
||||
"name": "Image_Transformation",
|
||||
"value": "图片变换"
|
||||
},
|
||||
{
|
||||
"name": "Different_ObjectFit",
|
||||
"value": "不同的ObjectFit"
|
||||
},
|
||||
{
|
||||
"name": "Test_image_loading_success_or_failure_events",
|
||||
"value": "测试图片加载成功/失败事件"
|
||||
},
|
||||
{
|
||||
"name": "Test_removing_image_cache_interface",
|
||||
"value": "测试移除图片缓存接口"
|
||||
},
|
||||
{
|
||||
"name": "Test_error_image_display",
|
||||
"value": "测试错误图显示"
|
||||
},
|
||||
{
|
||||
"name": "Display_the_first_frame",
|
||||
"value": "动画显示第一帧"
|
||||
},
|
||||
{
|
||||
"name": "Display_the_last_frame",
|
||||
"value": "动画显示最后一帧"
|
||||
},
|
||||
{
|
||||
"name": "Play",
|
||||
"value": "播放"
|
||||
},
|
||||
{
|
||||
"name": "Pause",
|
||||
"value": "暂停"
|
||||
},
|
||||
{
|
||||
"name": "Stop",
|
||||
"value": "停止"
|
||||
},
|
||||
{
|
||||
"name": "Infinite_loop",
|
||||
"value": "无限循环"
|
||||
},
|
||||
{
|
||||
"name": "Play_once",
|
||||
"value": "播放一次"
|
||||
},
|
||||
{
|
||||
"name": "Play_twice",
|
||||
"value": "播放两次"
|
||||
},
|
||||
{
|
||||
"name": "Local_SVG",
|
||||
"value": "本地资源SVG图片"
|
||||
},
|
||||
{
|
||||
"name": "Under_context_file",
|
||||
"value": "本地context files下文件"
|
||||
},
|
||||
{
|
||||
"name": "Network_images",
|
||||
"value": "网络图片"
|
||||
},
|
||||
{
|
||||
"name": "Custom_network_download",
|
||||
"value": "自定义下载"
|
||||
},
|
||||
{
|
||||
"name": "PixelMap_loads_images",
|
||||
"value": "PixelMap加载图片"
|
||||
},
|
||||
{
|
||||
"name": "Enlarge",
|
||||
"value": "放大"
|
||||
},
|
||||
{
|
||||
"name": "Reduce",
|
||||
"value": "缩小"
|
||||
},
|
||||
{
|
||||
"name": "Click_on_add",
|
||||
"value": "点击尺寸加50"
|
||||
},
|
||||
{
|
||||
"name": "Click_on_reduce",
|
||||
"value": "点击尺寸减50"
|
||||
},
|
||||
{
|
||||
"name": "The_key_fixed_1",
|
||||
"value": "key固定为 1"
|
||||
},
|
||||
{
|
||||
"name": "The_key_changes_timestamp",
|
||||
"value": "key每次变化:时间戳"
|
||||
},
|
||||
{
|
||||
"name": "Load",
|
||||
"value": "加载"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_images_to_file_cache_using_URL",
|
||||
"value": "url预加载图片到文件缓存"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_images_to_file_cache_using_option",
|
||||
"value": "option预加载图片到文件缓存"
|
||||
},
|
||||
{
|
||||
"name": "Load_image_offline_after_preloading",
|
||||
"value": "加载图片(预加载后可断网加载)"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_GIF",
|
||||
"value": "预加载gif图"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_GIF_from_memory",
|
||||
"value": "内存缓存获取gif"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_GIF_from_disk",
|
||||
"value": "文件缓存获取gif"
|
||||
},
|
||||
{
|
||||
"name": "Preloading_static_images",
|
||||
"value": "预加载静态图"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_images_from_memory",
|
||||
"value": "内存缓存获取"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_images_from_disk",
|
||||
"value": "文件缓存获取"
|
||||
},
|
||||
{
|
||||
"name": "Write_memory_and_file",
|
||||
"value": "写入内存文件缓存"
|
||||
},
|
||||
{
|
||||
"name": "Write_memory",
|
||||
"value": "写入内存缓存"
|
||||
},
|
||||
{
|
||||
"name": "Write_file",
|
||||
"value": "写入文件缓存"
|
||||
},
|
||||
{
|
||||
"name": "Main_image_Fill",
|
||||
"value": "主图Fill拉伸填充"
|
||||
},
|
||||
{
|
||||
"name": "Maintain_proportion_filling",
|
||||
"value": "占位图Contain保持比例填充"
|
||||
},
|
||||
{
|
||||
"name": "Error_graph_None",
|
||||
"value": "错误图None不变化"
|
||||
},
|
||||
{
|
||||
"name": "Test_failure_success",
|
||||
"value": "测试失败/成功场景"
|
||||
},
|
||||
{
|
||||
"name": "Custom_download_failed",
|
||||
"value": "自定义下载失败"
|
||||
},
|
||||
{
|
||||
"name": "Retrieve_media_gallery",
|
||||
"value": "获取媒体图库的uri用ImageKnife展示"
|
||||
},
|
||||
{
|
||||
"name": "Click_load_Uri",
|
||||
"value": "点击加载Uri并展示"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user