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