2024-10-03 18:57:44 +03:00
|
|
|
#ifndef _CC_COMMON_H_
|
|
|
|
#define _CC_COMMON_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef uint8_t GlyphBitmap[11];
|
|
|
|
|
|
|
|
struct rgba { uint8_t r, g, b, a; };
|
|
|
|
union color {
|
|
|
|
struct rgba rgba;
|
|
|
|
uint32_t v;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct palette {
|
|
|
|
const uint8_t count;
|
|
|
|
union color colors[] __attribute__((counted_by(count)));
|
|
|
|
};
|
|
|
|
|
|
|
|
#define LENGTHOF(...) (sizeof(__VA_ARGS__) / sizeof(*(__VA_ARGS__)))
|
|
|
|
#define PALETTE(...) { .count = LENGTHOF((union color[]){__VA_ARGS__}), .colors = {__VA_ARGS__} }
|
|
|
|
|
2024-10-04 00:45:25 +03:00
|
|
|
struct palette *cc_alloc_palette(uint8_t count);
|
|
|
|
struct palette *cc_realloc_palette(struct palette* ptr, uint8_t count);
|
|
|
|
void cc_assign_palette(struct palette *dst, const struct palette *src);
|
|
|
|
|
2024-10-03 18:57:44 +03:00
|
|
|
const extern GlyphBitmap cc_font_atlas[256];
|
|
|
|
const extern struct palette cc_default_palette, cc_default_gray_palette;
|
|
|
|
|
|
|
|
#endif
|