From db9f8b1a930476d85229aed1702c1adef8949dcf Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Thu, 29 Oct 2015 23:52:00 +1000 Subject: [PATCH] Gmt module: Functions Color, ColorGray, ColorRGB, ColorHSV, and ColorCMYK. --- modules/gmt/modgmt.cpp | 5 + modules/gmt/modgmt_colornames.cpp | 1471 +++++++++++++++++++++++++++++ modules/gmt/modgmt_colornames.h | 84 ++ modules/gmt/modgmt_func.cpp | 382 ++++++++ modules/gmt/modgmt_func.h | 5 + modules/gmt/modgmt_structs.h | 228 +++++ 6 files changed, 2175 insertions(+) create mode 100644 modules/gmt/modgmt_colornames.cpp create mode 100644 modules/gmt/modgmt_colornames.h diff --git a/modules/gmt/modgmt.cpp b/modules/gmt/modgmt.cpp index f3f4a4e..0982be7 100644 --- a/modules/gmt/modgmt.cpp +++ b/modules/gmt/modgmt.cpp @@ -31,5 +31,10 @@ int gmt_module_init(void* p) RegisterFunction("Coord",GMT_Coord); RegisterFunction("Region",GMT_Region); RegisterFunction("Projection",GMT_Projection); + RegisterFunction("Color",GMT_Color); + RegisterFunction("ColorGray",GMT_ColorGray); + RegisterFunction("ColorRGB",GMT_ColorRGB); + RegisterFunction("ColorHSV",GMT_ColorHSV); + RegisterFunction("ColorCMYK",GMT_ColorCMYK); return 0; } diff --git a/modules/gmt/modgmt_colornames.cpp b/modules/gmt/modgmt_colornames.cpp new file mode 100644 index 0000000..4894df5 --- /dev/null +++ b/modules/gmt/modgmt_colornames.cpp @@ -0,0 +1,1471 @@ +/* C++ code produced by gperf version 3.0.4 */ +/* Command-line: gperf colors */ +/* Computed positions: -k'1,3,5-8,12-13,$' */ + +/* Definitions in input file +%struct-type +%ignore-case +%language=C++ +%define hash-function-name colornamehash +%define lookup-function-name in_colors_set +%define class-name ColorHash +%readonly-tables +%enum +%includes +%define word-array-name colornameslist +%define length-table-name colorlengthtable +struct colorname {char *name; double r; double g; double b; }; +%% +*/ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#include +#include "modgmt_colornames.h" +/* maximum key range = 4079, duplicates = 0 */ + +#ifndef GPERF_DOWNCASE +#define GPERF_DOWNCASE 1 +static unsigned char gperf_downcase[256] = + { + 0, 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, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255 + }; +#endif + +#ifndef GPERF_CASE_STRCMP +#define GPERF_CASE_STRCMP 1 +static int +gperf_case_strcmp ( const char *s1, const char *s2) +{ + for (;;) + { + unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; + unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; + if (c1 != 0 && c1 == c2) + continue; + return (int)c1 - (int)c2; + } +} +#endif + +const struct colorname * +ColorHash::in_colors_set ( const char *str, unsigned int len) +{ + enum + { + TOTAL_KEYWORDS = 663, + MIN_WORD_LENGTH = 3, + MAX_WORD_LENGTH = 20, + MIN_HASH_VALUE = 5, + MAX_HASH_VALUE = 4083 + }; + + static const struct colorname colornameslist[] = + { + {""}, {""}, {""}, {""}, {""}, + {"grey4", 10, 10, 10}, + {"grey44", 112, 112, 112}, + {""}, {""}, + {"red4", 139, 0, 0}, + {""}, + {"grey34", 87, 87, 87}, + {""}, + {"red", 255, 0, 0}, + {"red3", 205, 0, 0}, + {"grey3", 8, 8, 8}, + {"grey43", 110, 110, 110}, + {""}, {""}, {""}, {""}, + {"grey33", 84, 84, 84}, + {"darkred", 139, 0, 0}, + {""}, {""}, {""}, + {"grey24", 61, 61, 61}, + {""}, {""}, + {"red2", 238, 0, 0}, + {""}, + {"grey14", 36, 36, 36}, + {""}, {""}, + {"red1", 255, 0, 0}, + {""}, + {"grey23", 59, 59, 59}, + {""}, {""}, {""}, {""}, + {"grey13", 33, 33, 33}, + {""}, {""}, {""}, + {"grey2", 5, 5, 5}, + {"grey42", 107, 107, 107}, + {""}, {""}, {""}, {""}, + {"grey32", 82, 82, 82}, + {""}, {""}, {""}, + {"grey1", 3, 3, 3}, + {"grey41", 105, 105, 105}, + {""}, {""}, {""}, {""}, + {"grey31", 79, 79, 79}, + {""}, {""}, + {"grey", 190, 190, 190}, + {""}, + {"grey22", 56, 56, 56}, + {""}, {""}, {""}, {""}, + {"grey12", 31, 31, 31}, + {""}, {""}, {""}, {""}, + {"grey21", 54, 54, 54}, + {""}, {""}, {""}, {""}, + {"grey11", 28, 28, 28}, + {""}, {""}, {""}, + {"gray4", 10, 10, 10}, + {"gray44", 112, 112, 112}, + {""}, {""}, {""}, {""}, + {"gray34", 87, 87, 87}, + {""}, {""}, {""}, + {"gray3", 8, 8, 8}, + {"gray43", 110, 110, 110}, + {""}, {""}, {""}, {""}, + {"gray33", 84, 84, 84}, + {""}, {""}, {""}, {""}, + {"gray24", 61, 61, 61}, + {""}, {""}, {""}, {""}, + {"gray14", 36, 36, 36}, + {""}, {""}, {""}, {""}, + {"gray23", 59, 59, 59}, + {""}, {""}, {""}, {""}, + {"gray13", 33, 33, 33}, + {""}, {""}, {""}, + {"gray2", 5, 5, 5}, + {"gray42", 107, 107, 107}, + {""}, {""}, {""}, {""}, + {"gray32", 82, 82, 82}, + {""}, + {"darkgrey", 169, 169, 169}, + {""}, + {"gray1", 3, 3, 3}, + {"gray41", 105, 105, 105}, + {""}, {""}, {""}, {""}, + {"gray31", 79, 79, 79}, + {""}, {""}, + {"gray", 190, 190, 190}, + {""}, + {"gray22", 56, 56, 56}, + {""}, {""}, + {"slategrey", 112, 128, 144}, + {""}, + {"gray12", 31, 31, 31}, + {""}, {""}, {""}, {""}, + {"gray21", 54, 54, 54}, + {""}, {""}, {""}, {""}, + {"gray11", 28, 28, 28}, + {""}, {""}, {""}, {""}, + {"green4", 0, 139, 0}, + {""}, {""}, {""}, + {"slategray4", 108, 123, 139}, + {""}, + {"springgreen4", 0, 139, 69}, + {""}, + {"darkgreen", 0, 100, 0}, + {"slategray3", 159, 182, 205}, + {"green3", 0, 205, 0}, + {""}, {""}, {""}, {""}, {""}, + {"springgreen3", 0, 205, 102}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"slategray2", 185, 211, 238}, + {""}, {""}, {""}, {""}, + {"slategray1", 198, 226, 255}, + {""}, {""}, {""}, {""}, + {"snow4", 139, 137, 137}, + {""}, {""}, {""}, {""}, {""}, + {"green2", 0, 238, 0}, + {""}, {""}, {""}, + {"snow3", 205, 201, 201}, + {""}, + {"springgreen2", 0, 238, 118}, + {"darkgray", 169, 169, 169}, + {""}, + {"gold4", 139, 117, 0}, + {"green1", 0, 255, 0}, + {""}, {""}, + {"gold", 255, 215, 0}, + {""}, {""}, + {"springgreen1", 0, 255, 127}, + {""}, {""}, + {"gold3", 205, 173, 0}, + {""}, + {"dimgrey", 105, 105, 105}, + {""}, + {"slategray", 112, 128, 144}, + {"dodgerblue", 30, 144, 255}, + {"dodgerblue4", 16, 78, 139}, + {""}, {""}, {""}, {""}, + {"dodgerblue3", 24, 116, 205}, + {""}, {""}, {""}, + {"snow2", 238, 233, 233}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"sienna4", 139, 71, 38}, + {""}, + {"seagreen4", 46, 139, 87}, + {"snow1", 255, 250, 250}, + {"dodgerblue2", 28, 134, 238}, + {""}, {""}, + {"seagreen3", 67, 205, 128}, + {"gold2", 238, 201, 0}, + {"dodgerblue1", 30, 144, 255}, + {"sienna3", 205, 104, 57}, + {"darkseagreen4", 105, 139, 105}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"gold1", 255, 215, 0}, + {""}, {""}, + {"darkseagreen3", 155, 205, 155}, + {"seagreen2", 78, 238, 148}, + {""}, + {"darkmagenta", 139, 0, 139}, + {""}, {""}, + {"seagreen1", 84, 255, 159}, + {""}, {""}, {""}, {""}, + {"navy", 0, 0, 128}, + {""}, + {"orange", 255, 165, 0}, + {"orange4", 139, 90, 0}, + {""}, {""}, + {"orangered4", 139, 37, 0}, + {""}, + {"sienna2", 238, 121, 66}, + {""}, + {"orangered", 255, 69, 0}, + {"orangered3", 205, 55, 0}, + {""}, + {"orange3", 205, 133, 0}, + {""}, {""}, {""}, {""}, + {"sienna1", 255, 130, 71}, + {"darkseagreen2", 180, 238, 180}, + {"tan4", 139, 90, 43}, + {""}, {""}, {""}, {""}, + {"tan3", 205, 133, 63}, + {"orangered2", 238, 64, 0}, + {""}, + {"dimgray", 105, 105, 105}, + {"darkseagreen1", 193, 255, 193}, + {""}, + {"orangered1", 255, 69, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"tan2", 238, 154, 73}, + {""}, {""}, + {"orange2", 238, 154, 0}, + {""}, + {"tan1", 255, 165, 79}, + {"green", 0, 255, 0}, + {"sienna", 160, 82, 45}, + {""}, {""}, {""}, {""}, + {"springgreen", 0, 255, 127}, + {"orange1", 255, 165, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"mistyrose", 255, 228, 225}, + {"mistyrose4", 139, 125, 123}, + {"brown4", 139, 35, 35}, + {""}, + {"lightred", 255, 128, 128}, + {""}, + {"mistyrose3", 205, 183, 181}, + {""}, {""}, {""}, {""}, {""}, + {"brown3", 205, 51, 51}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"mistyrose2", 238, 213, 210}, + {""}, {""}, {""}, {""}, + {"mistyrose1", 255, 228, 225}, + {"saddlebrown", 139, 69, 19}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"violetred4", 139, 34, 82}, + {""}, {""}, {""}, + {"violetred", 208, 32, 144}, + {"violetred3", 205, 50, 120}, + {"brown2", 238, 59, 59}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"seagreen", 46, 139, 87}, + {""}, {""}, + {"brown1", 255, 64, 64}, + {""}, {""}, + {"lightgrey", 211, 211, 211}, + {"violetred2", 238, 58, 140}, + {""}, + {"darkseagreen", 143, 188, 143}, + {""}, {""}, + {"violetred1", 255, 62, 150}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"blue", 0, 0, 255}, + {"blue4", 0, 0, 139}, + {"bisque", 255, 228, 196}, + {"bisque4", 139, 125, 107}, + {""}, {""}, {""}, {""}, {""}, + {"lavender", 230, 230, 250}, + {""}, + {"blue3", 0, 0, 205}, + {""}, + {"bisque3", 205, 183, 158}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"darkorange", 255, 140, 0}, + {"darkorange4", 139, 69, 0}, + {""}, {""}, {""}, {""}, + {"darkorange3", 205, 102, 0}, + {"maroon4", 139, 28, 98}, + {"tan", 210, 180, 140}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"maroon3", 205, 41, 144}, + {""}, {""}, + {"blue2", 0, 0, 238}, + {"darkorange2", 238, 118, 0}, + {"bisque2", 238, 213, 183}, + {""}, + {"limegreen", 50, 205, 50}, + {""}, + {"darkorange1", 255, 127, 0}, + {""}, + {"magenta4", 139, 0, 139}, + {""}, + {"blue1", 0, 0, 255}, + {""}, + {"bisque1", 255, 228, 196}, + {""}, {""}, {""}, {""}, {""}, + {"magenta3", 205, 0, 205}, + {""}, {""}, {""}, {""}, {""}, + {"lightgray", 211, 211, 211}, + {""}, {""}, + {"maroon2", 238, 48, 167}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"maroon1", 255, 52, 179}, + {""}, {""}, + {"azure", 240, 255, 255}, + {"azure4", 131, 139, 139}, + {""}, {""}, {""}, + {"lightgreen", 144, 238, 144}, + {""}, {""}, + {"magenta2", 238, 0, 238}, + {""}, + {"brown", 165, 42, 42}, + {"azure3", 193, 205, 205}, + {""}, {""}, {""}, {""}, + {"violet", 238, 130, 238}, + {""}, + {"magenta1", 255, 0, 255}, + {"lavenderblush4", 139, 131, 134}, + {""}, {""}, {""}, {""}, + {"lavenderblush3", 205, 193, 197}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"lavenderblush2", 238, 224, 229}, + {""}, + {"azure2", 224, 238, 238}, + {""}, {""}, + {"lavenderblush1", 255, 240, 245}, + {""}, {""}, + {"magenta", 255, 0, 255}, + {""}, {""}, + {"darksalmon", 233, 150, 122}, + {"azure1", 240, 255, 255}, + {""}, + {"darkslategrey", 47, 79, 79}, + {""}, {""}, + {"forestgreen", 34, 139, 34}, + {"tomato4", 139, 54, 38}, + {""}, {""}, {""}, {""}, + {"salmon4", 139, 76, 57}, + {""}, {""}, + {"goldenrod4", 139, 105, 20}, + {""}, + {"tomato3", 205, 79, 57}, + {""}, + {"goldenrod", 218, 165, 32}, + {"goldenrod3", 205, 155, 29}, + {""}, + {"salmon3", 205, 112, 84}, + {""}, + {"darkslategray4", 82, 139, 139}, + {"sandybrown", 244, 164, 96}, + {""}, {""}, {""}, + {"darkslategray3", 121, 205, 205}, + {""}, {""}, {""}, {""}, + {"seashell4", 139, 134, 130}, + {"goldenrod2", 238, 180, 34}, + {""}, {""}, {""}, + {"seashell3", 205, 197, 191}, + {"goldenrod1", 255, 193, 37}, + {""}, {""}, {""}, + {"darkslategray2", 141, 238, 238}, + {""}, {""}, + {"tomato2", 238, 92, 66}, + {""}, + {"darkslategray1", 151, 255, 255}, + {""}, {""}, + {"salmon2", 238, 130, 98}, + {"lavenderblush", 255, 240, 245}, + {"seashell2", 238, 229, 222}, + {""}, + {"maroon", 176, 48, 96}, + {"tomato1", 255, 99, 71}, + {""}, + {"seashell1", 255, 245, 238}, + {""}, {""}, + {"salmon1", 255, 140, 105}, + {""}, {""}, {""}, + {"grey94", 240, 240, 240}, + {"lightyellow4", 139, 139, 122}, + {""}, + {"darkgoldenrod4", 139, 101, 8}, + {""}, + {"lightorange", 255, 192, 128}, + {""}, + {"darkgoldenrod", 184, 134, 11}, + {"darkgoldenrod3", 205, 149, 12}, + {""}, + {"grey93", 237, 237, 237}, + {"lightyellow3", 205, 205, 180}, + {""}, {""}, {""}, {""}, {""}, + {"darkslategray", 47, 79, 79}, + {""}, {""}, + {"grey84", 214, 214, 214}, + {"lightsalmon4", 139, 87, 66}, + {"darkblue", 0, 0, 139}, + {"darkgoldenrod2", 238, 173, 14}, + {""}, {""}, {""}, {""}, + {"darkgoldenrod1", 255, 185, 15}, + {""}, + {"grey83", 212, 212, 212}, + {"lightsalmon3", 205, 129, 98}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey92", 235, 235, 235}, + {"lightyellow2", 238, 238, 209}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey91", 232, 232, 232}, + {"lightyellow1", 255, 255, 224}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey82", 209, 209, 209}, + {"lightsalmon2", 238, 149, 114}, + {""}, {""}, {""}, {""}, + {"lightmagenta", 255, 128, 255}, + {""}, {""}, + {"linen", 250, 240, 230}, + {"grey81", 207, 207, 207}, + {"lightsalmon1", 255, 160, 122}, + {""}, {""}, {""}, {""}, + {"skyblue", 135, 206, 235}, + {"skyblue4", 74, 112, 139}, + {""}, {""}, + {"gray94", 240, 240, 240}, + {""}, {""}, + {"lightslategrey", 119, 136, 153}, + {"lightbrown", 235, 190, 85}, + {""}, {""}, + {"skyblue3", 108, 166, 205}, + {""}, {""}, + {"gray93", 237, 237, 237}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"slateblue", 106, 90, 205}, + {"slateblue4", 71, 60, 139}, + {"gray84", 214, 214, 214}, + {""}, {""}, {""}, + {"slateblue3", 105, 89, 205}, + {"salmon", 250, 128, 114}, + {""}, {""}, {""}, {""}, + {"gray83", 212, 212, 212}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"skyblue2", 126, 192, 238}, + {""}, + {"slateblue2", 122, 103, 238}, + {"gray92", 235, 235, 235}, + {""}, {""}, {""}, + {"slateblue1", 131, 111, 255}, + {""}, {""}, + {"skyblue1", 135, 206, 255}, + {""}, {""}, + {"gray91", 232, 232, 232}, + {""}, + {"lightseagreen", 32, 178, 170}, + {""}, {""}, + {"tomato", 255, 99, 71}, + {""}, {""}, {""}, {""}, + {"gray82", 209, 209, 209}, + {""}, {""}, {""}, {""}, + {"cyan4", 0, 139, 139}, + {""}, {""}, {""}, + {"beige", 245, 245, 220}, + {"gray81", 207, 207, 207}, + {""}, {""}, {""}, {""}, + {"cyan3", 0, 205, 205}, + {""}, {""}, {""}, {""}, + {"grey74", 189, 189, 189}, + {""}, {""}, + {"lightslategray", 119, 136, 153}, + {""}, + {"grey64", 163, 163, 163}, + {""}, {""}, + {"mediumseagreen", 60, 179, 113}, + {""}, + {"grey73", 186, 186, 186}, + {""}, {""}, {""}, {""}, + {"grey63", 161, 161, 161}, + {""}, + {"seashell", 255, 245, 238}, + {""}, {""}, + {"lightsalmon", 255, 160, 122}, + {""}, {""}, {""}, {""}, + {"cyan2", 0, 238, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"cyan1", 0, 255, 255}, + {""}, {""}, {""}, {""}, + {"grey72", 184, 184, 184}, + {""}, {""}, {""}, {""}, + {"grey62", 158, 158, 158}, + {""}, + {"mediumorchid4", 122, 55, 139}, + {""}, {""}, + {"grey71", 181, 181, 181}, + {"mediumorchid", 186, 85, 211}, + {""}, {""}, + {"mediumblue", 0, 0, 205}, + {"grey61", 156, 156, 156}, + {""}, + {"mediumorchid3", 180, 82, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey54", 138, 138, 138}, + {""}, {""}, + {"steelblue", 70, 130, 180}, + {"steelblue4", 54, 100, 139}, + {""}, {""}, + {"navyblue", 0, 0, 128}, + {""}, + {"steelblue3", 79, 148, 205}, + {"grey53", 135, 135, 135}, + {""}, {""}, {""}, {""}, + {"gray74", 189, 189, 189}, + {""}, + {"darkslateblue", 72, 61, 139}, + {""}, {""}, + {"gray64", 163, 163, 163}, + {""}, + {"mediumorchid2", 209, 95, 238}, + {""}, + {"steelblue2", 92, 172, 238}, + {"gray73", 186, 186, 186}, + {""}, {""}, {""}, + {"steelblue1", 99, 184, 255}, + {"gray63", 161, 161, 161}, + {""}, + {"mediumorchid1", 224, 102, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey52", 133, 133, 133}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey51", 130, 130, 130}, + {"coral4", 139, 62, 47}, + {""}, {""}, {""}, + {"gray72", 184, 184, 184}, + {""}, {""}, {""}, {""}, + {"gray62", 158, 158, 158}, + {"coral3", 205, 91, 69}, + {"darkturquoise", 0, 206, 209}, + {"royalblue", 65, 105, 225}, + {"royalblue4", 39, 64, 139}, + {"gray71", 181, 181, 181}, + {""}, {""}, {""}, + {"royalblue3", 58, 95, 205}, + {"gray61", 156, 156, 156}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"cyan", 0, 255, 255}, + {"gray54", 138, 138, 138}, + {""}, {""}, {""}, + {"royalblue2", 67, 110, 238}, + {""}, {""}, {""}, {""}, + {"royalblue1", 72, 118, 255}, + {"gray53", 135, 135, 135}, + {"coral2", 238, 106, 80}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"coral1", 255, 114, 86}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"lightgoldenrod4", 139, 129, 76}, + {""}, {""}, {""}, + {"lightgoldenrod", 238, 221, 130}, + {"lightgoldenrod3", 205, 190, 112}, + {""}, {""}, {""}, {""}, {""}, + {"gray52", 133, 133, 133}, + {""}, + {"oldlace", 253, 245, 230}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"lightgoldenrod2", 238, 220, 130}, + {"gray51", 130, 130, 130}, + {"darkorchid4", 104, 34, 139}, + {""}, {""}, + {"lightgoldenrod1", 255, 236, 139}, + {"darkorchid", 153, 50, 204}, + {"darkorchid3", 154, 50, 205}, + {""}, + {"lightblue", 173, 216, 230}, + {"lightblue4", 104, 131, 139}, + {""}, {""}, {""}, {""}, + {"lightblue3", 154, 192, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"darkorchid2", 178, 58, 238}, + {""}, + {"wheat4", 139, 126, 102}, + {""}, {""}, + {"darkorchid1", 191, 62, 255}, + {""}, {""}, + {"lightblue2", 178, 223, 238}, + {""}, {""}, {""}, + {"wheat3", 205, 186, 150}, + {"lightblue1", 191, 239, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"indianred4", 139, 58, 58}, + {"deepskyblue", 0, 191, 255}, + {"deepskyblue4", 0, 104, 139}, + {""}, + {"indianred", 205, 92, 92}, + {"indianred3", 205, 85, 85}, + {"ivory4", 139, 139, 131}, + {""}, {""}, {""}, {""}, {""}, + {"deepskyblue3", 0, 154, 205}, + {""}, {""}, {""}, + {"ivory3", 205, 205, 193}, + {""}, {""}, + {"wheat2", 238, 216, 174}, + {"indianred2", 238, 99, 99}, + {""}, {""}, {""}, {""}, + {"indianred1", 255, 106, 106}, + {""}, {""}, {""}, + {"wheat1", 255, 231, 186}, + {"mediumslateblue", 123, 104, 238}, + {""}, {""}, {""}, + {"olivedrab", 107, 142, 35}, + {"olivedrab4", 105, 139, 34}, + {""}, + {"snow", 255, 250, 250}, + {""}, {""}, + {"olivedrab3", 154, 205, 50}, + {""}, + {"deepskyblue2", 0, 178, 238}, + {"rosybrown4", 139, 105, 105}, + {""}, {""}, + {"ivory2", 238, 238, 224}, + {""}, + {"rosybrown3", 205, 155, 155}, + {""}, {""}, {""}, + {"deepskyblue1", 0, 191, 255}, + {""}, {""}, + {"olivedrab2", 179, 238, 58}, + {"ivory1", 255, 255, 240}, + {""}, {""}, {""}, + {"olivedrab1", 192, 255, 62}, + {""}, {""}, + {"rosybrown2", 238, 180, 180}, + {""}, + {"ivory", 255, 255, 240}, + {""}, {""}, + {"rosybrown1", 255, 193, 193}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"midnightblue", 25, 25, 112}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"coral", 255, 127, 80}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, + {"mintcream", 245, 255, 250}, + {""}, {""}, {""}, + {"lightsteelblue", 176, 196, 222}, + {"lightsteelblue4", 110, 123, 139}, + {"mediumaquamarine", 102, 205, 170}, + {""}, {""}, {""}, + {"lightsteelblue3", 162, 181, 205}, + {""}, {""}, + {"wheat", 245, 222, 179}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"lightsteelblue2", 188, 210, 238}, + {""}, {""}, {""}, {""}, + {"lightsteelblue1", 202, 225, 255}, + {""}, {""}, {""}, + {"darkcyan", 0, 139, 139}, + {"pink4", 139, 99, 108}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gainsboro", 220, 220, 220}, + {"pink3", 205, 145, 158}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"lightcyan4", 122, 139, 139}, + {"honeydew4", 131, 139, 131}, + {""}, {""}, {""}, + {"lightcyan3", 180, 205, 205}, + {"honeydew3", 193, 205, 193}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, + {"pink2", 238, 169, 184}, + {"lightcyan2", 209, 238, 238}, + {"honeydew2", 224, 238, 224}, + {""}, {""}, {""}, + {"lightcyan1", 224, 255, 255}, + {"honeydew1", 240, 255, 240}, + {""}, {""}, + {"pink1", 255, 181, 197}, + {"purple", 160, 32, 240}, + {"purple4", 85, 26, 139}, + {""}, {""}, + {"palegreen4", 84, 139, 84}, + {""}, {""}, {""}, {""}, + {"palegreen3", 124, 205, 124}, + {""}, + {"purple3", 125, 38, 205}, + {""}, {""}, {""}, {""}, + {"rosybrown", 188, 143, 143}, + {""}, {""}, + {"blanchedalmond", 255, 235, 205}, + {""}, + {"darkbrown", 120, 60, 30}, + {""}, {""}, + {"palegreen2", 144, 238, 144}, + {""}, {""}, {""}, {""}, + {"palegreen1", 154, 255, 154}, + {""}, + {"lawngreen", 124, 252, 0}, + {""}, {""}, + {"grey9", 23, 23, 23}, + {"grey49", 125, 125, 125}, + {""}, {""}, {""}, + {"darkolivegreen4", 110, 139, 61}, + {"grey39", 99, 99, 99}, + {"purple2", 145, 44, 238}, + {""}, {""}, + {"darkolivegreen3", 162, 205, 90}, + {""}, + {"thistle", 216, 191, 216}, + {"thistle4", 139, 123, 139}, + {""}, {""}, {""}, + {"purple1", 155, 48, 255}, + {""}, {""}, {""}, + {"grey29", 74, 74, 74}, + {""}, + {"thistle3", 205, 181, 205}, + {""}, + {"darkolivegreen2", 188, 238, 104}, + {"grey19", 48, 48, 48}, + {""}, {""}, {""}, + {"darkolivegreen1", 202, 255, 112}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"lightslateblue", 132, 112, 255}, + {"grey8", 20, 20, 20}, + {"grey48", 122, 122, 122}, + {""}, {""}, {""}, {""}, + {"grey38", 97, 97, 97}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"thistle2", 238, 210, 238}, + {""}, {""}, {""}, {""}, {""}, + {"greenyellow", 173, 255, 47}, + {""}, + {"grey28", 71, 71, 71}, + {""}, + {"thistle1", 255, 225, 255}, + {""}, {""}, + {"grey18", 46, 46, 46}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"burlywood4", 139, 115, 85}, + {""}, + {"gray9", 23, 23, 23}, + {"gray49", 125, 125, 125}, + {"burlywood", 222, 184, 135}, + {"burlywood3", 205, 170, 125}, + {""}, {""}, + {"gray39", 99, 99, 99}, + {""}, {""}, {""}, + {"yellow4", 139, 139, 0}, + {"chartreuse", 127, 255, 0}, + {"chartreuse4", 69, 139, 0}, + {""}, {""}, + {"lightcyan", 224, 255, 255}, + {""}, + {"chartreuse3", 102, 205, 0}, + {"burlywood2", 238, 197, 145}, + {""}, + {"yellow3", 205, 205, 0}, + {"gray29", 74, 74, 74}, + {""}, + {"burlywood1", 255, 211, 155}, + {""}, {""}, + {"gray19", 48, 48, 48}, + {""}, {""}, {""}, {""}, {""}, + {"chartreuse2", 118, 238, 0}, + {"darkyellow", 128, 128, 0}, + {""}, {""}, {""}, + {"chartreuse1", 127, 255, 0}, + {""}, {""}, + {"gray8", 20, 20, 20}, + {"gray48", 122, 122, 122}, + {"lightskyblue", 135, 206, 250}, + {"lightskyblue4", 96, 123, 139}, + {""}, {""}, + {"gray38", 97, 97, 97}, + {""}, {""}, + {"palegreen", 152, 251, 152}, + {"yellow2", 238, 238, 0}, + {""}, {""}, + {"lightskyblue3", 141, 182, 205}, + {""}, + {"darkviolet", 148, 0, 211}, + {""}, {""}, {""}, {""}, + {"yellow1", 255, 255, 0}, + {"gray28", 71, 71, 71}, + {""}, {""}, + {"navajowhite", 255, 222, 173}, + {"navajowhite4", 139, 121, 94}, + {"gray18", 46, 46, 46}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"navajowhite3", 205, 179, 139}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"lightskyblue2", 164, 211, 238}, + {"darkolivegreen", 85, 107, 47}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"lightskyblue1", 176, 226, 255}, + {""}, {""}, {""}, {""}, {""}, + {"peru", 205, 133, 63}, + {"plum4", 139, 102, 139}, + {""}, {""}, {""}, {""}, + {"navajowhite2", 238, 207, 161}, + {""}, {""}, {""}, {""}, + {"plum3", 205, 150, 205}, + {""}, {""}, {""}, {""}, + {"navajowhite1", 255, 222, 173}, + {""}, {""}, {""}, {""}, {""}, + {"lightcoral", 240, 128, 128}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, + {"aquamarine", 127, 255, 212}, + {"aquamarine4", 69, 139, 116}, + {""}, {""}, {""}, + {"plum2", 238, 174, 238}, + {"aquamarine3", 102, 205, 170}, + {""}, {""}, {""}, + {"cadetblue", 95, 158, 160}, + {"cadetblue4", 83, 134, 139}, + {""}, {""}, {""}, + {"plum1", 255, 187, 255}, + {"cadetblue3", 122, 197, 205}, + {""}, {""}, {""}, {""}, + {"aquamarine2", 118, 238, 198}, + {""}, {""}, {""}, {""}, + {"aquamarine1", 127, 255, 212}, + {""}, {""}, + {"lightyellow", 255, 255, 224}, + {""}, + {"cadetblue2", 142, 229, 238}, + {""}, {""}, + {"aliceblue", 240, 248, 255}, + {""}, + {"cadetblue1", 152, 245, 255}, + {""}, {""}, + {"yellowgreen", 154, 205, 50}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"chocolate", 210, 105, 30}, + {"chocolate4", 139, 69, 19}, + {""}, {""}, {""}, {""}, + {"chocolate3", 205, 102, 29}, + {""}, {""}, + {"plum", 221, 160, 221}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"chocolate2", 238, 118, 33}, + {""}, {""}, + {"turquoise", 64, 224, 208}, + {"turquoise4", 0, 134, 139}, + {"chocolate1", 255, 127, 36}, + {""}, {""}, {""}, + {"turquoise3", 0, 197, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"turquoise2", 0, 229, 238}, + {""}, {""}, {""}, {""}, + {"turquoise1", 0, 245, 255}, + {""}, {""}, {""}, {""}, + {"grey7", 18, 18, 18}, + {"grey47", 120, 120, 120}, + {""}, {""}, {""}, {""}, + {"grey37", 94, 94, 94}, + {""}, {""}, {""}, + {"grey6", 15, 15, 15}, + {"grey46", 117, 117, 117}, + {""}, {""}, {""}, {""}, + {"grey36", 92, 92, 92}, + {""}, {""}, {""}, {""}, + {"grey27", 69, 69, 69}, + {""}, {""}, {""}, {""}, + {"grey17", 43, 43, 43}, + {""}, {""}, {""}, {""}, + {"grey26", 66, 66, 66}, + {""}, {""}, {""}, + {"mediumvioletred", 199, 21, 133}, + {"grey16", 41, 41, 41}, + {""}, {""}, {""}, + {"grey0", 0, 0, 0}, + {"grey40", 102, 102, 102}, + {""}, {""}, {""}, {""}, + {"grey30", 77, 77, 77}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"grey20", 51, 51, 51}, + {""}, {""}, {""}, {""}, + {"grey10", 26, 26, 26}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"white", 255, 255, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"gray7", 18, 18, 18}, + {"gray47", 120, 120, 120}, + {""}, {""}, {""}, {""}, + {"gray37", 94, 94, 94}, + {""}, {""}, {""}, + {"gray6", 15, 15, 15}, + {"gray46", 117, 117, 117}, + {""}, {""}, {""}, {""}, + {"gray36", 92, 92, 92}, + {""}, + {"orchid4", 139, 71, 137}, + {""}, {""}, + {"gray27", 69, 69, 69}, + {"orchid", 218, 112, 214}, + {""}, {""}, {""}, + {"gray17", 43, 43, 43}, + {""}, + {"orchid3", 205, 105, 201}, + {""}, {""}, + {"gray26", 66, 66, 66}, + {""}, {""}, {""}, {""}, + {"gray16", 41, 41, 41}, + {""}, {""}, {""}, + {"gray0", 0, 0, 0}, + {"gray40", 102, 102, 102}, + {""}, {""}, {""}, {""}, + {"gray30", 77, 77, 77}, + {""}, {""}, {""}, + {"grey5", 13, 13, 13}, + {"grey45", 115, 115, 115}, + {""}, {""}, {""}, {""}, + {"grey35", 89, 89, 89}, + {""}, + {"orchid2", 238, 122, 233}, + {"floralwhite", 255, 250, 240}, + {""}, + {"gray20", 51, 51, 51}, + {""}, {""}, {""}, {""}, + {"gray10", 26, 26, 26}, + {""}, + {"orchid1", 255, 131, 250}, + {""}, {""}, + {"grey25", 64, 64, 64}, + {""}, {""}, {""}, {""}, + {"grey15", 38, 38, 38}, + {""}, {""}, {""}, {""}, + {"firebrick4", 139, 26, 26}, + {""}, {""}, {""}, {""}, + {"firebrick3", 205, 38, 38}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"firebrick2", 238, 44, 44}, + {""}, {""}, {""}, {""}, + {"firebrick1", 255, 48, 48}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"gray5", 13, 13, 13}, + {"gray45", 115, 115, 115}, + {""}, {""}, {""}, {""}, + {"gray35", 89, 89, 89}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"mediumspringgreen", 0, 250, 154}, + {""}, {""}, {""}, + {"gray25", 64, 64, 64}, + {""}, {""}, {""}, + {"blueviolet", 138, 43, 226}, + {"gray15", 38, 38, 38}, + {""}, {""}, {""}, {""}, + {"khaki4", 139, 134, 78}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"khaki3", 205, 198, 115}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"lightgoldenrodyellow", 250, 250, 210}, + {""}, {""}, {""}, {""}, + {"palegoldenrod", 238, 232, 170}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, + {"khaki2", 238, 230, 133}, + {""}, {""}, {""}, + {"antiquewhite", 250, 235, 215}, + {"antiquewhite4", 139, 131, 120}, + {""}, {""}, {""}, {""}, + {"khaki1", 255, 246, 143}, + {""}, {""}, {""}, {""}, + {"antiquewhite3", 205, 192, 176}, + {""}, {""}, {""}, {""}, + {"grey99", 252, 252, 252}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"grey89", 227, 227, 227}, + {""}, {""}, {""}, {""}, + {"antiquewhite2", 238, 223, 204}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"antiquewhite1", 255, 239, 219}, + {""}, {""}, {""}, {""}, + {"grey98", 250, 250, 250}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"grey88", 224, 224, 224}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"whitesmoke", 245, 245, 245}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, + {"gray99", 252, 252, 252}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, + {"moccasin", 255, 228, 181}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"gray89", 227, 227, 227}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"black", 0, 0, 0}, + {"gray98", 250, 250, 250}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"gray88", 224, 224, 224}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"grey79", 201, 201, 201}, + {""}, {""}, {""}, {""}, + {"grey69", 176, 176, 176}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, + {"honeydew", 240, 255, 240}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"mediumpurple", 147, 112, 219}, + {"mediumpurple4", 93, 71, 139}, + {""}, {""}, {""}, {""}, + {"ghostwhite", 248, 248, 255}, + {""}, {""}, {""}, {""}, + {"mediumpurple3", 137, 104, 205}, + {""}, {""}, + {"grey78", 199, 199, 199}, + {""}, {""}, {""}, {""}, + {"grey68", 173, 173, 173}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"powderblue", 176, 224, 230}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, + {"grey59", 150, 150, 150}, + {""}, + {"mediumpurple2", 159, 121, 238}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"mediumpurple1", 171, 130, 255}, + {""}, {""}, + {"gray79", 201, 201, 201}, + {""}, + {"hotpink4", 139, 58, 98}, + {"pink", 255, 192, 203}, + {""}, + {"gray69", 176, 176, 176}, + {""}, + {"paleturquoise", 175, 238, 238}, + {"paleturquoise4", 102, 139, 139}, + {""}, {""}, {""}, + {"hotpink3", 205, 96, 144}, + {"paleturquoise3", 150, 205, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"grey58", 148, 148, 148}, + {""}, {""}, + {"paleturquoise2", 174, 238, 238}, + {""}, {""}, {""}, {""}, + {"paleturquoise1", 187, 255, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"gray78", 199, 199, 199}, + {""}, + {"hotpink2", 238, 106, 167}, + {""}, {""}, + {"gray68", 173, 173, 173}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"hotpink1", 255, 110, 180}, + {""}, + {"mediumturquoise", 72, 209, 204}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"gray59", 150, 150, 150}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"lemonchiffon4", 139, 137, 112}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"grey97", 247, 247, 247}, + {""}, {""}, + {"lemonchiffon3", 205, 201, 165}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"grey96", 245, 245, 245}, + {"yellow", 255, 255, 0}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey87", 222, 222, 222}, + {""}, {""}, {""}, {""}, + {"gray58", 148, 148, 148}, + {""}, {""}, {""}, {""}, + {"grey86", 219, 219, 219}, + {""}, {""}, + {"lemonchiffon2", 238, 233, 191}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"grey90", 229, 229, 229}, + {""}, {""}, + {"lemonchiffon1", 255, 250, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey80", 204, 204, 204}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"gray97", 247, 247, 247}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray96", 245, 245, 245}, + {""}, {""}, {""}, + {"lightpink4", 139, 95, 101}, + {""}, {""}, {""}, {""}, + {"lightpink3", 205, 140, 149}, + {"gray87", 222, 222, 222}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray86", 219, 219, 219}, + {""}, {""}, {""}, + {"lightpink2", 238, 162, 173}, + {""}, {""}, {""}, {""}, + {"lightpink1", 255, 174, 185}, + {"gray90", 229, 229, 229}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey95", 242, 242, 242}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray80", 204, 204, 204}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey85", 217, 217, 217}, + {""}, + {"lemonchiffon", 255, 250, 205}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey77", 196, 196, 196}, + {""}, {""}, {""}, {""}, + {"grey67", 171, 171, 171}, + {""}, {""}, {""}, {""}, + {"grey76", 194, 194, 194}, + {""}, {""}, {""}, {""}, + {"grey66", 168, 168, 168}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"grey70", 179, 179, 179}, + {""}, {""}, {""}, {""}, + {"grey60", 153, 153, 153}, + {""}, {""}, {""}, {""}, + {"gray95", 242, 242, 242}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"grey57", 145, 145, 145}, + {""}, {""}, {""}, {""}, + {"gray85", 217, 217, 217}, + {""}, {""}, {""}, {""}, + {"grey56", 143, 143, 143}, + {""}, {""}, {""}, {""}, + {"gray77", 196, 196, 196}, + {""}, {""}, {""}, {""}, + {"gray67", 171, 171, 171}, + {"grey100", 255, 255, 255}, + {""}, {""}, {""}, + {"gray76", 194, 194, 194}, + {""}, {""}, {""}, {""}, + {"gray66", 168, 168, 168}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey50", 127, 127, 127}, + {""}, {""}, + {"palevioletred4", 139, 71, 93}, + {""}, {""}, {""}, + {"palevioletred", 219, 112, 147}, + {"palevioletred3", 205, 104, 137}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"gray70", 179, 179, 179}, + {""}, {""}, {""}, {""}, + {"gray60", 153, 153, 153}, + {""}, {""}, + {"palevioletred2", 238, 121, 159}, + {""}, + {"grey75", 191, 191, 191}, + {""}, {""}, + {"palevioletred1", 255, 130, 171}, + {""}, + {"grey65", 166, 166, 166}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray57", 145, 145, 145}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray56", 143, 143, 143}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"gray100", 255, 255, 255}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray50", 127, 127, 127}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"grey55", 140, 140, 140}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"gray75", 191, 191, 191}, + {""}, {""}, {""}, {""}, + {"gray65", 166, 166, 166}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, + {"khaki", 240, 230, 140}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"gray55", 140, 140, 140}, + {""}, {""}, {""}, + {"cornsilk4", 139, 136, 120}, + {""}, {""}, {""}, {""}, + {"cornsilk3", 205, 200, 177}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"cornsilk2", 238, 232, 205}, + {""}, {""}, {""}, {""}, + {"cornsilk1", 255, 248, 220}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"firebrick", 178, 34, 34}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"darkkhaki", 189, 183, 107}, + {"peachpuff4", 139, 119, 101}, + {""}, {""}, {""}, {""}, + {"peachpuff3", 205, 175, 149}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"cornflowerblue", 100, 149, 237}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"peachpuff2", 238, 203, 173}, + {""}, {""}, {""}, {""}, + {"peachpuff1", 255, 218, 185}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, + {"deeppink4", 139, 10, 80}, + {""}, {""}, {""}, {""}, + {"deeppink3", 205, 16, 118}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, + {"deeppink2", 238, 18, 137}, + {""}, {""}, {""}, {""}, + {"deeppink1", 255, 20, 147}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {"hotpink", 255, 105, 180}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, + {"peachpuff", 255, 218, 185}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"lightpink", 255, 182, 193}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"cornsilk", 255, 248, 220}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, + {"deeppink", 255, 20, 147}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, + {"papayawhip", 255, 239, 213} + }; + + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + { + int key = colornamehash (str, len); + + if (key <= MAX_HASH_VALUE && key >= 0) + { + const char *s = colornameslist[key].name; + + if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strcmp (str, s)) + return &colornameslist[key]; + } + } + return 0; +} diff --git a/modules/gmt/modgmt_colornames.h b/modules/gmt/modgmt_colornames.h new file mode 100644 index 0000000..39d60e0 --- /dev/null +++ b/modules/gmt/modgmt_colornames.h @@ -0,0 +1,84 @@ +#ifndef MODGMT_COLORNAMES_H +#define MODGMT_COLORNAMES_H + +struct colorname {const char *name; double r; double g; double b; }; +#include + +class ColorHash +{ +private: + static inline unsigned int colornamehash (const char *str, unsigned int len); +public: + static const struct colorname *in_colors_set (const char *str, unsigned int len); +}; + +inline unsigned int +ColorHash::colornamehash ( const char *str, unsigned int len) +{ + static const unsigned short asso_values[] = + { + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 800, 25, + 20, 5, 0, 845, 785, 780, 640, 620, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 80, 0, 686, 5, 0, + 260, 0, 85, 770, 20, 950, 210, 95, 160, 195, + 995, 335, 0, 0, 135, 425, 55, 863, 4084, 60, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 80, 0, 686, + 5, 0, 260, 0, 85, 770, 20, 950, 210, 95, + 160, 195, 995, 335, 0, 0, 135, 425, 55, 863, + 4084, 60, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, + 4084, 4084, 4084, 4084, 4084, 4084 + }; + int hval = len; + + switch (hval) + { + default: + hval += asso_values[(unsigned char)str[12]]; + /*FALLTHROUGH*/ + case 12: + hval += asso_values[(unsigned char)str[11]]; + /*FALLTHROUGH*/ + case 11: + case 10: + case 9: + case 8: + hval += asso_values[(unsigned char)str[7]]; + /*FALLTHROUGH*/ + case 7: + hval += asso_values[(unsigned char)str[6]]; + /*FALLTHROUGH*/ + case 6: + hval += asso_values[(unsigned char)str[5]]; + /*FALLTHROUGH*/ + case 5: + hval += asso_values[(unsigned char)str[4]]; + /*FALLTHROUGH*/ + case 4: + case 3: + hval += asso_values[(unsigned char)str[2]]; + /*FALLTHROUGH*/ + case 2: + case 1: + hval += asso_values[(unsigned char)str[0]]; + break; + } + return hval + asso_values[(unsigned char)str[len - 1]]; +} + +#endif \ No newline at end of file diff --git a/modules/gmt/modgmt_func.cpp b/modules/gmt/modgmt_func.cpp index 11abdc6..30c1f28 100644 --- a/modules/gmt/modgmt_func.cpp +++ b/modules/gmt/modgmt_func.cpp @@ -44,6 +44,88 @@ class DoubleConv }; typedef Base2Something Base2Double; +// Additional policies to let GetDouble work with Base2Double +// We use rational representation of floating point number, because double type values not allowed as template parameter +template +class PDefaultVal +{ + public: + double operator()() const {return static_cast(num)/denum;} +}; + +class PMultiInputNames {}; + +// Special case for default value policy. This policy mast be last in policies list. +template +class GetDouble >: public Base2Double +{ + PDefaultVal p; + public: + GetDouble(GetDouble&&) = delete; + GetDouble(GetDouble&) = delete; + GetDouble() = delete; + GetDouble(const ObjectBase* arg):Base2Double(arg) {}; + GetDouble(const ObjectList* input, const std::string& name):Base2Double(input,name){}; + GetDouble(const ObjectList* input, const ObjectList::ListValues::size_type i):Base2Double(input,i){}; + double operator()(bool* suc) const + { + if(Exist()) return Base2Double::operator()(suc); + else return p(); + } +}; + +// Special case for multiple input names policy. This policy mast be last in policies list. +template<> +class GetDouble +{ + bool exist; + bool ok; + double val; + public: + GetDouble(GetDouble&&) = delete; + GetDouble(GetDouble&) = delete; + GetDouble() = delete; + template + GetDouble(const ObjectList* input, const std::string& name, Args... args):GetDouble(input,args...) + { + Base2Double a(input,name); + if(exist && a.Exist()) ok=false; + else if(a.Exist()) + { + exist=true; + ok=true; + val=a(&ok); + } + } + GetDouble(const ObjectList* input, const std::string& name) + { + Base2Double a(input,name); + exist=a.Exist(); + ok=true; + if(exist) val=a(&ok); + } + double operator()(bool* suc) const + { + if(!ok || !exist) *suc=false; + return val; + } + bool Exist() const {return exist;} +}; + +// Bottom of recursion +template<> +class GetDouble<>: public Base2Double +{ + public: + GetDouble(GetDouble&&) = delete; + GetDouble(GetDouble&) = delete; + GetDouble() = delete; + GetDouble(const ObjectBase* arg):Base2Double(arg) {}; + GetDouble(const ObjectList* input, const std::string& name):Base2Double(input,name){}; + GetDouble(const ObjectList* input, const ObjectList::ListValues::size_type i):Base2Double(input,i){}; + double operator()(bool* suc) const {return Base2Double::operator()(suc);} +}; + // Converting Int, Real or String to GMTCoord template class CoordConv { @@ -829,6 +911,215 @@ class ProjConv }; typedef Base2Something Base2Proj; +// Helper types +typedef GetDouble,PMax<255>,PDefaultVal<>> Base2RGB; +typedef GetDouble,PMax<360>,PDefaultVal<>> Base2Hue; +typedef GetDouble,PMax<1>,PDefaultVal<>> Base2SV; +typedef GetDouble,PMax<100>,PDefaultVal<>> Base2CMYK; +typedef GetDouble,PMax<100>,PDefaultVal<>> Base2Transp; + +typedef GetDouble,PMax<255>,PMultiInputNames> BaseM2RGB; +typedef GetDouble,PMax<360>,PMultiInputNames> BaseM2Hue; +typedef GetDouble,PMax<1>,PMultiInputNames> BaseM2SV; +typedef GetDouble,PMax<100>,PMultiInputNames> BaseM2CMYK; +typedef GetDouble,PMax<100>,PMultiInputNames> BaseM2Transp; + +// Converting List to GMTColor +template class ColorConv +{ + public: + struct gmt_color operator()(const O* o, bool* issuc) const + { + struct gmt_color c; + if(!c.Convert(o->Value())) *issuc=false; + return c; + } +}; +// Special case is GMTColor +template<> +class ColorConv +{ + public: + struct gmt_color operator()(const ObjectGMTColor* o, bool* suc) const {return o->Data();} +}; +typedef Base2Something Base2Color; +// Conversion from List +template<> +class ColorConv +{ + public: + // Cases see in description of GMT_Color function + struct gmt_color operator()(const ObjectList* input, bool* issuc) const + { + struct gmt_color c; + auto size=input->Size(); + + if(1==size) // Cases 1, 2 and 4 + { + Base2Color a(input,0); + bool suc=true; + c=a(&suc); + if(suc) return c; + goto fail; + } + + // Case 3 + { + bool upd=false; + bool cmodset=false; + + // Update case, arguments list contains parameter with type GMTColor. + for(ObjectList::ListValues::size_type i=0;i color(input->At(i)); + if(color) + { + if(upd) goto fail; // Only one color in list allowed + c=color->Data(); + upd=true; + } + } + + // Update case, arguments list contains parameter color and this parameter is color. + { + Base2Color col(input,"color"); + if(col.Exist()) + { + if(upd) goto fail; // Already have color to update + bool suc=true; + struct gmt_color cs=col(&suc); + if(suc) + { + upd=true; + c=cs; + } + else goto fail; // Parse error + } + } + if(!upd) + { + // default color is black + c.transparency=0; + c.model=gmt_color::GRAY; + c.gray=0.0; + } + + { + BaseM2Transp t(input,"t","transp","transparency"); + if(t.Exist()) + { + bool suc=true; + c.transparency=t(&suc); + if(!suc) goto fail; // Parsing error + } + } + + // GRAY + { + BaseM2RGB g(input,"gray","grey"); + if(g.Exist()) + { + if(cmodset) goto fail; // Model already set + bool suc=true; + c.model=gmt_color::GRAY; + c.gray=g(&suc); // Update mode ignored in this case + if(!suc) goto fail; // Parsing error + cmodset=true; + } + } + + // RGB + { + BaseM2RGB r(input,"r","red"), g(input,"g","green"), b(input,"b","blue"); + if(r.Exist() || g.Exist() || b.Exist()) + { + if(cmodset) goto fail; // Model already set + bool suc=true; + c.ToRGB(); + if(r.Exist()) c.r=r(&suc); + if(g.Exist()) c.g=g(&suc); + if(b.Exist()) c.b=b(&suc); + if(!suc) goto fail; // Parsing error + cmodset=true; + } + } + + // HSV + { + BaseM2Hue h(input,"h","hue"); + BaseM2SV s(input,"s","sat","saturation"), v(input,"v","val","value"); + if(h.Exist() || s.Exist() || v.Exist()) + { + if(cmodset) goto fail; // Model already set + bool suc=true; + c.ToHSV(); + if(h.Exist()) c.hue=h(&suc); + if(s.Exist()) c.saturation=s(&suc); + if(v.Exist()) c.value=v(&suc); + if(!suc) goto fail; // Parsing error + cmodset=true; + } + } + + // CMYK + { + BaseM2CMYK cc(input,"c","cyan"), m(input,"m","magenta"), y(input,"y","yellow"), k(input,"k","black"); + if(cc.Exist() || m.Exist() || y.Exist() || k.Exist()) + { + if(cmodset) goto fail; // Model already set + bool suc=true; + c.ToCMYK(); + if(cc.Exist()) c.cyan=cc(&suc); + if(m.Exist()) c.magenta=m(&suc); + if(y.Exist()) c.yellow=y(&suc); + if(k.Exist()) c.black=k(&suc); + if(!suc) goto fail; // Parsing error + cmodset=true; + } + } + if(cmodset || upd) return c; // Color created or updated + } + + // Case 5 + if(3==size) + { + Base2RGB r(input,0), g(input,1), b(input,2); + c.model=gmt_color::RGB; + bool suc=true; + if(r && g && b) + { + c.r=r(&suc); + c.g=g(&suc); + c.b=b(&suc); + if(!suc) goto fail; // Parsing error + } + else goto fail; // Something wrong + return c; + } + + // Case 6 + if(4==size) + { + Base2CMYK cc(input,0), m(input,1), y(input,2), k(input,3); + c.model=gmt_color::CMYK; + bool suc=true; + if(cc && m && y && k) + { + c.cyan=cc(&suc); + c.magenta=m(&suc); + c.yellow=y(&suc); + c.black=k(&suc); + if(!suc) goto fail; // Parsing error + } + else goto fail; // Something wrong + return c; + } + + fail: + *issuc=false; + return c; // Something go wrong + } +}; /* Input is one argument, Int, Real, String or GMTCoord. @@ -886,3 +1177,94 @@ ObjectBase* GMT_Projection(const ObjectList* input) if(suc) return new ObjectGMTProjection(p); else return 0; } + + +/* +Input: +1) One argument, Color. Return copy of this argument. +2) One argument, list. Recursively calling GMT_Color. +3) Pairs list. Names are gray (grey), r(red),g(green),b(blue), h(hue),s(sat,saturation),v(value), c(cyan),m(magenta),y(yellow),k(black) and t(transp,transparency). +The different color models can't be mixed. +Gray, r, g, b are doubles in the range 0-255, h is double in the range 0-360, s and v are doubles in the range 0-1 and c, m, y, k and transparency are doubles in the range 0-100. Default value for all parameters is 0. +If pair with name color exists in list, when recursively calling GMT_Color on the value of this parameter, when modify it with specified parameters. +If argument with type Color exists in list, when copy it and modify with specified parameters. In both cases color model changing as specified by parameters. +4) One argument, interprets as gray. +5) Three arguments, interprets as r, g, b. +6) Four arguments, interprets as c, m, y, k. +Transparency or HSV model can be set only in form 3. +*/ +ObjectBase* GMT_Color(const ObjectList* input) +{ + bool suc=true; + struct gmt_color c=ColorConv()(input,&suc); + if(suc) return new ObjectGMTColor(c); + else return 0; +} + +ObjectBase* GMT_ColorGray(const ObjectList* input) +{ + struct gmt_color c; + bool suc=true; + Base2RGB g(input,0); + Base2Transp t(input,1); + + c.model=gmt_color::GRAY; + c.gray=g(&suc); + c.transparency=t(&suc); + + if(suc) return new ObjectGMTColor(c); + else return 0; +} + +ObjectBase* GMT_ColorRGB(const ObjectList* input) +{ + struct gmt_color c; + bool suc=true; + Base2RGB r(input,0),g(input,1),b(input,2); + Base2Transp t(input,3); + + c.model=gmt_color::RGB; + c.r=r(&suc); + c.g=g(&suc); + c.b=b(&suc); + c.transparency=t(&suc); + + if(suc) return new ObjectGMTColor(c); + else return 0; +} + +ObjectBase* GMT_ColorHSV(const ObjectList* input) +{ + struct gmt_color c; + bool suc=true; + Base2Hue h(input,0); + Base2SV s(input,1),v(input,2); + Base2Transp t(input,3); + + c.model=gmt_color::HSV; + c.hue=h(&suc); + c.saturation=s(&suc); + c.value=v(&suc); + c.transparency=t(&suc); + + if(suc) return new ObjectGMTColor(c); + else return 0; +} + +ObjectBase* GMT_ColorCMYK(const ObjectList* input) +{ + struct gmt_color c; + bool suc=true; + Base2CMYK cyan(input,0),m(input,1),y(input,2),k(input,3); + Base2Transp t(input,4); + + c.model=gmt_color::CMYK; + c.cyan=cyan(&suc); + c.magenta=m(&suc); + c.yellow=y(&suc); + c.black=k(&suc); + c.transparency=t(&suc); + + if(suc) return new ObjectGMTColor(c); + else return 0; +} diff --git a/modules/gmt/modgmt_func.h b/modules/gmt/modgmt_func.h index e163901..1cf31cd 100644 --- a/modules/gmt/modgmt_func.h +++ b/modules/gmt/modgmt_func.h @@ -7,5 +7,10 @@ ObjectBase* GMT_Footer(const ObjectList* input); ObjectBase* GMT_Coord(const ObjectList* input); ObjectBase* GMT_Region(const ObjectList* input); ObjectBase* GMT_Projection(const ObjectList* input); +ObjectBase* GMT_Color(const ObjectList* input); +ObjectBase* GMT_ColorGray(const ObjectList* input); +ObjectBase* GMT_ColorRGB(const ObjectList* input); +ObjectBase* GMT_ColorHSV(const ObjectList* input); +ObjectBase* GMT_ColorCMYK(const ObjectList* input); #endif diff --git a/modules/gmt/modgmt_structs.h b/modules/gmt/modgmt_structs.h index 255b636..b459d8c 100644 --- a/modules/gmt/modgmt_structs.h +++ b/modules/gmt/modgmt_structs.h @@ -4,6 +4,68 @@ #include #include #include "common.h" +#include "modgmt_colornames.h" + +// Helper classes for conversion of doubles from strings with varios checks +// We use rational representation of floating point number, because double type values not allowed as template parameter +template +class PMin +{ + public: + double operator()(double v, bool* suc) const {if(v(num)/denum) *suc=false; return v;} +}; + +template +class PMax +{ + public: + double operator()(double v, bool* suc) const {if(v>static_cast(num)/denum) *suc=false; return v;} +}; + +class PFromValue +{ + double d; + bool ok; + public: + PFromValue(const std::string& s) {ok=str2double(s,&d);} + PFromValue(double s):d(s),ok(true) {} + double operator()(bool* suc) const + { + if(!ok) *suc=false; + return d; + } +}; + +// Main definition, never instantiated +template +class GetDouble; + +// Recursive definition +template +class GetDouble: public GetDouble +{ + Policy p; + public: + GetDouble(GetDouble&&) = delete; + GetDouble(GetDouble&) = delete; + template + GetDouble(Args... args):GetDouble(args...) {}; + double operator()(bool* suc) const {return p(GetDouble::operator()(suc),suc);} +}; + +// Special case for PFromString policy. This policy mast be last in policies list. +template<> +class GetDouble +{ + PFromValue p; + public: + GetDouble(GetDouble&&) = delete; + GetDouble(GetDouble&) = delete; + GetDouble() = delete; + GetDouble(const std::string& str):p(str) {}; + GetDouble(double d):p(d) {}; + double operator()(bool* suc) const {return p(suc);} +}; // Coordinate struct gmt_coord @@ -218,10 +280,17 @@ struct gmt_projection static std::map projnames; }; +// Helper types for colors +typedef GetDouble,PMax<255>,PFromValue> Value2RGB; +typedef GetDouble,PMax<360>,PFromValue> Value2Hue; +typedef GetDouble,PMax<1>,PFromValue> Value2SV; +typedef GetDouble,PMax<100>,PFromValue> Value2CMYK; +typedef GetDouble,PMax<100>,PFromValue> Value2Transp; // Color struct gmt_color { + public: enum ColorModel {RGB,GRAY,HSV,CMYK}; ColorModel model; union @@ -255,6 +324,17 @@ struct gmt_color } return 0; } + void ToGray() + { + switch(model) + { + case(RGB): gray=RGB2Gray().gray; break; + case(GRAY): return; + case(HSV): gray=HSV2Gray().gray; break; + case(CMYK): gray=CMYK2Gray().gray; break; + } + model=GRAY; + } double R() const { @@ -289,6 +369,19 @@ struct gmt_color } return 0; } + void ToRGB() + { + gmt_color c; + switch(model) + { + case(RGB): return; + case(GRAY): c=Gray2RGB(); break; + case(HSV): c=HSV2RGB(); break; + case(CMYK): c=CMYK2RGB(); break; + } + model=RGB; + r=c.r; g=c.g; b=c.b; + } double H() const { @@ -323,6 +416,19 @@ struct gmt_color } return 0; } + void ToHSV() + { + gmt_color c; + switch(model) + { + case(RGB): c=RGB2HSV(); break; + case(GRAY): c=Gray2HSV(); break; + case(HSV): return; + case(CMYK): c=CMYK2HSV(); break; + } + model=HSV; + hue=c.hue; saturation=c.saturation; value=c.value; + } double C() const { @@ -368,6 +474,128 @@ struct gmt_color } return 0; } + void ToCMYK() + { + gmt_color cc; + switch(model) + { + case(RGB): cc=RGB2CMYK(); break; + case(GRAY): cc=Gray2CMYK(); break; + case(HSV): cc=HSV2CMYK(); break; + case(CMYK): return; + } + model=CMYK; + cyan=cc.cyan; magenta=cc.magenta; yellow=cc.yellow; black=cc.black; + } + + // Interpret one numeric argument as gray value + bool Convert(double gr) + { + Value2RGB g(gr); + bool suc=true; + model=GRAY; + transparency=0.0; + gray=g(&suc); + return suc; + } + + bool Convert(const std::string& istr) + { + std::string cstr=istr; + tolower(cstr); + + transparency=0.0; + // Transparency check + { + WordList wl=Split(cstr,"@"); + if(1!=wl.size() && 2!=wl.size()) return false; + if(2==wl.size()) + { + WordList::const_iterator ci=wl.begin(); + bool suc=true; + cstr=*ci; + ci++; + Value2Transp t(*ci); + transparency=t(&suc); + if(!suc) return false; // Parse error + } + } + { + WordList wl_slash=Split(cstr,"/"),wl_hyphen=Split(cstr,"-"); + WordList::size_type slash_size=wl_slash.size(),hyphen_size=wl_hyphen.size(); + // Checks + if(slash_size>1 && hyphen_size>1) return false; // Delimiter can be "/" or "-", not both + if(2==slash_size || slash_size>4) return false; // Size can be 1 or 3 for rgb or 4 for cmyk + if(2==hyphen_size || hyphen_size>3) return false; // Size can be 1 or 3 for hsv + // Gray or name + // TODO: Hex representation + if(1==slash_size && 1==hyphen_size) + { + if(SetByName(cstr)) return true; // Set color by name, all ok + Value2RGB g(cstr); + bool suc=true; + model=GRAY; + gray=g(&suc); + return suc; + } + // RGB + if(3==slash_size) + { + Value2RGB red(wl_slash.front()); wl_slash.pop_front(); + Value2RGB green(wl_slash.front()); wl_slash.pop_front(); + Value2RGB blue(wl_slash.front()); + bool suc=true; + model=RGB; + r=red(&suc); + g=green(&suc); + b=blue(&suc); + return suc; + } + // HSV + if(3==hyphen_size) + { + Value2Hue h(wl_hyphen.front()); wl_hyphen.pop_front(); + Value2SV s(wl_hyphen.front()); wl_hyphen.pop_front(); + Value2SV v(wl_hyphen.front()); + bool suc=true; + model=HSV; + hue=h(&suc); + saturation=s(&suc); + value=v(&suc); + return suc; + } + // CMYK + if(4==slash_size) + { + Value2CMYK c(wl_slash.front()); wl_slash.pop_front(); + Value2CMYK m(wl_slash.front()); wl_slash.pop_front(); + Value2CMYK y(wl_slash.front()); wl_slash.pop_front(); + Value2CMYK k(wl_slash.front()); + bool suc=true; + model=CMYK; + cyan=c(&suc); + magenta=m(&suc); + yellow=y(&suc); + black=k(&suc); + return suc; + } + } + + return false; + } + + bool SetByName(const std::string& name) + { + const struct colorname* cdata; + model=RGB; + cdata=ColorHash::in_colors_set(name.c_str(),name.length()); + if(0==cdata) return false; + r=cdata->r; + g=cdata->g; + b=cdata->b; + return true; + } + // Transformation functions private: #include "colortransform.h"