Colors.h File Reference
#include <WString.h>
Include dependency graph for Colors.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  Graphics::PixelFormatStruct
 
struct  Graphics::PackedColor
 Colour in device pixel format. More...
 
union  Graphics::PixelBuffer
 Structure used to perform pixel format conversions. More...
 
struct  Graphics::PixelBuffer::BGRA32
 
struct  Graphics::PixelBuffer::RGB24
 
struct  Graphics::PixelBuffer::BGR24
 
struct  Graphics::PixelBuffer::RGB565
 

Namespaces

 Graphics
 

Macros

#define COLOR_NAME_MAP(XX)
 
#define GDIPLUS_COLOR_TABLE(XX)
 
#define XX(name, r, g, b)   name = getColorValue(r, g, b),
 
#define XX(name, argb)   name = argb,
 
#define PIXEL_FORMAT_MAP(XX)
 
#define XX(name, bytes, bpp, colorOrder, desc)   name = (bytes - 1) | ((bpp / 2) << 2) | (colorOrder << 7),
 

Enumerations

enum class  Graphics::Color : uint32_t { Graphics::None = 0 , Graphics::XX , Graphics::XX }
 Standard colour definitions. More...
 
enum  Graphics::ColorOrder { Graphics::orderRGB , Graphics::orderBGR }
 Order refers to colour order within bitstream. More...
 
enum class  Graphics::PixelFormat : uint8_t { Graphics::None , Graphics::XX }
 

Functions

constexpr uint32_t Graphics::getColorValue (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Obtain 24-bit colour value from red, green and blue components. More...
 
constexpr Color Graphics::makeColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Function to create a custom colour. More...
 
constexpr Color Graphics::makeColor (uint32_t color, uint8_t alpha=255)
 
constexpr Color Graphics::makeColor (Color color, uint8_t alpha)
 
constexpr uint8_t Graphics::getAlpha (Color color)
 
constexpr uint8_t Graphics::getRed (Color color)
 
constexpr uint8_t Graphics::getGreen (Color color)
 
constexpr uint8_t Graphics::getBlue (Color color)
 
bool Graphics::fromString (const char *s, Color &color)
 
bool Graphics::fromString (const String &s, Color &color)
 
uint8_t Graphics::getBytesPerPixel (PixelFormat format)
 Get number of bytes required to store a pixel in the given format. More...
 
PixelBuffer Graphics::pack (PixelBuffer src, PixelFormat format)
 Convert RGB colour into packed format. More...
 
PackedColor Graphics::pack (Color color, PixelFormat format)
 
PixelBuffer Graphics::unpack (PixelBuffer src, PixelFormat format)
 Convert packed colour into RGB. More...
 
Color Graphics::unpack (PackedColor packed, PixelFormat format)
 
Color Graphics::unpack (uint32_t packed, PixelFormat format)
 
size_t Graphics::writeColor (void *buffer, PackedColor color, PixelFormat format)
 Store a packed colour value into memory. More...
 
size_t Graphics::writeColor (void *buffer, Color color, PixelFormat format)
 
size_t Graphics::writeColor (void *buffer, PackedColor color, PixelFormat format, size_t count)
 Store a block of packed colours into memory. More...
 
size_t Graphics::writeColor (void *buffer, Color color, PixelFormat format, size_t count)
 
size_t Graphics::convert (const void *srcData, PixelFormat srcFormat, void *dstBuffer, PixelFormat dstFormat, size_t numPixels)
 Convert block of data from one pixel format to another. More...
 
String toString (Graphics::Color color)
 
String toString (Graphics::PackedColor color)
 
String toString (Graphics::PixelFormat format)
 

Macro Definition Documentation

◆ COLOR_NAME_MAP

#define COLOR_NAME_MAP (   XX)
Value:
XX(BLACK, 0, 0, 0) \
XX(NAVY, 0, 0, 128) \
XX(DARKGREEN, 0, 128, 0) \
XX(DARKCYAN, 0, 128, 128) \
XX(MAROON, 128, 0, 0) \
XX(PURPLE, 128, 0, 128) \
XX(OLIVE, 128, 128, 0) \
XX(LIGHTGREY, 192, 192, 192) \
XX(DARKGREY, 128, 128, 128) \
XX(BLUE, 0, 0, 255) \
XX(GREEN, 0, 255, 0) \
XX(CYAN, 0, 255, 255) \
XX(RED, 255, 0, 0) \
XX(MAGENTA, 255, 0, 255) \
XX(YELLOW, 255, 255, 0) \
XX(WHITE, 255, 255, 255) \
XX(ORANGE, 255, 165, 0) \
XX(GREENYELLOW, 173, 255, 47) \
XX(PINK, 255, 192, 203)
#define XX(name, r, g, b)
Definition: Colors.h:297

◆ GDIPLUS_COLOR_TABLE

#define GDIPLUS_COLOR_TABLE (   XX)

◆ PIXEL_FORMAT_MAP

#define PIXEL_FORMAT_MAP (   XX)
Value:
XX(RGB24, 3, 24, orderRGB, "24-bit RGB") \
XX(BGRA32, 4, 32, orderRGB, "32-bit ARGB") \
XX(BGR24, 3, 24, orderBGR, "24-bit BGR") \
XX(RGB565, 2, 16, orderRGB, "16-bit RGB 5/6/5")
@ orderBGR
Definition: Colors.h:287
@ orderRGB
Definition: Colors.h:287

◆ XX [1/3]

#define XX (   name,
  argb 
)    name = argb,

◆ XX [2/3]

#define XX (   name,
  bytes,
  bpp,
  colorOrder,
  desc 
)    name = (bytes - 1) | ((bpp / 2) << 2) | (colorOrder << 7),

◆ XX [3/3]

#define XX (   name,
  r,
  g,
 
)    name = getColorValue(r, g, b),

Function Documentation

◆ toString() [1/3]

String toString ( Graphics::Color  color)

◆ toString() [2/3]

String toString ( Graphics::PackedColor  color)

◆ toString() [3/3]

String toString ( Graphics::PixelFormat  format)