Bit shifting in HSB mode

Quick question. Is there a way to get the hue value using big shifting? As a reference:

color argb = color(204, 204, 51, 255);
int a = (argb >> 24) & 0xFF;
int r = (argb >> 16) & 0xFF;  // Faster way of getting red(argb)
int g = (argb >> 8) & 0xFF;   // Faster way of getting green(argb)
int b = argb & 0xFF;          // Faster way of getting blue(argb)

My question is if there is a similar operation for HSB space. Or does anybody know how the RGB space is projected to HSB?





  • edited May 2017 Answer ✓

    I belive hue defaults to 360 rather than 255 so it might be a little tricky
    maybe colorMode(HSB, 255, 255, 255) will make it bitshiftable?
    I'm not sure if it'll work or be faster than hue() though
    edit: 255 could be 256 or i might be totally of but shit the same

  • edited May 2017 Answer ✓

    AFAIK, function color() always returns an aRGB color type value. :-@

Sign In or Register to comment.