/* Correctrix removes barrel and perspective distortion from photographs with PHP's Imagick extension Copyright (C) 2010 by Lee Traynor lee.traynor@skeptic.de This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The full text of the GNU GPL can be found at . */ function tick () { if (!document.forms[0].fourpoint.checked) document.forms[0].fourpoint.checked = true; } function resetori () { document.getElementById ("origin").innerHTML = "Origin not set"; theform = document.forms[0]; theform.orix.value = ""; theform.oriy.value = ""; for (i = 0; i < 4; i++) { theform.elements[(4 + i * 2)].value = ""; theform.elements[(5 + i * 2)].value = ""; } theform.rotate.value = 0; theform.db.value = 0; theform.sx.value = 0; theform.sy.value = 0; theform.fourpoint.checked = false; } function coords (e) { if (!e) e = window.event; theform = document.forms[0]; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX; posy = e.clientY; } if (theform.orix.value == "" && theform.oriy.value == "") { theform.orix.value = posx; theform.oriy.value = posy; document.getElementById ("origin").innerHTML = "Origin set: " + posx + ", " + posy; } else { entry = false; for (i = 0; i < 4; i++) { if (!entry && (theform.elements[(4 + i * 2)].value == "" || theform.elements[(4 + i * 2)].value == "0")) { theform.elements[(4 + i * 2)].value = 2 * Math.round ((parseInt (posx) - parseInt (theform.orix.value)) * theform.scale.value); theform.elements[(5 + i * 2)].value = 2 * Math.round ((parseInt (posy) - parseInt (theform.oriy.value)) * theform.scale.value); entry = true; } } theform.fourpoint.checked = true; } } function check_lock () { if (document.forms[0].stretchlock.checked) document.forms[0].stretchy.value = document.forms[0].stretchx.value; }