Posted By

adrianparr on 03/03/10


Tagged

red colour color RGB shift bitwise as3 Blue Green


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


AS3 Convert RGB Values to a Colour Using Bitwise Shift


 / Published in: ActionScript 3
 

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

  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

Report this snippet  

You need to login to post a comment.