00001
00002 #include <stdio.h>
00003
00004
00005
00006
00007
00008
00009
00010 make_colormap (unsigned char* red, unsigned char* green, unsigned char* blue)
00011 {
00012 int i;
00013
00014 for (i = 0; i < 32; i++) {
00015 red[i] = 0;
00016 green[i] = 0;
00017 blue[i] = 8*i;
00018 }
00019 for (i = 32; i < 96; i++) {
00020 red[i] = 0;
00021 green[i] = 4*(i-32);
00022 blue[i] = 255;
00023 }
00024 for (i = 96; i < 160; i++) {
00025 red[i] = 4*(i-96);
00026 green[i] = 255;
00027 blue[i] = 255 - red[i];
00028 }
00029 for (i = 160; i < 224; i++) {
00030 red[i] = 255;
00031 green[i] = 255 - 4*(i-160);
00032 blue[i] = 0;
00033 }
00034 for (i = 224; i < 256; i++) {
00035 red[i] = 255;
00036 blue[i] = green[i] = 8*(i-224);
00037 }
00038 }
00039
00040 main()
00041 {
00042 int i;
00043 unsigned char red[256], green[256], blue[256];
00044
00045 make_colormap(red, green, blue);
00046
00047
00048
00049 for (i = 0; i < 256; i++) putchar(red[i]);
00050 for (i = 0; i < 256; i++) putchar(green[i]);
00051 for (i = 0; i < 256; i++) putchar(blue[i]);
00052 }