In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: Simple Fast Bilinear Color Interpolation

/**
 * Copyright yonatan ( http://wonderfl.net/user/yonatan )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lC21
 */

// forked from Bruce_Jawn's Simple Fast Bilinear Color Interpolation

package {
    import flash.display.*;
	import flash.geom.*;

    public class SFBilinearColorInterpolation extends Sprite {
		public function SFBilinearColorInterpolation() {
			addChild(new Bitmap(interpolate4(465, 465, 0xffffff, 0x0000ff, 0xff0000, 0x00ff00)));
		}
			
		public function interpolate4(width:uint, height:uint, tl:uint, tr:uint, bl:uint, br:uint):BitmapData {
			var bmd:BitmapData = new BitmapData(2, 2, false);
			var out:BitmapData = new BitmapData(width, height, false);
			bmd.setPixel(0, 0, tl);
			bmd.setPixel(0, 1, tr);
			bmd.setPixel(1, 0, bl);
			bmd.setPixel(1, 1, br);
			var mtx:Matrix = new Matrix;
			mtx.translate(-0.5, -0.5);
			mtx.scale(width, height);
			out.draw(bmd, mtx, null, null, null, true);
			return out;
		}
	}
}