js/splitimage2.js
/* Uses Lanczos2 for rescaling. In-browser too blurry. Lanczos3 too slow. */
Uses Lanczos2 for rescaling. In-browser too blurry. Lanczos3 too slow.
Uses Lanczos2 for rescaling . In - browser too blurry . Lanczos3 too slow .
function processCanvasScale(canvas, choseSide) {
    if (choseSide) {
        scaleCanvas(canvas, choseSide);
    } else {
        scaleCanvas(canvases.right, 'right');
        scaleCanvas(canvases.left, 'left');
    }
    function scaleCanvas(inCanvas, side) {
        var scale = getSelValue(scaleSel, 'value');
        var outCnvs = canvases[side + 'Scaled'];
        if ( scale == 1 ) {
            viewOptions.scale = '';
            prepCanvas(100, 100, outCnvs);
            return setSize(inCanvas, side);
        }
        var width = Math.round(inCanvas.width * scale);
        var height = Math.round(inCanvas.height * scale);
        viewOptions.scale = '*' + getSelValue(scaleSel, 'ratio');
        prepCanvas(width, height, outCnvs);
		if (getSelValue(aaSel, 'value') == 'picaAA') {
			window.pica.WW = true;
			window.pica.resizeCanvas(inCanvas, outCnvs,
				{ quality: 2, alpha: false, unsharpAmount: 0,
				  unsharpThreshold: 0, transferable: true },
				function() { setSize(outCnvs, side); }
			);
		} else {
			var ctx = outCnvs.getContext("2d");
			if (getSelValue(aaSel, 'value') == 'noAA') {
				ctx.imageSmoothingEnabled = false;
			}
			ctx.drawImage(inCanvas, 0, 0, width, height);
			return setSize(outCnvs, side);
		}
    }
}
function processCanvasScale ( canvas , choseSide ) { if ( choseSide ) { scaleCanvas ( canvas , choseSide ) ; } else { scaleCanvas ( canvases . right , 'right' ) ; scaleCanvas ( canvases . left , 'left' ) ; } function scaleCanvas ( inCanvas , side ) { var scale = getSelValue ( scaleSel , 'value' ) ; var outCnvs = canvases [ side + 'Scaled' ] ; if ( scale == 1 ) { viewOptions . scale = '' ; prepCanvas ( 100 , 100 , outCnvs ) ; return setSize ( inCanvas , side ) ; } var width = Math . round ( inCanvas . width * scale ) ; var height = Math . round ( inCanvas . height * scale ) ; viewOptions . scale = '*' + getSelValue ( scaleSel , 'ratio' ) ; prepCanvas ( width , height , outCnvs ) ; if ( getSelValue ( aaSel , 'value' ) == 'picaAA' ) { window . pica . WW = true ; window . pica . resizeCanvas ( inCanvas , outCnvs , { quality : 2 , alpha : false , unsharpAmount : 0 , unsharpThreshold : 0 , transferable : true } , function ( ) { setSize ( outCnvs , side ) ; } ) ; } else { var ctx = outCnvs . getContext ( "2d" ) ; if ( getSelValue ( aaSel , 'value' ) == 'noAA' ) { ctx . imageSmoothingEnabled = false ; } ctx . drawImage ( inCanvas , 0 , 0 , width , height ) ; return setSize ( outCnvs , side ) ; } } }
Uses Lanczos2 for rescaling.
Uses Lanczos2 for rescaling .
// Process only one side // Process both sides at once