comparison toolboxes/graph_visualisation/lib/lefty/dotty_draw.lefty @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 #
2 # dotty_draw: drawing functions and data structures
3 #
4 dotty.protogt.drawgraph = function (gt, views) {
5 local gid, eid, nid, graph;
6
7 graph = gt.graph;
8 gt.drawsgraph (gt, views, graph);
9 for (gid in graph.graphs)
10 gt.drawsgraph (gt, views, graph.graphs[gid]);
11 for (eid in graph.edges)
12 gt.drawedge (gt, views, graph.edges[eid]);
13 for (nid in graph.nodes)
14 gt.drawnode (gt, views, graph.nodes[nid]);
15 };
16 dotty.protogt.redrawgraph = function (gt, views) {
17 local vid;
18
19 for (vid in views)
20 clear (views[vid].canvas);
21 gt.drawgraph (gt, views);
22 };
23 dotty.protogt.setviewsize = function (views, r) {
24 local vid, vt, w2v, scale, attr;
25
26 for (vid in views) {
27 vt = views[vid];
28 vt.wrect = copy (r);
29 if (r[1].x == 0 | r[1].y == 0) {
30 attr = getwidgetattr (vt.scroll, [0 = 'size';]);
31 vt.wrect[1] = copy (attr.size);
32 }
33 if (vt.type == 'birdseye') {
34 attr = getwidgetattr (vt.scroll, [0 = 'size';]);
35 scale.x = (vt.wrect[1].x - vt.wrect[0].x) / attr.size.x;
36 scale.y = (vt.wrect[1].y - vt.wrect[0].y) / attr.size.y;
37 if (scale.x > 1 & scale.x > scale.y)
38 vt.w2v = scale.x;
39 else if (scale.y > 1)
40 vt.w2v = scale.y;
41 else
42 vt.w2v = 1;
43 }
44 w2v = vt.w2v;
45 vt.vsize = [
46 'x' = toint ((vt.wrect[1].x - vt.wrect[0].x) / w2v);
47 'y' = toint ((vt.wrect[1].y - vt.wrect[0].y) / w2v);
48 ];
49 setwidgetattr (vt.canvas, [
50 'window' = vt.wrect;
51 'viewport' = vt.vsize;
52 ]);
53 attr = getwidgetattr (vt.canvas, [0 = 'viewport';]);
54 vt.vsize = copy (attr.viewport);
55 }
56 };
57 dotty.protogt.setviewscale = function (views, factor) {
58 local vid, vt, w2v, attr;
59
60 for (vid in views) {
61 vt = views[vid];
62 if ((w2v = vt.w2v * factor) < 0.01) {
63 dotty.message (0, 'cannot zoom any closer');
64 return;
65 }
66 vt.w2v = w2v;
67 vt.vsize = [
68 'x' = (vt.wrect[1].x - vt.wrect[0].x) / w2v;
69 'y' = (vt.wrect[1].y - vt.wrect[0].y) / w2v;
70 ];
71 setwidgetattr (vt.canvas, ['viewport' = vt.vsize;]);
72 attr = getwidgetattr (vt.canvas, [0 = 'viewport';]);
73 vt.vsize = copy (attr.viewport);
74 }
75 };
76 dotty.protogt.setviewcenter = function (views, center) {
77 local vid, vt, pos;
78
79 for (vid in views) {
80 vt = views[vid];
81 pos = [
82 'x' = center.x * vt.vsize.x / (vt.wrect[1].x - vt.wrect[0].x);
83 'y' = (
84 (vt.wrect[1].y - center.y) * vt.vsize.y /
85 (vt.wrect[1].y - vt.wrect[0].y)
86 );
87 ];
88 setwidgetattr (vt.scroll, ['childcenter' = pos;]);
89 }
90 };
91 #
92 # draw graph components
93 #
94 dotty.protogt.drawsgraph = function (gt, views, sgraph) {
95 sgraph.draw = 1;
96 if (~sgraph.draws)
97 return;
98 gt.execalldraw (gt, views, null, sgraph.draws, [
99 'fontname' = sgraph.fontname;
100 'fontsize' = sgraph.fontsize;
101 'fontcolor' = sgraph.fontcolor;
102 'drawcolor' = sgraph.drawcolor;
103 'fillcolor' = sgraph.fillcolor;
104 ]);
105 };
106 dotty.protogt.undrawsgraph = function (gt, views, sgraph) {
107 sgraph.drawn = 0;
108 if (~sgraph.draws)
109 return;
110 gt.execalldraw (gt, views, null, sgraph.draws, [
111 'fontname' = sgraph.fontname;
112 'fontsize' = sgraph.fontsize;
113 'fontcolor' = sgraph.fontcolor;
114 'drawcolor' = 0;
115 'fillcolor' = 0;
116 ]);
117 };
118 dotty.protogt.drawnode = function (gt, views, node) {
119 local vid;
120
121 node.drawn = 1;
122 if (~node.draws)
123 return;
124 gt.execalldraw (gt, views, node, node.draws, [
125 'fontname' = node.fontname;
126 'fontsize' = node.fontsize;
127 'fontcolor' = node.fontcolor;
128 'drawcolor' = node.drawcolor;
129 'fillcolor' = node.fillcolor;
130 ]);
131 for (vid in views)
132 setpick (views[vid].canvas, node, node.rect);
133 };
134 dotty.protogt.undrawnode = function (gt, views, node) {
135 local vid;
136
137 if (~node.drawn)
138 return;
139 node.drawn = 0;
140 if (~node.pos)
141 return;
142 gt.execalldraw (gt, views, node, node.draws, [
143 'nooverride' = 1;
144 'fontname' = node.fontname;
145 'fontsize' = node.fontsize;
146 'fontcolor' = 0;
147 'drawcolor' = 0;
148 'fillcolor' = 0;
149 ]);
150 for (vid in views)
151 clearpick (views[vid].canvas, node);
152 };
153 dotty.protogt.movenode = function (gt, node, pos) {
154 local dp, eid, edge;
155
156 dp.x = pos.x - node.pos.x;
157 dp.y = pos.y - node.pos.y;
158 gt.undrawnode (gt, gt.views, node);
159 node.pos.x = pos.x;
160 node.pos.y = pos.y;
161 gt.movenodedraw (node.draws, dp);
162 for (eid in node.edges) {
163 edge = node.edges[eid];
164 gt.undrawedge (gt, gt.views, edge);
165 gt.moveedgedraw (edge.draws, edge.tail.pos, edge.head.pos);
166 gt.drawedge (gt, gt.views, edge);
167 }
168 gt.drawnode (gt, gt.views, node);
169 };
170 dotty.protogt.drawedge = function (gt, views, edge) {
171 local vid, canvas;
172
173 edge.drawn = 1;
174 if (~edge.draws)
175 return;
176 gt.execalldraw (gt, views, edge, edge.draws, [
177 'fontname' = edge.fontname;
178 'fontsize' = edge.fontsize;
179 'fontcolor' = edge.fontcolor;
180 'drawcolor' = edge.drawcolor;
181 'fillcolor' = edge.fillcolor;
182 ]);
183 for (vid in views) {
184 canvas = views[vid].canvas;
185 if (gt.edgehandles == 0 | ~edge.draws.ep)
186 continue;
187 arc (canvas, edge, edge.draws.ep, ['x' = 5; 'y' = 5;], ['color' = 1;]);
188 }
189 };
190 dotty.protogt.undrawedge = function (gt, views, edge) {
191 local vid, canvas;
192
193 if (~edge.drawn)
194 return;
195 edge.drawn = 0;
196 if (~edge.draws)
197 return;
198 gt.execalldraw (gt, views, edge, edge.draws, [
199 'nooverride' = 1;
200 'fontname' = edge.fontname;
201 'fontsize' = edge.fontsize;
202 'fontcolor' = 0;
203 'drawcolor' = 0;
204 'fillcolor' = 0;
205 ]);
206 for (vid in views) {
207 canvas = views[vid].canvas;
208 if (gt.edgehandles == 0 | ~edge.draws.ep)
209 continue;
210 arc (canvas, edge, edge.draws.ep, ['x' = 5; 'y' = 5;], ['color' = 0;]);
211 clearpick (canvas, edge);
212 }
213 };
214 #
215 # draw directives
216 #
217 dotty.protogt.execalldraw = function (gt, views, obj, draws, gc) {
218 local vid, vt, did, draw, i, func;
219
220 for (vid in views) {
221 vt = views[vid];
222 for (did in draws) {
223 if (did == 'ep')
224 continue;
225 draw = draws[did];
226 for (i = 0; draw[i]; i = i + 1)
227 if ((func = gt.drawfunc[draw[i].type]))
228 func (gt, vt.canvas, obj, draw[i], gc);
229 }
230 }
231 };
232 dotty.protogt.drawfunc.E = function (gt, canvas, obj, data, gc) {
233 arc (canvas, obj, data.c, data.s, [
234 'color' = gc.fillcolor; 'style' = gc.style; 'width' = gc.width;
235 'fill' = 'on';
236 ]);
237 arc (canvas, obj, data.c, data.s, [
238 'color' = gc.drawcolor; 'style' = gc.style; 'width' = gc.width;
239 ]);
240 };
241 dotty.protogt.drawfunc.e = function (gt, canvas, obj, data, gc) {
242 arc (canvas, obj, data.c, data.s, [
243 'color' = gc.drawcolor; 'style' = gc.style; 'width' = gc.width;
244 ]);
245 };
246 dotty.protogt.drawfunc.P = function (gt, canvas, obj, data, gc) {
247 polygon (canvas, obj, data.ps, [
248 'color' = gc.fillcolor; 'style' = gc.style; 'width' = gc.width;
249 'fill' = 'on';
250 ]);
251 polygon (canvas, obj, data.ps, [
252 'color' = gc.drawcolor; 'style' = gc.style; 'width' = gc.width;
253 ]);
254 };
255 dotty.protogt.drawfunc.p = function (gt, canvas, obj, data, gc) {
256 polygon (canvas, obj, data.ps, [
257 'color' = gc.drawcolor; 'style' = gc.style; 'width' = gc.width;
258 ]);
259 };
260 dotty.protogt.drawfunc.L = function (gt, canvas, obj, data, gc) {
261 polygon (canvas, obj, data.ps, [
262 'color' = gc.drawcolor; 'style' = gc.style; 'width' = gc.width;
263 ]);
264 };
265 dotty.protogt.drawfunc.b = function (gt, canvas, obj, data, gc) {
266 splinegon (canvas, obj, data.ps, [
267 'color' = gc.fillcolor; 'style' = gc.style; 'width' = gc.width;
268 'fill' = 'on';
269 ]);
270 };
271 dotty.protogt.drawfunc.B = function (gt, canvas, obj, data, gc) {
272 splinegon (canvas, obj, data.ps, [
273 'color' = gc.drawcolor; 'style' = gc.style; 'width' = gc.width;
274 ]);
275 };
276 dotty.protogt.drawfunc.T = function (gt, canvas, obj, data, gc) {
277 text (canvas, obj, data.p, data.s, gc.fontname, gc.fontsize, data.j, [
278 'color' = gc.fontcolor; 'style' = gc.style; 'width' = gc.width;
279 ]);
280 };
281 dotty.protogt.drawfunc.C = function (gt, canvas, obj, data, gc) {
282 if (gc.nooverride ~= 1)
283 gc.fillcolor = data.fillcolor;
284 };
285 dotty.protogt.drawfunc.c = function (gt, canvas, obj, data, gc) {
286 if (gc.nooverride ~= 1) {
287 gc.drawcolor = data.drawcolor;
288 gc.fontcolor = data.drawcolor;
289 }
290 };
291 dotty.protogt.drawfunc.F = function (gt, canvas, obj, data, gc) {
292 gc.fontname = data.fn;
293 gc.fontsize = data.fs;
294 };
295 dotty.protogt.drawfunc.S = function (gt, canvas, obj, data, gc) {
296 gc.style = data.style;
297 gc.width = data.width;
298 };
299 dotty.protogt.movenodedraw = function (draws, dp) {
300 local did, draw, i, j;
301
302 for (did in draws) {
303 if (did == 'ep')
304 continue;
305 draw = draws[did];
306 for (i = 0; draw[i]; i = i + 1) {
307 if (draw[i].type == 'E' | draw[i].type == 'e') {
308 draw[i].c.x = draw[i].c.x + dp.x;
309 draw[i].c.y = draw[i].c.y + dp.y;
310 } else if (draw[i].type == 'P' | draw[i].type == 'p') {
311 for (j = 1; draw[i].ps[j]; j = j + 1) {
312 draw[i].ps[j].x = draw[i].ps[j].x + dp.x;
313 draw[i].ps[j].y = draw[i].ps[j].y + dp.y;
314 }
315 } else if (draw[i].type == 'L' | draw[i].type == 'B') {
316 for (j = 0; draw[i].ps[j]; j = j + 1) {
317 draw[i].ps[j].x = draw[i].ps[j].x + dp.x;
318 draw[i].ps[j].y = draw[i].ps[j].y + dp.y;
319 }
320 } else if (draw[i].type == 'T') {
321 draw[i].p.x = draw[i].p.x + dp.x;
322 draw[i].p.y = draw[i].p.y + dp.y;
323 }
324 }
325 }
326 };
327 dotty.protogt.moveedgedraw = function (draws, tp, hp) {
328 local draws2, did;
329
330 for (did in draws)
331 draws2[did] = draws[did];
332 for (did in draws2)
333 remove (did, draws);
334 draws[0] = [
335 0 = [
336 'type' = 'L';
337 'n' = 2;
338 'ps' = [
339 0 = copy (tp);
340 1 = copy (hp);
341 ];
342 ];
343 'ep' = ['x' = (tp.x + hp.x) / 2; 'y' = (tp.y + hp.y) / 2;];
344 ];
345 };
346 dotty.protogt.simplenodedraw = function (node, c, s) {
347 local draws;
348
349 if (node.attr.shape == 'ellipse')
350 draws[0] = [
351 0 = [
352 'type' = 'e';
353 'c' = copy (c);
354 's' = ['x' = s.x / 2; 'y' = s.y / 2;];
355 ];
356 ];
357 else
358 draws[0] = [
359 0 = [
360 'type' = 'p';
361 'n' = 5;
362 'ps' = [
363 0 = ['x' = c.x - s.x / 2; 'y' = c.y - s.y / 2;];
364 1 = ['x' = c.x + s.x / 2; 'y' = c.y - s.y / 2;];
365 2 = ['x' = c.x + s.x / 2; 'y' = c.y + s.y / 2;];
366 3 = ['x' = c.x - s.x / 2; 'y' = c.y + s.y / 2;];
367 4 = ['x' = c.x - s.x / 2; 'y' = c.y - s.y / 2;];
368 ];
369 ];
370 ];
371 return draws;
372 };
373 dotty.protogt.simpleedgedraw = function (edge, tp, hp) {
374 local draws;
375
376 draws[0] = [
377 0 = [
378 'type' = 'L';
379 'n' = 2;
380 'ps' = [
381 0 = copy (tp);
382 1 = copy (hp);
383 ];
384 ];
385 'ep' = ['x' = (tp.x + hp.x) / 2; 'y' = (tp.y + hp.y) / 2;];
386 ];
387 return draws;
388 };
389 #
390 # utilities
391 #
392 dotty.protogt.getcolor = function (views, name) {
393 local vid, vt, color, t;
394
395 for (vid in views) {
396 vt = views[vid];
397 if (~(color >= 0)) {
398 if (~(vt.colors[name] >= 0))
399 color = (vt.colors[name] = vt.colorn);
400 else {
401 color = vt.colors[name];
402 break;
403 }
404 } else if (~(vt.colors[name] >= 0))
405 vt.colors[name] = color;
406 else if (vt.colors[name] ~= color)
407 dotty.message (0, concat ('inconsistent color ids for ', name));
408 if (setwidgetattr (vt.canvas, ['color' = [color = name;];]) ~= 1) {
409 t = split (name, ' ');
410 if (tablesize (t) ~= 3 |
411 setwidgetattr (vt.canvas, ['color' = [color = [
412 'h' = ston (t[0]); 's' = ston (t[1]); 'v' = ston (t[2]);
413 ];];]) ~= 1) {
414 dotty.message (0, concat ('unknown color ', name, ' using #1'));
415 return 1;
416 }
417 }
418 vt.colorn = color + 1;
419 }
420 return color;
421 };
422 dotty.protogt.setbgcolor = function (views, name) {
423 local vid, vt, t;
424
425 for (vid in views) {
426 vt = views[vid];
427 if (setwidgetattr (vt.canvas, ['color' = [0 = name;];]) ~= 1) {
428 t = split (name, ' ');
429 if (tablesize (t) ~= 3 |
430 setwidgetattr (vt.canvas, ['color' = [0 = [
431 'h' = ston (t[0]); 's' = ston (t[1]); 'v' = ston (t[2]);
432 ];];]) ~= 1) {
433 dotty.message (0, concat ('unknown bgcolor ', name));
434 return;
435 }
436 }
437 vt.colors['_bgcolor_'] = name;
438 }
439 };
440 dotty.protogt.unpacksgraphattr = function (gt, sgraph) {
441 local attr;
442
443 attr = sgraph.graphattr;
444 if (dotty.fontmap[attr.fontname])
445 sgraph[dotty.keys.fname] = dotty.fontmap[attr.fontname];
446 else
447 sgraph[dotty.keys.fname] = attr.fontname;
448 sgraph[dotty.keys.fsize] = ston (attr.fontsize);
449 sgraph[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
450 if (attr.color)
451 sgraph[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
452 else
453 sgraph[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
454 if (attr.style == 'filled') {
455 if (attr.fillcolor)
456 sgraph[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.fillcolor);
457 else if (attr.color)
458 sgraph[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.color);
459 else
460 sgraph[dotty.keys.bcolor] = gt.getcolor (gt.views, 'lightgrey');
461 }
462 };
463 dotty.protogt.unpacknodeattr = function (gt, node) {
464 local attr;
465
466 attr = node.attr;
467 if (dotty.fontmap[attr.fontname])
468 node[dotty.keys.fname] = dotty.fontmap[attr.fontname];
469 else
470 node[dotty.keys.fname] = attr.fontname;
471 node[dotty.keys.fsize] = ston (attr.fontsize);
472 node[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
473 if (attr.color)
474 node[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
475 else
476 node[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
477 if (attr.style == 'filled') {
478 if (attr.fillcolor)
479 node[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.fillcolor);
480 else if (attr.color)
481 node[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.color);
482 else
483 node[dotty.keys.bcolor] = gt.getcolor (gt.views, 'lightgrey');
484 }
485 };
486 dotty.protogt.unpackedgeattr = function (gt, edge) {
487 local attr;
488
489 attr = edge.attr;
490 if (dotty.fontmap[attr.fontname])
491 edge[dotty.keys.fname] = dotty.fontmap[attr.fontname];
492 else
493 edge[dotty.keys.fname] = attr.fontname;
494 edge[dotty.keys.fsize] = ston (attr.fontsize);
495 edge[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
496 if (attr.color)
497 edge[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
498 else
499 edge[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
500 if (attr.style == 'filled') {
501 if (attr.fillcolor)
502 edge[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.fillcolor);
503 else if (attr.color)
504 edge[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.color);
505 else
506 edge[dotty.keys.bcolor] = gt.getcolor (gt.views, 'lightgrey');
507 }
508 };
509 dotty.protogt.unpackattr = function (gt) {
510 local gid, sgraph, nid, node, eid, edge, graph, attr;
511
512 graph = gt.graph;
513 attr = graph.graphattr;
514 if (dotty.fontmap[attr.fontname])
515 graph[dotty.keys.fname] = dotty.fontmap[attr.fontname];
516 else
517 graph[dotty.keys.fname] = attr.fontname;
518 graph[dotty.keys.fsize] = ston (attr.fontsize);
519 graph[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
520 if (attr.color)
521 graph[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
522 else
523 graph[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
524 if (attr.style == 'filled') {
525 if (attr.fillcolor)
526 graph[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.fillcolor);
527 else if (attr.color)
528 graph[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.color);
529 else
530 graph[dotty.keys.bcolor] = gt.getcolor (gt.views, 'lightgrey');
531 }
532 if (attr.bgcolor & attr.bgcolor ~= '')
533 gt.setbgcolor (gt.views, attr.bgcolor);
534 for (gid in graph.graphdict) {
535 sgraph = graph.graphs[graph.graphdict[gid]];
536 attr = sgraph.graphattr;
537 if (dotty.fontmap[attr.fontname])
538 sgraph[dotty.keys.fname] = dotty.fontmap[attr.fontname];
539 else
540 sgraph[dotty.keys.fname] = attr.fontname;
541 sgraph[dotty.keys.fsize] = ston (attr.fontsize);
542 sgraph[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
543 if (attr.color)
544 sgraph[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
545 else
546 sgraph[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
547 if (attr.style == 'filled') {
548 if (attr.fillcolor)
549 sgraph[dotty.keys.bcolor] = gt.getcolor (
550 gt.views, attr.fillcolor
551 );
552 else if (attr.color)
553 sgraph[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.color);
554 else
555 sgraph[dotty.keys.bcolor] = gt.getcolor (gt.views, 'lightgrey');
556 }
557 }
558 for (nid in graph.nodedict) {
559 node = graph.nodes[graph.nodedict[nid]];
560 attr = node.attr;
561 if (dotty.fontmap[attr.fontname])
562 node[dotty.keys.fname] = dotty.fontmap[attr.fontname];
563 else
564 node[dotty.keys.fname] = attr.fontname;
565 node[dotty.keys.fsize] = ston (attr.fontsize);
566 node[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
567 if (attr.color)
568 node[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
569 else
570 node[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
571 if (attr.style == 'filled') {
572 if (attr.fillcolor)
573 node[dotty.keys.bcolor] = gt.getcolor (
574 gt.views, attr.fillcolor
575 );
576 else if (attr.color)
577 node[dotty.keys.bcolor] = gt.getcolor (gt.views, attr.color);
578 else
579 node[dotty.keys.bcolor] = gt.getcolor (gt.views, 'lightgrey');
580 }
581 }
582 for (eid in graph.edges) {
583 edge = graph.edges[eid];
584 attr = edge.attr;
585 if (dotty.fontmap[attr.fontname])
586 edge[dotty.keys.fname] = dotty.fontmap[attr.fontname];
587 else
588 edge[dotty.keys.fname] = attr.fontname;
589 edge[dotty.keys.fsize] = ston (attr.fontsize);
590 edge[dotty.keys.fcolor] = gt.getcolor (gt.views, attr.fontcolor);
591 if (attr.color)
592 edge[dotty.keys.dcolor] = gt.getcolor (gt.views, attr.color);
593 else
594 edge[dotty.keys.dcolor] = gt.getcolor (gt.views, 'black');
595 }
596 };