| 114 | } |
| 115 | |
| 116 | String Color::ToHexString() const |
| 117 | { |
| 118 | static const Char* digits = TEXT("0123456789ABCDEF"); |
| 119 | |
| 120 | const byte r = static_cast<byte>(R * MAX_uint8); |
| 121 | const byte g = static_cast<byte>(G * MAX_uint8); |
| 122 | const byte b = static_cast<byte>(B * MAX_uint8); |
| 123 | const byte a = static_cast<byte>(A * MAX_uint8); |
| 124 | |
| 125 | Char result[8]; |
| 126 | |
| 127 | result[0] = digits[r >> 4 & 0x0f]; |
| 128 | result[1] = digits[r & 0x0f]; |
| 129 | |
| 130 | result[2] = digits[g >> 4 & 0x0f]; |
| 131 | result[3] = digits[g & 0x0f]; |
| 132 | |
| 133 | result[4] = digits[b >> 4 & 0x0f]; |
| 134 | result[5] = digits[b & 0x0f]; |
| 135 | |
| 136 | result[6] = digits[a >> 4 & 0x0f]; |
| 137 | result[7] = digits[a & 0x0f]; |
| 138 | |
| 139 | return String(result, 8); |
| 140 | } |
| 141 | |
| 142 | bool Color::IsTransparent() const |
| 143 | { |