2
This software may only be used by you under license from AT&T Corp.
3
("AT&T"). A copy of AT&T's Source Code Agreement is available at
4
AT&T's Internet website having the URL:
5
<http://www.research.att.com/sw/tools/graphviz/license/source.html>
6
If you received this software without first entering into a license
7
with AT&T, you have an infringing copy of this software and cannot use
8
it without violating AT&T's intellectual property rights.
19
typedef struct context_t {
20
char color_ix, *fontfam, fontopt, font_was_set;
21
char pen, fill, penwidth;
25
extern char *get_ttf_fontpath(char *fontreq, int warn);
26
extern pointf gdpt(pointf p);
27
extern void gd_font(context_t* cp);
34
/* ISMAP font modifiers */
42
#define P_DOTTED 4 /* i wasn't sure about this */
43
#define P_DASHED 11 /* or this */
45
#define SCALE (GD_RESOLUTION/72.0)
47
/* ISMAP bold line constant */
48
#define WIDTH_NORMAL 1
54
/* static int N_pages; */
55
/* static point Pages; */
60
static int onetime = TRUE;
63
static context_t cstk[MAXNEST];
76
cstk[0].color_ix = 0; /* ISMAP color index 0-7 */
77
cstk[0].fontfam = "Times"; /* font family name */
78
cstk[0].fontopt = REGULAR; /* modifier: REGULAR, BOLD or ITALIC */
79
cstk[0].pen = P_SOLID; /* pen pattern style, default is sold */
80
cstk[0].fill = P_NONE;
81
cstk[0].penwidth = WIDTH_NORMAL;
90
rv.x = p.x * Scale + Offset.x;
91
rv.y = PB.UR.y - PB.LL.y - p.y * Scale + Offset.y;
93
rv.x = PB.UR.x - PB.LL.x - p.y * Scale + Offset.x;
94
rv.y = PB.UR.y - PB.LL.y - p.x * Scale + Offset.y;
100
ismap_begin_job(FILE *ofp, graph_t *g, char **lib, char *user, char *info[], point pages)
104
/* N_pages = pages.x * pages.y; */
113
ismap_begin_graph(graph_t* g, box bb, point pb)
118
PB.LL.x = bb.LL.x * SCALE;
119
PB.LL.y = bb.LL.y * SCALE;
120
PB.UR.x = bb.UR.x * SCALE;
121
PB.UR.y = bb.UR.y * SCALE;
122
Offset.x = PB.LL.x + 1;
123
Offset.y = PB.LL.y + 1;
128
if ((s = agget(g, "URL")) && strlen(s))
129
fprintf(Outfile,"default %s %s\n",s, g->name);
133
ismap_end_graph(void)
138
ismap_begin_page(point page, double scale, int rot, point offset)
140
/* int page_number; */
143
Scale = scale * SCALE;
145
/* page_number = page.x + page.y * Pages.x + 1; */
146
/* sz = sub_points(PB.UR, PB.LL); */
155
ismap_begin_cluster(graph_t* g)
161
ismap_end_cluster(void)
167
ismap_begin_nodes(void)
173
ismap_end_nodes(void)
179
ismap_begin_edges(void)
185
ismap_end_edges(void)
191
ismap_begin_node(node_t* n)
193
char *s,*s1,*s2,*lab;
197
if ((s = agget(n, "URL")) && strlen(s)) {
198
p.x = n->u.coord.x - n->u.lw;
199
p.y = n->u.coord.y - (n->u.ht/2);
201
p.x = n->u.coord.x + n->u.rw;
202
p.y = n->u.coord.y + (n->u.ht/2);
206
if ((s2 = strstr(s,NODENAME_ESC))) {
214
lab = agget(n, "label");
215
if ((strcmp(lab,NODENAME_ESC)) == 0) {
218
fprintf(Outfile,"rectangle (%d,%d) (%d,%d) %s%s%s %s\n",
219
ROUND(p1.x),ROUND(p1.y),ROUND(p2.x),ROUND(p2.y),
233
ismap_begin_edge(edge_t* e)
246
ismap_begin_context(void)
248
assert(SP + 1 < MAXNEST);
249
cstk[SP + 1] = cstk[SP];
254
ismap_end_context(void)
258
if (cstk[SP].font_was_set)
259
gd_font(&(cstk[psp]));
264
ismap_set_font(char* name, double size)
270
cp->font_was_set = TRUE;
271
cp->fontsz = Scale * size;
273
if ((q = strchr(p, '-'))) {
275
if (strcasecmp(q, "italic") == 0)
276
cp->fontopt = ITALIC;
277
else if (strcasecmp(q, "bold") == 0)
286
ismap_set_color(char* name)
291
ismap_set_style(char** s)
296
ismap_textline(point p, textline_t *line)
298
char *fontlist, *err;
299
char *s,*s1,*s1h,*s1t,*s2;
300
char *str = line->str;
302
int intfontsz, brect[8];
303
extern gdFontPtr gdFontSmall;
308
if (!((s = agget(Edge, "URL")) && strlen(s)))
311
if ((s2 = strstr(s,NODENAME_ESC))) {
312
s1t = Edge->tail->name;
314
s1h = Edge->head->name;
318
s1 = s1h = s1t = s2 = "";
321
intfontsz = cstk[SP].fontsz;
322
fontlist = gd_alternate_fontlist(cstk[SP].fontfam);
324
mp.x = p.x; mp.y = p.y;
326
err = gdImageStringFT(NULL, brect, 0, fontlist,
327
(double)(intfontsz), (Rot? 90.0 : 0.0) * PI / 180.0,
328
ROUND(mp.x), ROUND(mp.y), str);
330
gdImageString(NULL, gdFontSmall, ROUND(mp.x), ROUND(mp.y),
331
(unsigned char *)str, 0);
333
fprintf(Outfile,"rectangle (%d,%d) (%d,%d) %s%s%s%s%s %s\n",
334
brect[0],brect[1],brect[4],brect[5],s,s1t,s1,s1h,s2,str);
339
ismap_bezier(point* A, int n, int arrow_at_start, int arrow_at_end)
344
ismap_polygon(point *A, int n, int filled)
349
p0.x = A[0].x; p0.y = A[0].y;
351
p.x = p0.x; p.y = p0.y;
352
for (i = 1; i < n; i++) {
353
/* p1.x = p.x; p1.y = p.y; */
354
p.x = A[i].x; p.y = A[i].y;
356
/* gdImageLine(im, ROUND(p1.x), ROUND(p1.y),
357
ROUND(p.x), ROUND(p.y), black); */
359
/* gdImageLine(im, ROUND(p.x), ROUND(p.y),
360
ROUND(p0.x), ROUND(p0.y), black); */
364
ismap_ellipse(point p, int rx, int ry, int filled)
368
mp.x = p.x; mp.y = p.y;
370
/* gdImageArc(im, ROUND(mp.x), ROUND(mp.y),
371
ROUND(Scale*(rx + rx)), ROUND(Scale*(ry + ry)), 0, 360, black); */
375
ismap_polyline(point* A, int n)
383
for (i = 1; i < n; i++) {
387
/* gdImageLine(im, ROUND(p.x), ROUND(p.y), ROUND(p1.x), ROUND(p1.y), black); */
394
ismap_user_shape(char *name, point *A,int n, int filled)
396
static boolean onetime = TRUE;
398
fprintf(stderr, "custom shapes not available with this driver\n");
401
ismap_polygon(A, n, filled);
404
codegen_t ISMAP_CodeGen = {
406
ismap_begin_job, ismap_end_job,
407
ismap_begin_graph, ismap_end_graph,
408
ismap_begin_page, ismap_end_page,
409
ismap_begin_cluster, ismap_end_cluster,
410
ismap_begin_nodes, ismap_end_nodes,
411
ismap_begin_edges, ismap_end_edges,
412
ismap_begin_node, ismap_end_node,
413
ismap_begin_edge, ismap_end_edge,
414
ismap_begin_context, ismap_end_context,
415
ismap_set_font, ismap_textline,
416
ismap_set_color, ismap_set_color, ismap_set_style,
417
ismap_ellipse, ismap_polygon,
418
ismap_bezier, ismap_polyline,
419
0 /* ismap_arrowhead */, ismap_user_shape,
420
0 /* ismap_comment */, gd_textsize