/* * Pixastic Lib - Blur Fast - v0.1.0 * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/ * MIT License [http://www.opensource.org/licenses/mit-license.php] */ Pixastic.Actions.blurfast = { process : function(params) { var amount = parseFloat(params.options.amount)||0; amount = Math.max(0,Math.min(5,amount)); if (Pixastic.Client.hasCanvas()) { var rect = params.options.rect; var ctx = params.canvas.getContext("2d"); ctx.save(); ctx.beginPath(); ctx.moveTo(rect.left,rect.top); ctx.lineTo(rect.left+rect.width,rect.top); ctx.lineTo(rect.left+rect.width,rect.top+rect.height); ctx.lineTo(rect.left,rect.top+rect.height); ctx.lineTo(rect.left,rect.top); ctx.closePath(); ctx.clip(); var scale = 2; var smallWidth = Math.round(params.width / scale); var smallHeight = Math.round(params.height / scale); var copy = document.createElement("canvas"); copy.width = smallWidth; copy.height = smallHeight; var clear = true; var steps = Math.round(amount * 20); var copyCtx = copy.getContext("2d"); for (var i=0;i