CanvasScript3
>
Tests
> BitmapData - PalletMap
Code
var stage = new Stage("canvas", 420, 500, 30); var loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e) { var bitmap = loader.content; var bitmapdata = bitmap.bitmapData; var bottomHalf = new Rectangle(0, 250, 420, 250); var point = new Point(0, bottomHalf.y); var redArray = new Array(256); var greenArray = new Array(256); for(var i = 0; i < 255; i++) { redArray[i] = 0x00000000; greenArray[i] = 0x00000000; } redArray[0xFF] = 0x0000FF00; greenArray[0xFF] = 0x00FF0000; bitmapdata.paletteMap(bitmapdata, bottomHalf, point, redArray, greenArray); }); loader.load(new URLRequest('img/photo01.jpg')); stage.addChild(loader);
Canvas
Output