提交 Downsampler 类 报错修改
This commit is contained in:
parent
22f79c3588
commit
9c40365fc4
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* asdfasdfasdfasdfasdf*/
|
||||
import { CenterOutside, FitCenter, SampleSizeRounding } from './Downsamplestrategy';
|
||||
import { FileTypeutil } from '../../utits/Fitetypeutit';
|
||||
import { Request0ption } from '../../Requestoption';
|
||||
import { FileTypeUtil } from '../../utits/Fitetypeutit';
|
||||
import { RequestOption } from '../../Requestoption';
|
||||
let TAG = 'downsampling'
|
||||
export class Downsampler {
|
||||
calculateScaling(
|
||||
|
@ -37,9 +37,10 @@ export class Downsampler {
|
|||
let exactScaleFactor: number = FitCenter.getScaleFactor(orientedSourceWidth, orientedSourceHeight, targetWidth, targetHeight)
|
||||
if (exactScaleFactor <= 0) {
|
||||
throw new Error("Cannot round with exactScaleFactor");
|
||||
}
|
||||
console.log('exactScaleFactor', exactScaleFactor)
|
||||
/*安卓的模式*/
|
||||
let rounding: SampleSizeRounding = Center0utside.getSampleSizeRounding(orientedSourceWidth, orientedSourceHeight, targetWidth, targetHeight)
|
||||
let rounding: SampleSizeRounding = CenterOutside.getSampleSizeRounding(orientedSourceWidth, orientedSourceHeight, targetWidth, targetHeight)
|
||||
if (rounding == null) {
|
||||
throw new Error("Cannot round with null rounding");
|
||||
}
|
||||
|
@ -118,8 +119,9 @@ export class Downsampler {
|
|||
round(value: number): number {
|
||||
return Math.floor(value +0.5);
|
||||
}
|
||||
isRotationRequired(degreesToRotate: number): boolean{
|
||||
isRotationRequired(degreesToRotate: number): boolean {
|
||||
return degreesToRotate == 90 || degreesToRotate == 270;
|
||||
}
|
||||
// isScaling(options: ESObject): boolean {
|
||||
// return options.inTargetDensity >0
|
||||
// && options.inDensity>0
|
||||
|
@ -135,4 +137,4 @@ export class Downsampler {
|
|||
let difference = adjustedScaleFactor / scaleFactorWithError;
|
||||
return this.round(difference * targetDensity);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue