qp_internal_formats.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2021 Nick Brassel (@tzarc)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "qp_internal.h"
  5. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  6. // Quantum Painter pixel formats
  7. // Datatype containing a pixel's color. The internal member used is dependent on the external context.
  8. typedef union QP_PACKED qp_pixel_t {
  9. uint8_t mono;
  10. uint8_t palette_idx;
  11. struct QP_PACKED {
  12. uint8_t h;
  13. uint8_t s;
  14. uint8_t v;
  15. } hsv888;
  16. struct QP_PACKED {
  17. uint8_t r;
  18. uint8_t g;
  19. uint8_t b;
  20. } rgb888;
  21. uint16_t rgb565;
  22. uint32_t dummy;
  23. } qp_pixel_t;
  24. _Static_assert(sizeof(qp_pixel_t) == 4, "Invalid size for qp_pixel_t");
  25. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  26. // Quantum Painter image format
  27. typedef enum qp_image_format_t {
  28. // Pixel formats available in the QGF frame format
  29. GRAYSCALE_1BPP = 0x00,
  30. GRAYSCALE_2BPP = 0x01,
  31. GRAYSCALE_4BPP = 0x02,
  32. GRAYSCALE_8BPP = 0x03,
  33. PALETTE_1BPP = 0x04,
  34. PALETTE_2BPP = 0x05,
  35. PALETTE_4BPP = 0x06,
  36. PALETTE_8BPP = 0x07,
  37. } qp_image_format_t;
  38. typedef enum painter_compression_t { IMAGE_UNCOMPRESSED, IMAGE_COMPRESSED_RLE } painter_compression_t;