No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

olcPGE_Pixel.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef OLC_PGE_PIXEL
  2. #define OLC_PGE_PIXEL
  3. #include <cstdint>
  4. #include "olcPGE_Common.h"
  5. namespace olc {
  6. struct Pixel
  7. {
  8. union
  9. {
  10. uint32_t n = 0xFF000000;
  11. struct
  12. {
  13. uint8_t r; uint8_t g; uint8_t b; uint8_t a;
  14. };
  15. };
  16. Pixel();
  17. Pixel(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255);
  18. Pixel(uint32_t p);
  19. static Pixel CreateFromHSV(uint8_t h, uint8_t s, uint8_t v, uint8_t alpha = 255);
  20. enum Mode { NORMAL, MASK, ALPHA, CUSTOM };
  21. };
  22. // Some constants for symbolic naming of Pixels
  23. static const Pixel
  24. WHITE(255, 255, 255),
  25. GREY(192, 192, 192), DARK_GREY(128, 128, 128), VERY_DARK_GREY(64, 64, 64),
  26. RED(255, 0, 0), DARK_RED(128, 0, 0), VERY_DARK_RED(64, 0, 0),
  27. YELLOW(255, 255, 0), DARK_YELLOW(128, 128, 0), VERY_DARK_YELLOW(64, 64, 0),
  28. GREEN(0, 255, 0), DARK_GREEN(0, 128, 0), VERY_DARK_GREEN(0, 64, 0),
  29. CYAN(0, 255, 255), DARK_CYAN(0, 128, 128), VERY_DARK_CYAN(0, 64, 64),
  30. BLUE(0, 0, 255), DARK_BLUE(0, 0, 128), VERY_DARK_BLUE(0, 0, 64),
  31. MAGENTA(255, 0, 255), DARK_MAGENTA(128, 0, 128), VERY_DARK_MAGENTA(64, 0, 64),
  32. BLACK(0, 0, 0),
  33. BLANK(0, 0, 0, 0);
  34. //==================================================================================
  35. }
  36. #endif