diff options
author | June McEnroe <june@causal.agency> | 2018-02-04 12:11:48 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-02-04 12:11:48 -0500 |
commit | 2164cdc78797d18755cd1a30a1236d1b2ec748c7 (patch) | |
tree | 3c4b51f35c6e3d8aec17173a9592f952ef804c2c | |
parent | Add 4-bit RGB to gfxx (diff) | |
download | src-2164cdc78797d18755cd1a30a1236d1b2ec748c7.tar.gz src-2164cdc78797d18755cd1a30a1236d1b2ec748c7.zip |
Add palette sampling to gfxx
-rw-r--r-- | bin/gfxx.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/gfxx.c b/bin/gfxx.c index 46b4cebc..777dc22c 100644 --- a/bin/gfxx.c +++ b/bin/gfxx.c @@ -264,6 +264,13 @@ extern void draw(uint32_t *buf, size_t xres, size_t yres) { } } +static void samplePalette(void) { + size_t temp = scale; + scale = 1; + draw(palette, 256, 1); + scale = temp; +} + extern void input(char in) { size_t pixel = (bits + 7) / 8; size_t row = width * bits / 8; @@ -271,6 +278,7 @@ extern void input(char in) { case 'q': printOpts(); exit(EX_OK); break; case '[': if (!space--) space = COLOR__MAX - 1; break; case ']': if (++space == COLOR__MAX) space = 0; + break; case 'p': samplePalette(); break; case '{': if (bits > 16) bits -= 8; else bits = (bits + 1) / 2; break; case '}': if (bits < 16) bits *= 2; else if (bits < 32) bits += 8; break; case 'e': endian ^= true; |