Color.h 756 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #ifndef COLOR_H_
  3. #define COLOR_H_
  4. #include <cinttypes>
  5. struct RGBColor;
  6. struct RGBColorf;
  7. /*!
  8. * \brief Represents a color in the sRGB color space with 8-bit channels
  9. */
  10. struct RGBColor
  11. {
  12. uint8_t r, g, b;
  13. inline RGBColor(void) :
  14. r{ 0 }, g{ 0 }, b{ 0 }
  15. {
  16. }
  17. inline RGBColor(uint8_t r, uint8_t g, uint8_t b) :
  18. r{ r }, g{ g }, b{ b }
  19. {
  20. }
  21. RGBColor(const RGBColorf& rgb);
  22. };
  23. /*!
  24. * \brief Represents a color in a linear RGB color space with 32-bit floating
  25. * point numbers as channels.
  26. */
  27. struct RGBColorf
  28. {
  29. float r, g, b;
  30. inline RGBColorf(float r, float g, float b) :
  31. r{ r }, g{ g }, b{ b }
  32. {
  33. }
  34. RGBColorf(const RGBColor& srgb);
  35. };
  36. #endif // COLOR_H_