~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to grid/print.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <grid.h>
 
2
 
 
3
#ifdef DMALLOC
 
4
#include "dmalloc.h"
 
5
#endif
 
6
 
 
7
static void printseg(FILE *fp, Seg_t *seg)
 
8
{
 
9
        fprintf(fp,"%.2f %.2f map moveto %.2f %.2f map lineto stroke\n",
 
10
                x(seg->p[0]),y(seg->p[0]),x(seg->p[1]),y(seg->p[1]));
 
11
}
 
12
 
 
13
void ERprint(FILE *fp, ERview_t *d, ilbool all)
 
14
{
 
15
        int             i,j;
 
16
        Dir_t   side;
 
17
        Tile_t  *b;
 
18
        Seg_t   *seg;
 
19
        static int onetime = TRUE;
 
20
 
 
21
        if (onetime) {
 
22
                fprintf(fp,"%%!PS\n");
 
23
                fprintf(fp,"/map {72 mul exch 72 mul exch} bind def\n");
 
24
                onetime = FALSE;
 
25
        }
 
26
        for (i = 0; (b = d->config->list[i]); i++) {
 
27
                for (side = 0; side < NSIDES; side++) {
 
28
                        for (j = 0; (seg = b->segs[side]->list[j]); j++) {
 
29
                                switch (seg->kind) {
 
30
                                case s_forbidden:  break;
 
31
                                case s_plain: if (all) printseg(fp,seg); break;
 
32
                                case s_edge: 
 
33
                                        fprintf(fp,"gsave 1 0 0 setrgbcolor\n");
 
34
                                        printseg(fp,seg);
 
35
                                        fprintf(fp,"grestore\n");
 
36
                                        break;
 
37
                                case s_node:
 
38
                                        fprintf(fp,"gsave 3 setlinewidth\n");
 
39
                                        printseg(fp,seg);
 
40
                                        fprintf(fp,"grestore\n");
 
41
                                        break;
 
42
                                }
 
43
                        }
 
44
                }
 
45
        }
 
46
        fprintf(fp,"showpage\n");
 
47
}
 
48
 
 
49
void ERpr(ERview_t *d, ilbool all)
 
50
{
 
51
        ERprint(stderr,d,all);
 
52
}