Intermediate Level: Colour Functions
To read the colour of one pixel, use
uint16_t readPixel(uint16_t x1, uint1 6_t y1);
readPixel returns the 16-bits coded colour from the pixel at (x1, y1).
For Red-Green-Blue components to 16-bits coded colours conversion and back,
uint16_t setColour(uint8_t red, uint8_t green, uint8_t blue);
void splitColour(uint16_t rgb, uint8_t &red, uint8_t &green, uint8_t &blue); uint16_t halfColour(uint16_t rgb);
Because the colours are 16-bits coded, the following utilities may help:
- setColour converts red, green, blue values into a 16-bits colour
- splitColour just does the opposite
- halfColour halves the colour, very handy for buttons
Most commons colours are available in plain English constants:
whiteColour, blackColour, greyColour,
redColour, greenColour, blueColour,
yellowColour, OrangeColour, magentaColour, violetColour, cyanColour.