diff --git a/image/private/color.rkt b/image/private/color.rkt index 370e379..236971b 100644 --- a/image/private/color.rkt +++ b/image/private/color.rkt @@ -4,8 +4,3 @@ (define-struct color (red green blue alpha) #:extra-constructor-name make-color) - - -(color 3 4 5 0) -1 -(make-color 3 5 7 0) \ No newline at end of file diff --git a/image/private/colordb.js b/image/private/colordb.js index 6f2bcf2..1af208a 100644 --- a/image/private/colordb.js +++ b/image/private/colordb.js @@ -18,188 +18,189 @@ ColorDb.prototype.get = function(name) { // FIXME: update toString to handle the primitive field values. var colorDb = new ColorDb(); -colorDb.put("ORANGE", types.color(255, 165, 0)); -colorDb.put("RED", types.color(255, 0, 0)); -colorDb.put("ORANGERED", types.color(255, 69, 0)); -colorDb.put("TOMATO", types.color(255, 99, 71)); -colorDb.put("DARKRED", types.color(139, 0, 0)); -colorDb.put("RED", types.color(255, 0, 0)); -colorDb.put("FIREBRICK", types.color(178, 34, 34)); -colorDb.put("CRIMSON", types.color(220, 20, 60)); -colorDb.put("DEEPPINK", types.color(255, 20, 147)); -colorDb.put("MAROON", types.color(176, 48, 96)); -colorDb.put("INDIAN RED", types.color(205, 92, 92)); -colorDb.put("INDIANRED", types.color(205, 92, 92)); -colorDb.put("MEDIUM VIOLET RED", types.color(199, 21, 133)); -colorDb.put("MEDIUMVIOLETRED", types.color(199, 21, 133)); -colorDb.put("VIOLET RED", types.color(208, 32, 144)); -colorDb.put("VIOLETRED", types.color(208, 32, 144)); -colorDb.put("LIGHTCORAL", types.color(240, 128, 128)); -colorDb.put("HOTPINK", types.color(255, 105, 180)); -colorDb.put("PALEVIOLETRED", types.color(219, 112, 147)); -colorDb.put("LIGHTPINK", types.color(255, 182, 193)); -colorDb.put("ROSYBROWN", types.color(188, 143, 143)); -colorDb.put("PINK", types.color(255, 192, 203)); -colorDb.put("ORCHID", types.color(218, 112, 214)); -colorDb.put("LAVENDERBLUSH", types.color(255, 240, 245)); -colorDb.put("SNOW", types.color(255, 250, 250)); -colorDb.put("CHOCOLATE", types.color(210, 105, 30)); -colorDb.put("SADDLEBROWN", types.color(139, 69, 19)); -colorDb.put("BROWN", types.color(132, 60, 36)); -colorDb.put("DARKORANGE", types.color(255, 140, 0)); -colorDb.put("CORAL", types.color(255, 127, 80)); -colorDb.put("SIENNA", types.color(160, 82, 45)); -colorDb.put("ORANGE", types.color(255, 165, 0)); -colorDb.put("SALMON", types.color(250, 128, 114)); -colorDb.put("PERU", types.color(205, 133, 63)); -colorDb.put("DARKGOLDENROD", types.color(184, 134, 11)); -colorDb.put("GOLDENROD", types.color(218, 165, 32)); -colorDb.put("SANDYBROWN", types.color(244, 164, 96)); -colorDb.put("LIGHTSALMON", types.color(255, 160, 122)); -colorDb.put("DARKSALMON", types.color(233, 150, 122)); -colorDb.put("GOLD", types.color(255, 215, 0)); -colorDb.put("YELLOW", types.color(255, 255, 0)); -colorDb.put("OLIVE", types.color(128, 128, 0)); -colorDb.put("BURLYWOOD", types.color(222, 184, 135)); -colorDb.put("TAN", types.color(210, 180, 140)); -colorDb.put("NAVAJOWHITE", types.color(255, 222, 173)); -colorDb.put("PEACHPUFF", types.color(255, 218, 185)); -colorDb.put("KHAKI", types.color(240, 230, 140)); -colorDb.put("DARKKHAKI", types.color(189, 183, 107)); -colorDb.put("MOCCASIN", types.color(255, 228, 181)); -colorDb.put("WHEAT", types.color(245, 222, 179)); -colorDb.put("BISQUE", types.color(255, 228, 196)); -colorDb.put("PALEGOLDENROD", types.color(238, 232, 170)); -colorDb.put("BLANCHEDALMOND", types.color(255, 235, 205)); -colorDb.put("MEDIUM GOLDENROD", types.color(234, 234, 173)); -colorDb.put("MEDIUMGOLDENROD", types.color(234, 234, 173)); -colorDb.put("PAPAYAWHIP", types.color(255, 239, 213)); -colorDb.put("MISTYROSE", types.color(255, 228, 225)); -colorDb.put("LEMONCHIFFON", types.color(255, 250, 205)); -colorDb.put("ANTIQUEWHITE", types.color(250, 235, 215)); -colorDb.put("CORNSILK", types.color(255, 248, 220)); -colorDb.put("LIGHTGOLDENRODYELLOW", types.color(250, 250, 210)); -colorDb.put("OLDLACE", types.color(253, 245, 230)); -colorDb.put("LINEN", types.color(250, 240, 230)); -colorDb.put("LIGHTYELLOW", types.color(255, 255, 224)); -colorDb.put("SEASHELL", types.color(255, 245, 238)); -colorDb.put("BEIGE", types.color(245, 245, 220)); -colorDb.put("FLORALWHITE", types.color(255, 250, 240)); -colorDb.put("IVORY", types.color(255, 255, 240)); -colorDb.put("GREEN", types.color(0, 255, 0)); -colorDb.put("LAWNGREEN", types.color(124, 252, 0)); -colorDb.put("CHARTREUSE", types.color(127, 255, 0)); -colorDb.put("GREEN YELLOW", types.color(173, 255, 47)); -colorDb.put("GREENYELLOW", types.color(173, 255, 47)); -colorDb.put("YELLOW GREEN", types.color(154, 205, 50)); -colorDb.put("YELLOWGREEN", types.color(154, 205, 50)); -colorDb.put("MEDIUM FOREST GREEN", types.color(107, 142, 35)); -colorDb.put("OLIVEDRAB", types.color(107, 142, 35)); -colorDb.put("MEDIUMFORESTGREEN", types.color(107, 142, 35)); -colorDb.put("DARK OLIVE GREEN", types.color(85, 107, 47)); -colorDb.put("DARKOLIVEGREEN", types.color(85, 107, 47)); -colorDb.put("DARKSEAGREEN", types.color(143, 188, 139)); -colorDb.put("LIME", types.color(0, 255, 0)); -colorDb.put("DARK GREEN", types.color(0, 100, 0)); -colorDb.put("DARKGREEN", types.color(0, 100, 0)); -colorDb.put("LIME GREEN", types.color(50, 205, 50)); -colorDb.put("LIMEGREEN", types.color(50, 205, 50)); -colorDb.put("FOREST GREEN", types.color(34, 139, 34)); -colorDb.put("FORESTGREEN", types.color(34, 139, 34)); -colorDb.put("SPRING GREEN", types.color(0, 255, 127)); -colorDb.put("SPRINGGREEN", types.color(0, 255, 127)); -colorDb.put("MEDIUM SPRING GREEN", types.color(0, 250, 154)); -colorDb.put("MEDIUMSPRINGGREEN", types.color(0, 250, 154)); -colorDb.put("SEA GREEN", types.color(46, 139, 87)); -colorDb.put("SEAGREEN", types.color(46, 139, 87)); -colorDb.put("MEDIUM SEA GREEN", types.color(60, 179, 113)); -colorDb.put("MEDIUMSEAGREEN", types.color(60, 179, 113)); -colorDb.put("AQUAMARINE", types.color(112, 216, 144)); -colorDb.put("LIGHTGREEN", types.color(144, 238, 144)); -colorDb.put("PALE GREEN", types.color(152, 251, 152)); -colorDb.put("PALEGREEN", types.color(152, 251, 152)); -colorDb.put("MEDIUM AQUAMARINE", types.color(102, 205, 170)); -colorDb.put("MEDIUMAQUAMARINE", types.color(102, 205, 170)); -colorDb.put("TURQUOISE", types.color(64, 224, 208)); -colorDb.put("LIGHTSEAGREEN", types.color(32, 178, 170)); -colorDb.put("MEDIUM TURQUOISE", types.color(72, 209, 204)); -colorDb.put("MEDIUMTURQUOISE", types.color(72, 209, 204)); -colorDb.put("HONEYDEW", types.color(240, 255, 240)); -colorDb.put("MINTCREAM", types.color(245, 255, 250)); -colorDb.put("ROYALBLUE", types.color(65, 105, 225)); -colorDb.put("DODGERBLUE", types.color(30, 144, 255)); -colorDb.put("DEEPSKYBLUE", types.color(0, 191, 255)); -colorDb.put("CORNFLOWERBLUE", types.color(100, 149, 237)); -colorDb.put("STEEL BLUE", types.color(70, 130, 180)); -colorDb.put("STEELBLUE", types.color(70, 130, 180)); -colorDb.put("LIGHTSKYBLUE", types.color(135, 206, 250)); -colorDb.put("DARK TURQUOISE", types.color(0, 206, 209)); -colorDb.put("DARKTURQUOISE", types.color(0, 206, 209)); -colorDb.put("CYAN", types.color(0, 255, 255)); -colorDb.put("AQUA", types.color(0, 255, 255)); -colorDb.put("DARKCYAN", types.color(0, 139, 139)); -colorDb.put("TEAL", types.color(0, 128, 128)); -colorDb.put("SKY BLUE", types.color(135, 206, 235)); -colorDb.put("SKYBLUE", types.color(135, 206, 235)); -colorDb.put("CADET BLUE", types.color(96, 160, 160)); -colorDb.put("CADETBLUE", types.color(95, 158, 160)); -colorDb.put("DARK SLATE GRAY", types.color(47, 79, 79)); -colorDb.put("DARKSLATEGRAY", types.color(47, 79, 79)); -colorDb.put("LIGHTSLATEGRAY", types.color(119, 136, 153)); -colorDb.put("SLATEGRAY", types.color(112, 128, 144)); -colorDb.put("LIGHT STEEL BLUE", types.color(176, 196, 222)); -colorDb.put("LIGHTSTEELBLUE", types.color(176, 196, 222)); -colorDb.put("LIGHT BLUE", types.color(173, 216, 230)); -colorDb.put("LIGHTBLUE", types.color(173, 216, 230)); -colorDb.put("POWDERBLUE", types.color(176, 224, 230)); -colorDb.put("PALETURQUOISE", types.color(175, 238, 238)); -colorDb.put("LIGHTCYAN", types.color(224, 255, 255)); -colorDb.put("ALICEBLUE", types.color(240, 248, 255)); -colorDb.put("AZURE", types.color(240, 255, 255)); -colorDb.put("MEDIUM BLUE", types.color(0, 0, 205)); -colorDb.put("MEDIUMBLUE", types.color(0, 0, 205)); -colorDb.put("DARKBLUE", types.color(0, 0, 139)); -colorDb.put("MIDNIGHT BLUE", types.color(25, 25, 112)); -colorDb.put("MIDNIGHTBLUE", types.color(25, 25, 112)); -colorDb.put("NAVY", types.color(36, 36, 140)); -colorDb.put("BLUE", types.color(0, 0, 255)); -colorDb.put("INDIGO", types.color(75, 0, 130)); -colorDb.put("BLUE VIOLET", types.color(138, 43, 226)); -colorDb.put("BLUEVIOLET", types.color(138, 43, 226)); -colorDb.put("MEDIUM SLATE BLUE", types.color(123, 104, 238)); -colorDb.put("MEDIUMSLATEBLUE", types.color(123, 104, 238)); -colorDb.put("SLATE BLUE", types.color(106, 90, 205)); -colorDb.put("SLATEBLUE", types.color(106, 90, 205)); -colorDb.put("PURPLE", types.color(160, 32, 240)); -colorDb.put("DARK SLATE BLUE", types.color(72, 61, 139)); -colorDb.put("DARKSLATEBLUE", types.color(72, 61, 139)); -colorDb.put("DARKVIOLET", types.color(148, 0, 211)); -colorDb.put("DARK ORCHID", types.color(153, 50, 204)); -colorDb.put("DARKORCHID", types.color(153, 50, 204)); -colorDb.put("MEDIUMPURPLE", types.color(147, 112, 219)); -colorDb.put("CORNFLOWER BLUE", types.color(68, 64, 108)); -colorDb.put("MEDIUM ORCHID", types.color(186, 85, 211)); -colorDb.put("MEDIUMORCHID", types.color(186, 85, 211)); -colorDb.put("MAGENTA", types.color(255, 0, 255)); -colorDb.put("FUCHSIA", types.color(255, 0, 255)); -colorDb.put("DARKMAGENTA", types.color(139, 0, 139)); -colorDb.put("VIOLET", types.color(238, 130, 238)); -colorDb.put("PLUM", types.color(221, 160, 221)); -colorDb.put("LAVENDER", types.color(230, 230, 250)); -colorDb.put("THISTLE", types.color(216, 191, 216)); -colorDb.put("GHOSTWHITE", types.color(248, 248, 255)); -colorDb.put("WHITE", types.color(255, 255, 255)); -colorDb.put("WHITESMOKE", types.color(245, 245, 245)); -colorDb.put("GAINSBORO", types.color(220, 220, 220)); -colorDb.put("LIGHT GRAY", types.color(211, 211, 211)); -colorDb.put("LIGHTGRAY", types.color(211, 211, 211)); -colorDb.put("SILVER", types.color(192, 192, 192)); -colorDb.put("GRAY", types.color(190, 190, 190)); -colorDb.put("DARK GRAY", types.color(169, 169, 169)); -colorDb.put("DARKGRAY", types.color(169, 169, 169)); -colorDb.put("DIM GRAY", types.color(105, 105, 105)); -colorDb.put("DIMGRAY", types.color(105, 105, 105)); -colorDb.put("BLACK", types.color(0, 0, 0)); +// colorDb.put("ORANGE", types.color(255, 165, 0)); +// colorDb.put("RED", types.color(255, 0, 0)); +// colorDb.put("ORANGERED", types.color(255, 69, 0)); +// colorDb.put("TOMATO", types.color(255, 99, 71)); +// colorDb.put("DARKRED", types.color(139, 0, 0)); +// colorDb.put("RED", types.color(255, 0, 0)); +// colorDb.put("FIREBRICK", types.color(178, 34, 34)); +// colorDb.put("CRIMSON", types.color(220, 20, 60)); +// colorDb.put("DEEPPINK", types.color(255, 20, 147)); +// colorDb.put("MAROON", types.color(176, 48, 96)); +// colorDb.put("INDIAN RED", types.color(205, 92, 92)); +// colorDb.put("INDIANRED", types.color(205, 92, 92)); +// colorDb.put("MEDIUM VIOLET RED", types.color(199, 21, 133)); +// colorDb.put("MEDIUMVIOLETRED", types.color(199, 21, 133)); +// colorDb.put("VIOLET RED", types.color(208, 32, 144)); +// colorDb.put("VIOLETRED", types.color(208, 32, 144)); +// colorDb.put("LIGHTCORAL", types.color(240, 128, 128)); +// colorDb.put("HOTPINK", types.color(255, 105, 180)); +// colorDb.put("PALEVIOLETRED", types.color(219, 112, 147)); +// colorDb.put("LIGHTPINK", types.color(255, 182, 193)); +// colorDb.put("ROSYBROWN", types.color(188, 143, 143)); +// colorDb.put("PINK", types.color(255, 192, 203)); +// colorDb.put("ORCHID", types.color(218, 112, 214)); +// colorDb.put("LAVENDERBLUSH", types.color(255, 240, 245)); +// colorDb.put("SNOW", types.color(255, 250, 250)); +// colorDb.put("CHOCOLATE", types.color(210, 105, 30)); +// colorDb.put("SADDLEBROWN", types.color(139, 69, 19)); +// colorDb.put("BROWN", types.color(132, 60, 36)); +// colorDb.put("DARKORANGE", types.color(255, 140, 0)); +// colorDb.put("CORAL", types.color(255, 127, 80)); +// colorDb.put("SIENNA", types.color(160, 82, 45)); +// colorDb.put("ORANGE", types.color(255, 165, 0)); +// colorDb.put("SALMON", types.color(250, 128, 114)); +// colorDb.put("PERU", types.color(205, 133, 63)); +// colorDb.put("DARKGOLDENROD", types.color(184, 134, 11)); +// colorDb.put("GOLDENROD", types.color(218, 165, 32)); +// colorDb.put("SANDYBROWN", types.color(244, 164, 96)); +// colorDb.put("LIGHTSALMON", types.color(255, 160, 122)); +// colorDb.put("DARKSALMON", types.color(233, 150, 122)); +// colorDb.put("GOLD", types.color(255, 215, 0)); +// colorDb.put("YELLOW", types.color(255, 255, 0)); +// colorDb.put("OLIVE", types.color(128, 128, 0)); +// colorDb.put("BURLYWOOD", types.color(222, 184, 135)); +// colorDb.put("TAN", types.color(210, 180, 140)); +// colorDb.put("NAVAJOWHITE", types.color(255, 222, 173)); +// colorDb.put("PEACHPUFF", types.color(255, 218, 185)); +// colorDb.put("KHAKI", types.color(240, 230, 140)); +// colorDb.put("DARKKHAKI", types.color(189, 183, 107)); +// colorDb.put("MOCCASIN", types.color(255, 228, 181)); +// colorDb.put("WHEAT", types.color(245, 222, 179)); +// colorDb.put("BISQUE", types.color(255, 228, 196)); +// colorDb.put("PALEGOLDENROD", types.color(238, 232, 170)); +// colorDb.put("BLANCHEDALMOND", types.color(255, 235, 205)); +// colorDb.put("MEDIUM GOLDENROD", types.color(234, 234, 173)); +// colorDb.put("MEDIUMGOLDENROD", types.color(234, 234, 173)); +// colorDb.put("PAPAYAWHIP", types.color(255, 239, 213)); +// colorDb.put("MISTYROSE", types.color(255, 228, 225)); +// colorDb.put("LEMONCHIFFON", types.color(255, 250, 205)); +// colorDb.put("ANTIQUEWHITE", types.color(250, 235, 215)); +// colorDb.put("CORNSILK", types.color(255, 248, 220)); +// colorDb.put("LIGHTGOLDENRODYELLOW", types.color(250, 250, 210)); +// colorDb.put("OLDLACE", types.color(253, 245, 230)); +// colorDb.put("LINEN", types.color(250, 240, 230)); +// colorDb.put("LIGHTYELLOW", types.color(255, 255, 224)); +// colorDb.put("SEASHELL", types.color(255, 245, 238)); +// colorDb.put("BEIGE", types.color(245, 245, 220)); +// colorDb.put("FLORALWHITE", types.color(255, 250, 240)); +// colorDb.put("IVORY", types.color(255, 255, 240)); +// colorDb.put("GREEN", types.color(0, 255, 0)); +// colorDb.put("LAWNGREEN", types.color(124, 252, 0)); +// colorDb.put("CHARTREUSE", types.color(127, 255, 0)); +// colorDb.put("GREEN YELLOW", types.color(173, 255, 47)); +// colorDb.put("GREENYELLOW", types.color(173, 255, 47)); +// colorDb.put("YELLOW GREEN", types.color(154, 205, 50)); +// colorDb.put("YELLOWGREEN", types.color(154, 205, 50)); +// colorDb.put("MEDIUM FOREST GREEN", types.color(107, 142, 35)); +// colorDb.put("OLIVEDRAB", types.color(107, 142, 35)); +// colorDb.put("MEDIUMFORESTGREEN", types.color(107, 142, 35)); +// colorDb.put("DARK OLIVE GREEN", types.color(85, 107, 47)); +// colorDb.put("DARKOLIVEGREEN", types.color(85, 107, 47)); +// colorDb.put("DARKSEAGREEN", types.color(143, 188, 139)); +// colorDb.put("LIME", types.color(0, 255, 0)); +// colorDb.put("DARK GREEN", types.color(0, 100, 0)); +// colorDb.put("DARKGREEN", types.color(0, 100, 0)); +// colorDb.put("LIME GREEN", types.color(50, 205, 50)); +// colorDb.put("LIMEGREEN", types.color(50, 205, 50)); +// colorDb.put("FOREST GREEN", types.color(34, 139, 34)); +// colorDb.put("FORESTGREEN", types.color(34, 139, 34)); +// colorDb.put("SPRING GREEN", types.color(0, 255, 127)); +// colorDb.put("SPRINGGREEN", types.color(0, 255, 127)); +// colorDb.put("MEDIUM SPRING GREEN", types.color(0, 250, 154)); +// colorDb.put("MEDIUMSPRINGGREEN", types.color(0, 250, 154)); +// colorDb.put("SEA GREEN", types.color(46, 139, 87)); +// colorDb.put("SEAGREEN", types.color(46, 139, 87)); +// colorDb.put("MEDIUM SEA GREEN", types.color(60, 179, 113)); +// colorDb.put("MEDIUMSEAGREEN", types.color(60, 179, 113)); +// colorDb.put("AQUAMARINE", types.color(112, 216, 144)); +// colorDb.put("LIGHTGREEN", types.color(144, 238, 144)); +// colorDb.put("PALE GREEN", types.color(152, 251, 152)); +// colorDb.put("PALEGREEN", types.color(152, 251, 152)); +// colorDb.put("MEDIUM AQUAMARINE", types.color(102, 205, 170)); +// colorDb.put("MEDIUMAQUAMARINE", types.color(102, 205, 170)); +// colorDb.put("TURQUOISE", types.color(64, 224, 208)); +// colorDb.put("LIGHTSEAGREEN", types.color(32, 178, 170)); +// colorDb.put("MEDIUM TURQUOISE", types.color(72, 209, 204)); +// colorDb.put("MEDIUMTURQUOISE", types.color(72, 209, 204)); +// colorDb.put("HONEYDEW", types.color(240, 255, 240)); +// colorDb.put("MINTCREAM", types.color(245, 255, 250)); +// colorDb.put("ROYALBLUE", types.color(65, 105, 225)); +// colorDb.put("DODGERBLUE", types.color(30, 144, 255)); +// colorDb.put("DEEPSKYBLUE", types.color(0, 191, 255)); +// colorDb.put("CORNFLOWERBLUE", types.color(100, 149, 237)); +// colorDb.put("STEEL BLUE", types.color(70, 130, 180)); +// colorDb.put("STEELBLUE", types.color(70, 130, 180)); +// colorDb.put("LIGHTSKYBLUE", types.color(135, 206, 250)); +// colorDb.put("DARK TURQUOISE", types.color(0, 206, 209)); +// colorDb.put("DARKTURQUOISE", types.color(0, 206, 209)); +// colorDb.put("CYAN", types.color(0, 255, 255)); +// colorDb.put("AQUA", types.color(0, 255, 255)); +// colorDb.put("DARKCYAN", types.color(0, 139, 139)); +// colorDb.put("TEAL", types.color(0, 128, 128)); +// colorDb.put("SKY BLUE", types.color(135, 206, 235)); +// colorDb.put("SKYBLUE", types.color(135, 206, 235)); +// colorDb.put("CADET BLUE", types.color(96, 160, 160)); +// colorDb.put("CADETBLUE", types.color(95, 158, 160)); +// colorDb.put("DARK SLATE GRAY", types.color(47, 79, 79)); +// colorDb.put("DARKSLATEGRAY", types.color(47, 79, 79)); +// colorDb.put("LIGHTSLATEGRAY", types.color(119, 136, 153)); +// colorDb.put("SLATEGRAY", types.color(112, 128, 144)); +// colorDb.put("LIGHT STEEL BLUE", types.color(176, 196, 222)); +// colorDb.put("LIGHTSTEELBLUE", types.color(176, 196, 222)); +// colorDb.put("LIGHT BLUE", types.color(173, 216, 230)); +// colorDb.put("LIGHTBLUE", types.color(173, 216, 230)); +// colorDb.put("POWDERBLUE", types.color(176, 224, 230)); +// colorDb.put("PALETURQUOISE", types.color(175, 238, 238)); +// colorDb.put("LIGHTCYAN", types.color(224, 255, 255)); +// colorDb.put("ALICEBLUE", types.color(240, 248, 255)); +// colorDb.put("AZURE", types.color(240, 255, 255)); +// colorDb.put("MEDIUM BLUE", types.color(0, 0, 205)); +// colorDb.put("MEDIUMBLUE", types.color(0, 0, 205)); +// colorDb.put("DARKBLUE", types.color(0, 0, 139)); +// colorDb.put("MIDNIGHT BLUE", types.color(25, 25, 112)); +// colorDb.put("MIDNIGHTBLUE", types.color(25, 25, 112)); +// colorDb.put("NAVY", types.color(36, 36, 140)); +// colorDb.put("BLUE", types.color(0, 0, 255)); +// colorDb.put("INDIGO", types.color(75, 0, 130)); +// colorDb.put("BLUE VIOLET", types.color(138, 43, 226)); +// colorDb.put("BLUEVIOLET", types.color(138, 43, 226)); +// colorDb.put("MEDIUM SLATE BLUE", types.color(123, 104, 238)); +// colorDb.put("MEDIUMSLATEBLUE", types.color(123, 104, 238)); +// colorDb.put("SLATE BLUE", types.color(106, 90, 205)); +// colorDb.put("SLATEBLUE", types.color(106, 90, 205)); +// colorDb.put("PURPLE", types.color(160, 32, 240)); +// colorDb.put("DARK SLATE BLUE", types.color(72, 61, 139)); +// colorDb.put("DARKSLATEBLUE", types.color(72, 61, 139)); +// colorDb.put("DARKVIOLET", types.color(148, 0, 211)); +// colorDb.put("DARK ORCHID", types.color(153, 50, 204)); +// colorDb.put("DARKORCHID", types.color(153, 50, 204)); +// colorDb.put("MEDIUMPURPLE", types.color(147, 112, 219)); +// colorDb.put("CORNFLOWER BLUE", types.color(68, 64, 108)); +// colorDb.put("MEDIUM ORCHID", types.color(186, 85, 211)); +// colorDb.put("MEDIUMORCHID", types.color(186, 85, 211)); +// colorDb.put("MAGENTA", types.color(255, 0, 255)); +// colorDb.put("FUCHSIA", types.color(255, 0, 255)); +// colorDb.put("DARKMAGENTA", types.color(139, 0, 139)); +// colorDb.put("VIOLET", types.color(238, 130, 238)); +// colorDb.put("PLUM", types.color(221, 160, 221)); +// colorDb.put("LAVENDER", types.color(230, 230, 250)); +// colorDb.put("THISTLE", types.color(216, 191, 216)); +// colorDb.put("GHOSTWHITE", types.color(248, 248, 255)); +// colorDb.put("WHITE", types.color(255, 255, 255)); +// colorDb.put("WHITESMOKE", types.color(245, 245, 245)); +// colorDb.put("GAINSBORO", types.color(220, 220, 220)); +// colorDb.put("LIGHT GRAY", types.color(211, 211, 211)); +// colorDb.put("LIGHTGRAY", types.color(211, 211, 211)); +// colorDb.put("SILVER", types.color(192, 192, 192)); +// colorDb.put("GRAY", types.color(190, 190, 190)); +// colorDb.put("DARK GRAY", types.color(169, 169, 169)); +// colorDb.put("DARKGRAY", types.color(169, 169, 169)); +// colorDb.put("DIM GRAY", types.color(105, 105, 105)); +// colorDb.put("DIMGRAY", types.color(105, 105, 105)); +// colorDb.put("BLACK", types.color(0, 0, 0)); + EXPORTS['_colorDb'] = colorDb; diff --git a/image/private/kernel.js b/image/private/kernel.js index a8f2642..3e67910 100644 --- a/image/private/kernel.js +++ b/image/private/kernel.js @@ -358,7 +358,7 @@ SceneImage.prototype.isEqual = function(other, aUnionFind) { var rec2 = other.children[i]; if (rec1[1] !== rec2[1] || rec1[2] !== rec2[2] || - !types.isEqual(rec1[0], + !plt.baselib.equality.equals(rec1[0], rec2[0], aUnionFind)) { return false; @@ -508,8 +508,8 @@ OverlayImage.prototype.isEqual = function(other, aUnionFind) { this.img1Dy == other.img1Dy && this.img2Dx == other.img2Dx && this.img2Dy == other.img2Dy && - types.isEqual(this.img1, other.img1, aUnionFind) && - types.isEqual(this.img2, other.img2, aUnionFind) ); + plt.baselib.equality.equals(this.img1, other.img1, aUnionFind) && + plt.baselib.equality.equals(this.img2, other.img2, aUnionFind) ); }; @@ -585,7 +585,7 @@ RotateImage.prototype.isEqual = function(other, aUnionFind) { this.angle == other.angle && this.translateX == other.translateX && this.translateY == other.translateY && - types.isEqual(this.img, other.img, aUnionFind) ); + plt.baselib.equality.equals(this.img, other.img, aUnionFind) ); }; ////////////////////////////////////////////////////////////////////// @@ -635,7 +635,7 @@ ScaleImage.prototype.isEqual = function(other, aUnionFind) { this.height == other.height && this.xFactor == other.xFactor && this.yFactor == other.yFactor && - types.isEqual(this.img, other.img, aUnionFind) ); + plt.baselib.equality.equals(this.img, other.img, aUnionFind) ); }; ////////////////////////////////////////////////////////////////////// @@ -697,7 +697,7 @@ RectangleImage.prototype.isEqual = function(other, aUnionFind) { this.width == other.width && this.height == other.height && this.style == other.style && - types.isEqual(this.color, other.color, aUnionFind)); + plt.baselib.equality.equals(this.color, other.color, aUnionFind)); }; @@ -749,7 +749,7 @@ TextImage.prototype.isEqual = function(other, aUnionFind) { this.pinholeY == other.pinholeY && this.msg == other.msg && this.size == other.size && - types.isEqual(this.color, other.color, aUnionFind) && + plt.baselib.equality.equals(this.color, other.color, aUnionFind) && this.font == other.font); }; @@ -796,7 +796,7 @@ CircleImage.prototype.isEqual = function(other, aUnionFind) { this.pinholeY == other.pinholeY && this.radius == other.radius && this.style == other.style && - types.isEqual(this.color, other.color, aUnionFind)); + plt.baselib.equality.equals(this.color, other.color, aUnionFind)); }; @@ -866,7 +866,7 @@ StarImage.prototype.isEqual = function(other, aUnionFind) { this.outer == other.outer && this.inner == other.inner && this.style == other.style && - types.isEqual(this.color, other.color, aUnionFind)); + plt.baselib.equality.equals(this.color, other.color, aUnionFind)); }; @@ -924,7 +924,7 @@ TriangleImage.prototype.isEqual = function(other, aUnionFind) { this.pinholeY == other.pinholeY && this.side == other.side && this.style == other.style && - types.isEqual(this.color, other.color, aUnionFind)); + plt.baselib.equality.equals(this.color, other.color, aUnionFind)); }; @@ -988,7 +988,7 @@ EllipseImage.prototype.isEqual = function(other, aUnionFind) { this.width == other.width && this.height == other.height && this.style == other.style && - types.isEqual(this.color, other.color, aUnionFind)); + plt.baselib.equality.equals(this.color, other.color, aUnionFind)); }; @@ -1063,7 +1063,7 @@ LineImage.prototype.isEqual = function(other, aUnionFind) { this.pinholeY == other.pinholeY && this.x == other.x && this.y == other.y && - types.isEqual(this.color, other.color, aUnionFind)); + plt.baselib.equality.equals(this.color, other.color, aUnionFind)); }; @@ -1081,9 +1081,9 @@ LineImage.prototype.isEqual = function(other, aUnionFind) { @param aCompEffect a compound effect is either a scheme list of compound effects or a single primitive effect */ world.Kernel.applyEffect = function(aCompEffect) { - if ( types.isEmpty(aCompEffect) ) { + if ( plt.baselib.lists.isEmpty(aCompEffect) ) { // Do Nothing - } else if ( types.isPair(aCompEffect) ) { + } else if ( plt.baselib.lists.isPair(aCompEffect) ) { var results = world.Kernel.applyEffect(aCompEffect.first()); return results.concat(world.Kernel.applyEffect(aCompEffect.rest())); } else { @@ -1135,7 +1135,7 @@ world.Kernel.isImage = isImage; world.Kernel.isScene = isScene; world.Kernel.isColor = function(thing) { return (types.isColor(thing) || - ((types.isString(thing) || types.isSymbol(thing)) && + ((types.isString(thing) || plt.baselib.symbols.isSymbol(thing)) && typeof(colorDb.get(thing)) != 'undefined')); }; world.Kernel.colorDb = colorDb; @@ -1401,9 +1401,9 @@ world.Kernel.stimuli = world.stimuli; // args: [eventName, vals] StimuliHandler.prototype.onAnnounce = function(args, k) { var vals = args[1]; - var valsList = types.EMPTY; + var valsList = plt.baselib.lists.EMPTY; for (var i = 0; i < vals.length; i++) { - valsList = types.cons(vals[vals.length - i - 1], valsList); + valsList = plt.baselib.lists.makeCons(vals[vals.length - i - 1], valsList); } var onAnnounce = this.lookup('onAnnounce'); @@ -1430,7 +1430,7 @@ world.Kernel.stimuli = world.stimuli; ////////////////////////////////////////////////////////////////////// // Helpers - var flt = types.float; + var flt = plt.baselib.numbers.makeFloat; StimuliHandler.prototype.lookup = function(s) { return this.config.lookup(s); diff --git a/js-assembler/package.rkt b/js-assembler/package.rkt index 4c84747..a4506dc 100644 --- a/js-assembler/package.rkt +++ b/js-assembler/package.rkt @@ -339,7 +339,7 @@ var invokeMainModule = function() { console.log(e.stack || e); } MACHINE.params.currentErrorDisplayer( - MACHINE, $(plt.helpers.toDomNode(e.stack || e)).css('color', 'red')); + MACHINE, $(plt.baselib.format.toDomNode(e.stack || e)).css('color', 'red')); })}, function() { // On module loading failure diff --git a/js-assembler/runtime-src/baselib-lists.js b/js-assembler/runtime-src/baselib-lists.js index 4750417..e87e698 100644 --- a/js-assembler/runtime-src/baselib-lists.js +++ b/js-assembler/runtime-src/baselib-lists.js @@ -150,9 +150,11 @@ var isPair = function(x) { return x instanceof Cons; }; - var makePair = Cons.makeInstance; + var isEmpty = function(x) { return x === Empty.EMPTY; }; + var makePair = Cons.makeInstance; + var makeList = function() { var result = Empty.EMPTY; for(var i = arguments.length-1; i >= 0; i--) { @@ -177,6 +179,9 @@ + + + ////////////////////////////////////////////////////////////////////// exports.EMPTY = Empty.EMPTY; @@ -184,6 +189,7 @@ exports.Cons = Cons; exports.isPair = isPair; exports.isList = isList; + exports.isEmpty = isEmpty; exports.makePair = makePair; exports.makeList = makeList; diff --git a/js-assembler/runtime-src/baselib-symbols.js b/js-assembler/runtime-src/baselib-symbols.js index 9536f0b..b294e68 100644 --- a/js-assembler/runtime-src/baselib-symbols.js +++ b/js-assembler/runtime-src/baselib-symbols.js @@ -46,8 +46,13 @@ }; + var isSymbol = function(x) { return x instanceof Symbol; }; + + + ////////////////////////////////////////////////////////////////////// exports.Symbol = Symbol; + exports.isSymbol = isSymbol; })(this['plt'].baselib); \ No newline at end of file diff --git a/lang/js/record.rkt b/lang/js/record.rkt index 7f3b235..1c9ac71 100644 --- a/lang/js/record.rkt +++ b/lang/js/record.rkt @@ -7,7 +7,7 @@ record-redirection! follow-redirection - record-exported-name! + #;record-exported-name! collect-redirections-to) @@ -66,7 +66,7 @@ (loop (cdr redirections))]))) -(define (record-exported-name! a-path internal-name external-name) +#;(define (record-exported-name! a-path internal-name external-name) (printf "I need to remember to export ~s as ~s\n" internal-name external-name) (void)) diff --git a/logger.rkt b/logger.rkt index 03b4ca6..33aaee1 100644 --- a/logger.rkt +++ b/logger.rkt @@ -30,7 +30,7 @@ -(define should-print-logs? #t) +(define should-print-logs? #f) (define (set-whalesong-log-printing! v) (set! should-print-logs? v)) diff --git a/tests/more-tests/colors.expected b/tests/more-tests/colors.expected new file mode 100644 index 0000000..6d2f0d9 --- /dev/null +++ b/tests/more-tests/colors.expected @@ -0,0 +1,6 @@ +(color 3 4 5 0) +(color 3 5 7 0) +3 +1 +4 +5 diff --git a/tests/more-tests/colors.rkt b/tests/more-tests/colors.rkt new file mode 100644 index 0000000..e8551ca --- /dev/null +++ b/tests/more-tests/colors.rkt @@ -0,0 +1,12 @@ +#lang planet dyoo/whalesong + +(require (planet dyoo/whalesong/image)) +(color 3 4 5 0) +(make-color 3 5 7 0) + + +(define c1 (color 3 1 4 5)) +(color-red c1) +(color-green c1) +(color-blue c1) +(color-alpha c1) \ No newline at end of file diff --git a/tests/more-tests/run-more-tests.rkt b/tests/more-tests/run-more-tests.rkt deleted file mode 100644 index 4c0eaff..0000000 --- a/tests/more-tests/run-more-tests.rkt +++ /dev/null @@ -1,14 +0,0 @@ -#lang racket - -(require "../browser-harness.rkt") - -;; Each of the tests below do a string-compare of the standard output -;; content vs. a text file with the same name, but with the .rkt file -;; type replaced with .expected. - -(test "hello.rkt") -(test "conform.rkt") -(test "sk-generator.rkt") -(test "sk-generator-2.rkt") -(test "simple-structs.rkt") -(test "man-vs-boy.rkt") \ No newline at end of file diff --git a/tests/run-more-tests.rkt b/tests/run-more-tests.rkt new file mode 100644 index 0000000..20a0b5f --- /dev/null +++ b/tests/run-more-tests.rkt @@ -0,0 +1,15 @@ +#lang racket + +(require "browser-harness.rkt") + +;; Each of the tests below do a string-compare of the standard output +;; content vs. a text file with the same name, but with the .rkt file +;; type replaced with .expected. + +(test "more-tests/hello.rkt") +(test "more-tests/conform.rkt") +(test "more-tests/sk-generator.rkt") +(test "more-tests/sk-generator-2.rkt") +(test "more-tests/simple-structs.rkt") +(test "more-tests/man-vs-boy.rkt") +(test "more-tests/colors.rkt") diff --git a/whalesong.rkt b/whalesong.rkt index a7c2f0a..3ae44f5 100755 --- a/whalesong.rkt +++ b/whalesong.rkt @@ -3,9 +3,11 @@ (require racket/list racket/string + racket/match "make/make-structs.rkt" "js-assembler/package.rkt" "private/command.rkt" + "logger.rkt" raco/command-name) @@ -27,35 +29,73 @@ +(define current-verbose? (make-parameter #f)) + (define (at-toplevel) (svn-style-command-line - #:program "whalesong" #;(short-program+command-name) + #:program "whalesong" ; (short-program+command-name) #:argv (current-command-line-arguments) "The Whalesong command-line tool for compiling Racket to JavaScript" ["build" "build a standalone xhtml package" "Builds a Racket program and its required dependencies into a standalone .xhtml file." + #:once-each + [("-v" "--verbose") + ("Display verbose messages.") + (current-verbose? #t)] #:args (path) (do-the-build path)] ["get-runtime" "print the runtime library to standard output" "Prints the runtime JavaScript library that's used by Whalesong programs." + #:once-each + [("-v" "--verbose") + ("Display verbose messages.") + (current-verbose? #t)] #:args () (print-the-runtime)] ["get-javascript" "Gets just the JavaScript code and prints it to standard output" "Builds a racket program into JavaScript. The outputted file depends on the runtime." + #:once-each + [("-v" "--verbose") + ("Display verbose messages.") + (current-verbose? #t)] + #:args (file) (get-javascript-code file)])) + + +(define (turn-on-logger!) + (void (thread (lambda () + (let ([receiver + (make-log-receiver whalesong-logger + (if (current-verbose?) + 'debug + 'info))]) + (let loop () + (let ([msg (sync receiver)]) + (match msg + [(vector level msg data) + (printf "~a: ~a\n" level msg)])) + (loop))))))) + + + + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (do-the-build f) + (turn-on-logger!) (let-values ([(base filename dir?) (split-path f)]) (let ([output-filename (build-path - (regexp-replace #rx"[.](rkt|ss)$" (path->string filename) ".xhtml"))]) + (regexp-replace #rx"[.](rkt|ss)$" + (path->string filename) + ".xhtml"))]) (call-with-output-file* output-filename (lambda (op) (package-standalone-xhtml @@ -68,12 +108,16 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (print-the-runtime) + (turn-on-logger!) (write-runtime (current-output-port))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (get-javascript-code filename) - (write-standalone-code (make-ModuleSource (build-path filename)) (current-output-port))) + (turn-on-logger!) + (write-standalone-code + (make-ModuleSource (build-path filename)) + (current-output-port))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;