Advertisement
YellowAfterlife

Haxe Color abstract test

Jan 15th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.58 KB | None | 0 0
  1. import flash.display.Bitmap;
  2. import flash.display.BitmapData;
  3. import flash.geom.Rectangle;
  4. class Main {
  5.     public function new() {
  6.         var bit = new BitmapData(512, 512, true), cl:Color = Color.fromRGB(0x0);
  7.         for (b in 0 ... 16) {
  8.             for (r in 0 ... 16) {
  9.                 for (g in 0 ... 16) {
  10.                     bit.fillRect(new Rectangle(
  11.                         (b % 4) * 128 + r * 8,
  12.                         Std.int(b / 4) * 128 + g * 8,
  13.                         8, 8), cl);
  14.                     cl.g = cl.g + 16;
  15.                 }
  16.                 cl.r = cl.r + 16;
  17.             }
  18.             cl.b = cl.b + 16;
  19.         }
  20.         flash.Lib.current.addChild(new Bitmap(bit));
  21.     }
  22.     @:keep static function main() new Main();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement