Answer: Each color has a designated RGB value. The integer value (long) may be calculated for the color parameter, then specified in the database table, through the following formula:
For example, blue has a RGB value of (0, 0, 255), therefore its color parameter is 0 + 0 * 256 + 255 * 2562 = 16711680.
You may find the RGB value corresponding to the color parameter by utilizing the modulo operation as follows:
where / is integer division operator.
Related Incidents:
|