Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let's say your bitmapdata is the flxg camera buffer:
- // number of colors (per channel)
- var numColors:Number = 3;
- var compress:Number = 256 / (numColors - 1);
- // reduce colors, bitmapdata will integerize them
- FlxG.camera.buffer.colorTransform(new Rectangle(0, 0, FlxG.width, FlxG.height), new ColorTransform(compress, compress, compress, 1, 0, 0, 0, 0));
- // expand spectrum back to 0 - 255 range
- FlxG.camera.buffer.colorTransform(new Rectangle(0, 0, FlxG.width, FlxG.height), new ColorTransform(1 / compress, 1 / compress, 1 / compress, 1, 0, 0, 0, 0));
Add Comment
Please, Sign In to add comment