forked from floraachy/ImageKnife
降采样功demo文字国际化
Signed-off-by: tsm <tianshuangming@h-partners.com>
This commit is contained in:
parent
5fa004afc0
commit
29e0df8d2b
|
@ -1,7 +1,7 @@
|
|||
|
||||
## 3.1.1-rc.1
|
||||
- Photo reduction sampling
|
||||
## 3.1.1-rc.0
|
||||
- 重构代码:抽取ImageKnifeDispatcher子线程requestJob相关代码到ImageKnifeLoader中,降低函数复杂度
|
||||
- 降采样功能
|
||||
## 3.1.0
|
||||
- 部分静态webp图片有delay属性导致识别成动图,改用getFrameCount识别
|
||||
- 修复加载错误图后未去请求排队队列中的请求
|
||||
|
|
|
@ -165,7 +165,9 @@ struct DownSamplePage {
|
|||
console.error("Failed to create PixelMap")
|
||||
});
|
||||
}
|
||||
|
||||
getResourceString(res:Resource){
|
||||
return getContext().resourceManager.getStringSync(res.id)
|
||||
}
|
||||
build() {
|
||||
Scroll() {
|
||||
Column() {
|
||||
|
@ -178,12 +180,12 @@ struct DownSamplePage {
|
|||
.onClick(() => {
|
||||
this.updateImageKnifeOption(item.value)
|
||||
})
|
||||
Text("降采样规格:" + item.value).fontSize(20)
|
||||
Text(this.getResourceString($r('app.string.Sampling_pecification'))+ item.value).fontSize(20)
|
||||
}
|
||||
}, (item: SamplingType) => JSON.stringify(item))
|
||||
Column() {
|
||||
Text(`未降采样大小:${this.beforeSampling}`).fontSize(20)
|
||||
Text(`降采样后大小:${this.afterSampling}`).fontSize(20)
|
||||
Text(`${this.getResourceString($r('app.string.Unreal_samples'))}:${this.beforeSampling}`).fontSize(20)
|
||||
Text(`${ this.getResourceString($r('app.string.After_the_sampling'))}:${this.afterSampling}`).fontSize(20)
|
||||
}
|
||||
|
||||
ImageKnifeComponent({
|
||||
|
|
|
@ -371,6 +371,18 @@
|
|||
{
|
||||
"name": "Image_Downsampling_Functionality",
|
||||
"value": "Downscale Image effect"
|
||||
},
|
||||
{
|
||||
"name": "Sampling_pecification",
|
||||
"value": "降采样规格"
|
||||
},
|
||||
{
|
||||
"name": "Unreal_samples",
|
||||
"value": "未降采样大小"
|
||||
},
|
||||
{
|
||||
"name": "After_the_sampling",
|
||||
"value": "降采样后大小"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -367,6 +367,18 @@
|
|||
{
|
||||
"name": "Image_Downsampling_Functionality",
|
||||
"value": "降采样功能"
|
||||
},
|
||||
{
|
||||
"name": "Sampling_pecification",
|
||||
"value": "降采样规格"
|
||||
},
|
||||
{
|
||||
"name": "Unreal_samples",
|
||||
"value": "未降采样大小"
|
||||
},
|
||||
{
|
||||
"name": "After_the_sampling",
|
||||
"value": "降采样后大小"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -44,9 +44,9 @@ export class FitCenter implements BaseDownsampling {
|
|||
/*宽高进行等比缩放宽高里面最小的比例先放进去
|
||||
然后再更据原图的缩放比去适配另一边*/
|
||||
|
||||
export class CenterOutside implements BaseDownsampling {
|
||||
export class AtLeast implements BaseDownsampling {
|
||||
getName() {
|
||||
return "CenterOutside"
|
||||
return "AtLeast"
|
||||
}
|
||||
|
||||
getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number): number {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import {
|
||||
AtMost,
|
||||
CenterInside,
|
||||
CenterOutside,
|
||||
AtLeast,
|
||||
DownsampleStrategy,
|
||||
FitCenter,
|
||||
} from './DownsampleStartegy';
|
||||
|
@ -65,7 +65,7 @@ export class Downsampler {
|
|||
case DownsampleStrategy.CENTER_OUTSIDE_QUALITY:
|
||||
return new CenterInside();
|
||||
case DownsampleStrategy.AT_LEAST:
|
||||
return new CenterOutside();
|
||||
return new AtLeast();
|
||||
default:
|
||||
throw new Error('Unsupported downsampling strategy');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue