1 /* libwmf ("ipa/svg.h"): library for wmf conversion 2 Copyright (C) 2000 - various; see CREDITS, ChangeLog, and sources 3 4 The libwmf Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public License as 6 published by the Free Software Foundation; either version 2 of the 7 License, or (at your option) any later version. 8 9 The libwmf Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public 15 License along with the libwmf Library; see the file COPYING. If not, 16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Boston, MA 02111-1307, USA. */ 18 19 20 #ifndef WMFIPA_SVG_H 21 #define WMFIPA_SVG_H 22 23 typedef enum 24 { svg_arc_open, 25 svg_arc_pie, 26 svg_arc_chord 27 } svg_arc_t; 28 29 static void svg_draw_arc (wmfAPI*,wmfDrawArc_t*,svg_arc_t); 30 31 typedef struct _svgPoint svgPoint; 32 33 struct _svgPoint 34 { float x; 35 float y; 36 }; 37 38 static svgPoint svg_translate (wmfAPI*,wmfD_Coord); 39 40 static float svg_width (wmfAPI*,float); 41 static float svg_height (wmfAPI*,float); 42 43 static void svg_style_stroke (wmfAPI*,wmfDC*); 44 static void svg_style_fill (wmfAPI*,wmfDC*); 45 46 typedef struct _svgFont svgFont; 47 48 struct _svgFont 49 { char* ps_name; 50 char* family; 51 char* style; 52 char* weight; 53 }; 54 55 static svgFont svg_font (char*); 56 57 static svgFont svg_known_fonts[] = { 58 { "Courier", "Courier", "normal", "normal" }, 59 { "Courier-Oblique", "Courier", "oblique", "normal" }, 60 { "Courier-Bold", "Courier", "normal", "bold" }, 61 { "Courier-BoldOblique", "Courier", "oblique", "bold" }, 62 { "Helvetica", "Helvetica", "normal", "normal" }, 63 { "Helvetica-Oblique", "Helvetica", "oblique", "normal" }, 64 { "Helvetica-Bold", "Helvetica", "normal", "bold" }, 65 { "Helvetica-BoldOblique","Helvetica", "oblique", "bold" }, 66 { "Times-Roman", "Times", "normal", "normal" }, 67 { "Times-Italic", "Times", "italic", "normal" }, 68 { "Times-Bold", "Times", "normal", "bold" }, 69 { "Times-BoldItalic", "Times", "italic", "bold" }, 70 { "Symbol", "Symbol", "normal", "normal" }, 71 { 0, "Times", "normal", "normal" } /* default */ 72 }; 73 74 typedef struct _svgColor svgColor; 75 76 struct _svgColor 77 { char* name; 78 79 unsigned char r; 80 unsigned char g; 81 unsigned char b; 82 }; 83 84 static char* svg_color_closest (wmfRGB*); 85 86 /* These are the colors defined in the SVG standard 87 */ 88 static svgColor svg_named_color[147] = { 89 { "aliceblue", 240, 248, 255 }, 90 { "antiquewhite", 250, 235, 215 }, 91 { "aqua", 0, 255, 255 }, 92 { "aquamarine", 127, 255, 212 }, 93 { "azure", 240, 255, 255 }, 94 { "beige", 245, 245, 220 }, 95 { "bisque", 255, 228, 196 }, 96 { "black", 0, 0, 0 }, 97 { "blanchedalmond", 255, 235, 205 }, 98 { "blue", 0, 0, 255 }, 99 { "blueviolet", 138, 43, 226 }, 100 { "brown", 165, 42, 42 }, 101 { "burlywood", 222, 184, 135 }, 102 { "cadetblue", 95, 158, 160 }, 103 { "chartreuse", 127, 255, 0 }, 104 { "chocolate", 210, 105, 30 }, 105 { "coral", 255, 127, 80 }, 106 { "cornflowerblue", 100, 149, 237 }, 107 { "cornsilk", 255, 248, 220 }, 108 { "crimson", 220, 20, 60 }, 109 { "cyan", 0, 255, 255 }, 110 { "darkblue", 0, 0, 139 }, 111 { "darkcyan", 0, 139, 139 }, 112 { "darkgoldenrod", 184, 134, 11 }, 113 { "darkgray", 169, 169, 169 }, 114 { "darkgreen", 0, 100, 0 }, 115 { "darkgrey", 169, 169, 169 }, 116 { "darkkhaki", 189, 183, 107 }, 117 { "darkmagenta", 139, 0, 139 }, 118 { "darkolivegreen", 85, 107, 47 }, 119 { "darkorange", 255, 140, 0 }, 120 { "darkorchid", 153, 50, 204 }, 121 { "darkred", 139, 0, 0 }, 122 { "darksalmon", 233, 150, 122 }, 123 { "darkseagreen", 143, 188, 143 }, 124 { "darkslateblue", 72, 61, 139 }, 125 { "darkslategray", 47, 79, 79 }, 126 { "darkslategrey", 47, 79, 79 }, 127 { "darkturquoise", 0, 206, 209 }, 128 { "darkviolet", 148, 0, 211 }, 129 { "deeppink", 255, 20, 147 }, 130 { "deepskyblue", 0, 191, 255 }, 131 { "dimgray", 105, 105, 105 }, 132 { "dimgrey", 105, 105, 105 }, 133 { "dodgerblue", 30, 144, 255 }, 134 { "firebrick", 178, 34, 34 }, 135 { "floralwhite", 255, 250, 240 }, 136 { "forestgreen", 34, 139, 34 }, 137 { "fuchsia", 255, 0, 255 }, 138 { "gainsboro", 220, 220, 220 }, 139 { "ghostwhite", 248, 248, 255 }, 140 { "gold", 255, 215, 0 }, 141 { "goldenrod", 218, 165, 32 }, 142 { "gray", 128, 128, 128 }, 143 { "grey", 128, 128, 128 }, 144 { "green", 0, 128, 0 }, 145 { "greenyellow", 173, 255, 47 }, 146 { "honeydew", 240, 255, 240 }, 147 { "hotpink", 255, 105, 180 }, 148 { "indianred", 205, 92, 92 }, 149 { "indigo", 75, 0, 130 }, 150 { "ivory", 255, 255, 240 }, 151 { "khaki", 240, 230, 140 }, 152 { "lavender", 230, 230, 250 }, 153 { "lavenderblush", 255, 240, 245 }, 154 { "lawngreen", 124, 252, 0 }, 155 { "lemonchiffon", 255, 250, 205 }, 156 { "lightblue", 173, 216, 230 }, 157 { "lightcoral", 240, 128, 128 }, 158 { "lightcyan", 224, 255, 255 }, 159 { "lightgoldenrodyellow", 250, 250, 210 }, 160 { "lightgray", 211, 211, 211 }, 161 { "lightgreen", 144, 238, 144 }, 162 { "lightgrey", 211, 211, 211 }, 163 { "lightpink", 255, 182, 193 }, 164 { "lightsalmon", 255, 160, 122 }, 165 { "lightseagreen", 32, 178, 170 }, 166 { "lightskyblue", 135, 206, 250 }, 167 { "lightslategray", 119, 136, 153 }, 168 { "lightslategrey", 119, 136, 153 }, 169 { "lightsteelblue", 176, 196, 222 }, 170 { "lightyellow", 255, 255, 224 }, 171 { "lime", 0, 255, 0 }, 172 { "limegreen", 50, 205, 50 }, 173 { "linen", 250, 240, 230 }, 174 { "magenta", 255, 0, 255 }, 175 { "maroon", 128, 0, 0 }, 176 { "mediumaquamarine", 102, 205, 170 }, 177 { "mediumblue", 0, 0, 205 }, 178 { "mediumorchid", 186, 85, 211 }, 179 { "mediumpurple", 147, 112, 219 }, 180 { "mediumseagreen", 60, 179, 113 }, 181 { "mediumslateblue", 123, 104, 238 }, 182 { "mediumspringgreen", 0, 250, 154 }, 183 { "mediumturquoise", 72, 209, 204 }, 184 { "mediumvioletred", 199, 21, 133 }, 185 { "midnightblue", 25, 25, 112 }, 186 { "mintcream", 245, 255, 250 }, 187 { "mistyrose", 255, 228, 225 }, 188 { "moccasin", 255, 228, 181 }, 189 { "navajowhite", 255, 222, 173 }, 190 { "navy", 0, 0, 128 }, 191 { "oldlace", 253, 245, 230 }, 192 { "olive", 128, 128, 0 }, 193 { "olivedrab", 107, 142, 35 }, 194 { "orange", 255, 165, 0 }, 195 { "orangered", 255, 69, 0 }, 196 { "orchid", 218, 112, 214 }, 197 { "palegoldenrod", 238, 232, 170 }, 198 { "palegreen", 152, 251, 152 }, 199 { "paleturquoise", 175, 238, 238 }, 200 { "palevioletred", 219, 112, 147 }, 201 { "papayawhip", 255, 239, 213 }, 202 { "peachpuff", 255, 218, 185 }, 203 { "peru", 205, 133, 63 }, 204 { "pink", 255, 192, 203 }, 205 { "plum", 221, 160, 221 }, 206 { "powderblue", 176, 224, 230 }, 207 { "purple", 128, 0, 128 }, 208 { "red", 255, 0, 0 }, 209 { "rosybrown", 188, 143, 143 }, 210 { "royalblue", 65, 105, 225 }, 211 { "saddlebrown", 139, 69, 19 }, 212 { "salmon", 250, 128, 114 }, 213 { "sandybrown", 244, 164, 96 }, 214 { "seagreen", 46, 139, 87 }, 215 { "seashell", 255, 245, 238 }, 216 { "sienna", 160, 82, 45 }, 217 { "silver", 192, 192, 192 }, 218 { "skyblue", 135, 206, 235 }, 219 { "slateblue", 106, 90, 205 }, 220 { "slategray", 112, 128, 144 }, 221 { "slategrey", 112, 128, 144 }, 222 { "snow", 255, 250, 250 }, 223 { "springgreen", 0, 255, 127 }, 224 { "steelblue", 70, 130, 180 }, 225 { "tan", 210, 180, 140 }, 226 { "teal", 0, 128, 128 }, 227 { "thistle", 216, 191, 216 }, 228 { "tomato", 255, 99, 71 }, 229 { "turquoise", 64, 224, 208 }, 230 { "violet", 238, 130, 238 }, 231 { "wheat", 245, 222, 179 }, 232 { "white", 255, 255, 255 }, 233 { "whitesmoke", 245, 245, 245 }, 234 { "yellow", 255, 255, 0 }, 235 { "yellowgreen", 154, 205, 50 }}; 236 237 #endif /* ! WMFIPA_SVG_H */ 238