about summary refs log tree commit diff
path: root/converter/other/pnmtopalm/gen_palm_colormap.c
blob: b71854b2309dd5ea02daec083cd726f0ec21495c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* gen_palm_colormap.c - generate a ppm file containing the default Palm colormap
 *
 * Bill Janssen  <bill@janssen.org>
 */

#include "pnm.h"

#include "palm.h"

int
main(int     argc,
     char ** argv) {

    Colormap const defaultMap = palmcolor_build_default_8bit_colormap();

    unsigned int i;
    
    printf("P3\n%d 1\n255\n", defaultMap->ncolors);

    for (i = 0; i < defaultMap->ncolors; ++i) {
        Color_s const current = defaultMap->color_entries[i];

        printf("%u %u %u\n",
               (unsigned char)(current >> 16),
               (unsigned char)(current >>  8),
               (unsigned char)(current >>  0));
    }

    return 0;
}