qp_internal_formats.h 1.4 KB

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