| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include "netpbm/ppm.h" |
| 7 |
#include "netpbm/pm_c_util.h" |
| 8 |
|
| 9 |
#include "palm.h" |
| 10 |
|
| 11 |
int |
| 12 |
main(int argc, |
| 13 |
char ** argv) { |
| 14 |
|
| 15 |
Colormap defaultMap; |
| 16 |
unsigned int i; |
| 17 |
pixel pix; |
| 18 |
|
| 19 |
defaultMap = palmcolor_build_default_8bit_colormap(); |
| 20 |
qsort (defaultMap->color_entries, defaultMap->ncolors, |
| 21 |
sizeof(Color_s), palmcolor_compare_indices); |
| 22 |
|
| 23 |
ppm_writeppminit(stdout, 256, 1, 255, TRUE); |
| 24 |
|
| 25 |
for (i = 0; i < defaultMap->ncolors; ++i) { |
| 26 |
Color_s const current = defaultMap->color_entries[i]; |
| 27 |
|
| 28 |
PPM_ASSIGN(pix, |
| 29 |
(current >> 16) & 0xff, |
| 30 |
(current >> 8) & 0xff, |
| 31 |
(current >> 0) & 0xff); |
| 32 |
|
| 33 |
ppm_writeppmrow(stdout, &pix, 1, 255, TRUE); |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
PPM_ASSIGN(pix, 0, 0, 0); |
| 40 |
for (i = 0; i < 256 - defaultMap->ncolors; ++i) { |
| 41 |
ppm_writeppmrow(stdout, &pix, 1, 255, TRUE); |
| 42 |
} |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|