View | Details | Raw Unified | Return to bug 154278
Collapse All | Expand All

(-)./Makefile (-10 / +5 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	potrace
8
PORTNAME=	potrace
9
PORTVERSION=	1.8
9
PORTVERSION=	1.9
10
CATEGORIES=	graphics
10
CATEGORIES=	graphics
11
MASTER_SITES=	SF
11
MASTER_SITES=	SF
12
12
Lines 20-26 Link Here
20
.endif
20
.endif
21
PLIST_FILES=	bin/potrace bin/mkbitmap
21
PLIST_FILES=	bin/potrace bin/mkbitmap
22
22
23
.if defined(A4)
23
OPTIONS=	METRIC	"Enable use of metric units (centimeters) as default" on \
24
		A4	"Enable use of A4 as the default papersize"           on
25
26
.if defined(WITH_A4)
24
CONFIGURE_ARGS+=	--enable-a4
27
CONFIGURE_ARGS+=	--enable-a4
25
.endif
28
.endif
26
29
Lines 28-41 Link Here
28
CONFIGURE_ARGS+=	--enable-metric
31
CONFIGURE_ARGS+=	--enable-metric
29
.endif
32
.endif
30
33
31
pre-everything::
32
	@${ECHO_MSG} ""
33
	@${ECHO_MSG} "You may define the following build options:"
34
	@${ECHO_MSG} ""
35
	@${ECHO_MSG} "    WITH_METRIC      Enable use of metric units (centimeters) as default"
36
	@${ECHO_MSG} "    A4               Enable use of A4 as the default papersize"
37
	@${ECHO_MSG} ""
38
39
do-install:
34
do-install:
40
	${INSTALL_PROGRAM} ${WRKSRC}/src/potrace ${PREFIX}/bin
35
	${INSTALL_PROGRAM} ${WRKSRC}/src/potrace ${PREFIX}/bin
41
	${INSTALL_PROGRAM} ${WRKSRC}/src/mkbitmap ${PREFIX}/bin
36
	${INSTALL_PROGRAM} ${WRKSRC}/src/mkbitmap ${PREFIX}/bin
(-)./distinfo (-3 / +2 lines)
Lines 1-3 Link Here
1
MD5 (potrace-1.8.tar.gz) = e73b45565737d64011612704dd4d9f86
1
SHA256 (potrace-1.9.tar.gz) = edce2dff19f91e727a4f39e1839b582b83d49ef252af429a0772ddc3626349be
2
SHA256 (potrace-1.8.tar.gz) = 61ee5acf2cf0363e5c04ccd0a197e31edce002e8d966423f85164155950b3ef5
2
SIZE (potrace-1.9.tar.gz) = 601675
3
SIZE (potrace-1.8.tar.gz) = 347484
(-)./files/patch-backend_xfig.c (-114 lines)
Lines 1-114 Link Here
1
Index: ChangeLog
2
===================================================================
3
--- ChangeLog	(revision 153)
4
+++ ChangeLog	(revision 154)
5
@@ -1,5 +1,9 @@
6
 ChangeLog
7
 
8
+	(2007/05/22) PS1 - xfig backend: added depth to opaque components
9
+	to avoid them floating to the background. Suggested by Rafael
10
+	Laboissiere.
11
+
12
 v1.8 2007/04/09
13
 	(2007/04/08) PS1 - portability: use 'test' instead of '[' in shell
14
 	scripts.
15
Index: src/backend_xfig.c
16
===================================================================
17
--- src/backend_xfig.c	(revision 153)
18
+++ src/backend_xfig.c	(revision 154)
19
@@ -124,13 +124,13 @@
20
   return n;
21
 }
22
 
23
-/* do one path. First should be 1 on the very first path, else 0. */
24
-static int xfig_path(FILE *fout, potrace_curve_t *curve, trans_t t, int sign) {
25
+/* do one path. */
26
+static void xfig_path(FILE *fout, potrace_curve_t *curve, trans_t t, int sign, int depth) {
27
   int i;
28
   dpoint_t *c;
29
   int m = curve->n;
30
 
31
-  fprintf(fout, "3 1 0 0 0 %d 50 0 20 0.000 0 0 0 %d\n", sign=='+' ? 32 : 33, npoints(curve, m));
32
+  fprintf(fout, "3 1 0 0 0 %d %d 0 20 0.000 0 0 0 %d\n", sign=='+' ? 32 : 33, depth, npoints(curve, m));
33
 
34
   for (i=0; i<m; i++) {
35
     c = curve->c[i];
36
@@ -154,15 +154,43 @@
37
       break;
38
     }
39
   }
40
-  return 0;
41
 }
42
 
43
+/* render a whole tree */
44
+static void xfig_write_paths(FILE *fout, potrace_path_t *plist, trans_t t, int depth) {
45
+  potrace_path_t *p, *q;
46
+
47
+  for (p=plist; p; p=p->sibling) {
48
+    xfig_path(fout, &p->curve, t, p->sign, depth);
49
+    for (q=p->childlist; q; q=q->sibling) {
50
+      xfig_path(fout, &q->curve, t, q->sign, depth >= 1 ? depth-1 : 0);
51
+    }
52
+    for (q=p->childlist; q; q=q->sibling) {
53
+      xfig_write_paths(fout, q->childlist, t, depth >= 2 ? depth-2 : 0);
54
+    }
55
+  }
56
+}
57
+
58
+/* calculate the depth of a tree. Call with d=0. */
59
+static int xfig_get_depth(potrace_path_t *plist) {
60
+  potrace_path_t *p;
61
+  int max =0;
62
+  int d;
63
+
64
+  for (p=plist; p; p=p->sibling) {
65
+    d = xfig_get_depth(p->childlist);
66
+    if (d > max) {
67
+      max = d;
68
+    }
69
+  }
70
+  return max + 1;
71
+}
72
+
73
 /* ---------------------------------------------------------------------- */
74
 /* Backend. */
75
 
76
 /* public interface for XFIG */
77
 int page_xfig(FILE *fout, potrace_path_t *plist, imginfo_t *imginfo) {
78
-  potrace_path_t *p;
79
   trans_t t;
80
   double si, co;
81
   double origx = imginfo->trans.orig[0] + imginfo->lmar;
82
@@ -174,6 +202,7 @@
83
   pageformat_t *f;
84
   int i;
85
   int x0, y0, x1, y1;  /* in xfig's coordinates */
86
+  int depth;
87
   
88
   si = sin(info.angle/180*M_PI);
89
   co = cos(info.angle/180*M_PI);
90
@@ -220,11 +249,21 @@
91
   fprintf(fout, "0 33 #%06x\n", info.fillcolor);
92
   fprintf(fout, "6 %d %d %d %d\n", x0-75, y1-35, x1+75, y0+35); /* bounding box */
93
 
94
+  /* determine depth of the tree */
95
+  depth = xfig_get_depth(plist);
96
+
97
+  /* figure out appropriate xfig starting depth. Note: xfig only has 1000 depths available */
98
+  if (depth <= 40) {
99
+    depth = 50;
100
+  } else if (depth < 990) {
101
+    depth += 10;
102
+  } else {
103
+    depth = 999;
104
+  }
105
+
106
   /* write paths. Note: can never use "opticurve" with this backend -
107
      it just does not approximate Bezier curves closely enough.  */
108
-  list_forall (p, plist) {
109
-    xfig_path(fout, &p->curve, t, p->sign);
110
-  }
111
+  xfig_write_paths(fout, plist, t, depth);
112
 
113
   fprintf(fout, "-6\n"); /* end bounding box */
114

Return to bug 154278