修改demo
This commit is contained in:
parent
e79557cf7c
commit
122c01a166
|
@ -40,19 +40,9 @@ struct Index {
|
||||||
uri: 'pages/TestCommonImage',
|
uri: 'pages/TestCommonImage',
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button($r('app.string.Image_Downsampling_Functionality')).margin({top:10}).onClick(()=>{
|
Button(this.getResourceString($r('app.string.Multiple_images')) + " + reuse + LazyForeach").margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
uri: 'pages/DownSamplePage',
|
uri: 'pages/UserPage',
|
||||||
});
|
|
||||||
})
|
|
||||||
Button($r('app.string.Test_Task_error')).margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/TestTaskResourcePage',
|
|
||||||
});
|
|
||||||
})
|
|
||||||
Button($r('app.string.Test_HSP')).margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/TestHspPreLoadImage',
|
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -62,22 +52,9 @@ struct Index {
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button($r('app.string.Test_custom_download')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Image_Downsampling_Functionality')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
uri: 'pages/TestSetCustomImagePage',
|
uri: 'pages/DownSamplePage',
|
||||||
|
|
||||||
});
|
|
||||||
})
|
|
||||||
Button(this.getResourceString($r('app.string.Multiple_images')) + " + LazyForEach").margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/ManyPhotoShowPage',
|
|
||||||
|
|
||||||
});
|
|
||||||
})
|
|
||||||
Button(this.getResourceString($r('app.string.Multiple_images')) + " + reuse + LazyForeach").margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/UserPage',
|
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button($r('app.string.Display_long_image')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Display_long_image')).margin({top:10}).onClick(()=>{
|
||||||
|
@ -86,17 +63,25 @@ struct Index {
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button($r('app.string.Image_scaling')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Image_Transformation')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
uri: 'pages/TransformPage',
|
uri: 'pages/ImageTransformation',
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
Button($r('app.string.Test_media_URL')).margin({top:10}).onClick(()=>{
|
||||||
|
router.push({
|
||||||
|
uri: 'pages/dataShareUriLoadPage',
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button(this.getResourceString($r('app.string.Message_list')) + " + List").margin({top:10}).onClick(()=>{
|
Button($r('app.string.Different_ObjectFit')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
uri: 'pages/TestImageFlash',
|
uri: 'pages/ObjectFitPage',
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
Button($r('app.string.Custom_cache_key')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Custom_cache_key')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
|
@ -104,6 +89,39 @@ struct Index {
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
Button($r('app.string.Test_image_loading_success_or_failure_events')).margin({top:10}).onClick(()=>{
|
||||||
|
router.push({
|
||||||
|
uri: 'pages/LoadStatePage',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Button($r('app.string.Image_scaling')).margin({top:10}).onClick(()=>{
|
||||||
|
router.push({
|
||||||
|
uri: 'pages/TransformPage',
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
Button($r('app.string.Test_HSP')).margin({top:10}).onClick(()=>{
|
||||||
|
router.push({
|
||||||
|
uri: 'pages/TestHspPreLoadImage',
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
Button($r('app.string.Test_custom_download')).margin({top:10}).onClick(()=>{
|
||||||
|
router.push({
|
||||||
|
uri: 'pages/TestSetCustomImagePage',
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
Button(this.getResourceString($r('app.string.Message_list')) + " + List").margin({top:10}).onClick(()=>{
|
||||||
|
router.push({
|
||||||
|
uri: 'pages/TestImageFlash',
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
Button($r('app.string.Preloading_images_to_cache')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Preloading_images_to_cache')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
uri: 'pages/TestPrefetchToFileCache',
|
uri: 'pages/TestPrefetchToFileCache',
|
||||||
|
@ -128,27 +146,7 @@ struct Index {
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button($r('app.string.Image_Transformation')).margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/ImageTransformation',
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
Button($r('app.string.Different_ObjectFit')).margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/ObjectFitPage',
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
Button($r('app.string.Test_image_loading_success_or_failure_events')).margin({top:10}).onClick(()=>{
|
|
||||||
router.push({
|
|
||||||
uri: 'pages/LoadStatePage',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
Button($r('app.string.Test_removing_image_cache_interface')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Test_removing_image_cache_interface')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
|
@ -161,13 +159,11 @@ struct Index {
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
Button($r('app.string.Test_media_URL')).margin({top:10}).onClick(()=>{
|
Button($r('app.string.Test_Task_error')).margin({top:10}).onClick(()=>{
|
||||||
router.push({
|
router.push({
|
||||||
uri: 'pages/dataShareUriLoadPage',
|
uri: 'pages/TestTaskResourcePage',
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
} .width('100%')
|
} .width('100%')
|
||||||
.height('100%')
|
.height('100%')
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class AtMost implements BaseDownsampling {
|
||||||
greaterOrEqualSampleSize = lesserOrEqualSampleSize <<= 1;
|
greaterOrEqualSampleSize = lesserOrEqualSampleSize <<= 1;
|
||||||
}
|
}
|
||||||
greaterOrEqualSampleSize = lesserOrEqualSampleSize << (lesserOrEqualSampleSize < maxIntegerFactor ? 1 : 0)
|
greaterOrEqualSampleSize = lesserOrEqualSampleSize << (lesserOrEqualSampleSize < maxIntegerFactor ? 1 : 0)
|
||||||
//返回缩放因子
|
|
||||||
let outSize: Size = {
|
let outSize: Size = {
|
||||||
width: round((1 / greaterOrEqualSampleSize) * sourceWidth),
|
width: round((1 / greaterOrEqualSampleSize) * sourceWidth),
|
||||||
height:round((1 / greaterOrEqualSampleSize) * sourceHeight)
|
height:round((1 / greaterOrEqualSampleSize) * sourceHeight)
|
||||||
|
|
Loading…
Reference in New Issue