21 #ifndef GR_COLOUR16__H
22 #define GR_COLOUR16__H
49 inline unsigned r(
unsigned n ) {
return (n==8U) ? 1U : ( (n&4U) ? ((n/8U)+1U) : 0U ) ; }
50 inline unsigned g(
unsigned n ) {
return (n==7U) ? 2U : ( (n==8U) ? 1U : ( (n&2U) ? ((n/8U)+1U) : 0U ) ) ; }
51 inline unsigned b(
unsigned n ) {
return ((n&1U) << ((n>8U)?1:0) ) + (n==7U||n==8U) ; }
52 inline unsigned _256(
unsigned n ) {
return n == 0U ? 0U : ( n == 1U ? 127U : 255U ) ; }
53 inline unsigned r256(
unsigned n ) {
return _256(r(n)) ; }
54 inline unsigned g256(
unsigned n ) {
return _256(g(n)) ; }
55 inline unsigned b256(
unsigned n ) {
return _256(b(n)) ; }