Guest User

Untitled

a guest
Jun 25th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let's say your bitmapdata is the flxg camera buffer:
  2.  
  3. // number of colors (per channel)
  4. var numColors:Number = 3;
  5. var compress:Number = 256 / (numColors - 1);
  6.  
  7. // reduce colors, bitmapdata will integerize them
  8. FlxG.camera.buffer.colorTransform(new Rectangle(0, 0, FlxG.width, FlxG.height), new ColorTransform(compress, compress, compress, 1, 0, 0, 0, 0));
  9.  
  10. // expand spectrum back to 0 - 255 range
  11. 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