logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

qp_internal_formats.h (1594B)


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