AS3 Convert RGB Values to a Colour Using Bitwise Shift


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var r:uint = 153;
  2. var g:uint = 0;
  3. var b:uint = 204;
  4. var colour:uint = r << 16 | g << 8 | b;
  5. trace("colour: "+colour);
  6.  
  7. // OUTPUT
  8. // colour: 10027212

URL: http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.