diff --git a/potrace-1.7-io.patch b/potrace-1.7-io.patch deleted file mode 100644 index 894e75f..0000000 --- a/potrace-1.7-io.patch +++ /dev/null @@ -1,253 +0,0 @@ -diff -Naur potrace-1.7/ChangeLog potrace-1.7x/ChangeLog ---- potrace-1.7/ChangeLog 2005-03-06 02:32:06.000000000 -0400 -+++ potrace-1.7x/ChangeLog 2005-11-11 21:15:58.000000000 -0400 -@@ -1,5 +1,15 @@ - ChangeLog - -+ (2005/11/11) PS1 - portability: use binary file i/o in Cygwin. -+ (2005/06/24) PS1 - potracelib: fixed allocation bug. Thanks to -+ Jung Shin for reporting this bug. -+ (2005/06/23) PS1 - potracelib_demo.c: free resources properly. -+ (2005/06/23) PS1 - initialize unused private state to 0. -+ (2005/06/23) PS1 - decompose.c: improved memory allocation scheme. -+ (2005/05/06) PS1 - added "alphacurve" field to private curve -+ structure, so that backends that don't use the public interface -+ (such as the EPS backend) can be warned of non-conforming curves. -+ - v1.7 2005/03/06 - (2005/03/05) PS1 - fixed progress bar subrange bug. - -diff -Naur potrace-1.7/check/pgmdiff.c potrace-1.7x/check/pgmdiff.c ---- potrace-1.7/check/pgmdiff.c 2005-02-22 17:31:23.000000000 -0400 -+++ potrace-1.7x/check/pgmdiff.c 2005-11-11 22:30:31.000000000 -0400 -@@ -24,6 +24,8 @@ - double diff; - int x, y, d; - -+ platform_init(); -+ - if (ac != 3) { - fprintf(stderr, "pgmdiff: wrong number of arguments\n"); - fprintf(stderr, "Usage: pgmdiff file1 file2\n"); -@@ -38,7 +40,7 @@ - if (strcmp(file1, "-")==0) { - r = gm_read(stdin, &g1); - } else { -- f = fopen(file1, "r"); -+ f = fopen(file1, "rb"); - if (!f) { - fprintf(stderr, "pgmdiff: %s: %s\n", file1, strerror(errno)); - return 2; -@@ -57,7 +59,7 @@ - if (strcmp(file2, "-")==0) { - r = gm_read(stdin, &g2); - } else { -- f = fopen(file2, "r"); -+ f = fopen(file2, "rb"); - if (!f) { - fprintf(stderr, "pgmdiff: %s: %s\n", file2, strerror(errno)); - return 2; -diff -Naur potrace-1.7/src/backend_eps.c potrace-1.7x/src/backend_eps.c ---- potrace-1.7/src/backend_eps.c 2005-02-22 17:31:23.000000000 -0400 -+++ potrace-1.7x/src/backend_eps.c 2005-11-11 20:44:07.000000000 -0400 -@@ -305,10 +305,10 @@ - } - - static int eps_path(privcurve_t *curve) { -- if (info.longcoding) { -- return eps_path_long(curve); -- } else { -+ if (info.longcoding==0 && curve->alphacurve) { - return eps_path_short(curve); -+ } else { -+ return eps_path_long(curve); - } - } - -diff -Naur potrace-1.7/src/curve.h potrace-1.7x/src/curve.h ---- potrace-1.7/src/curve.h 2005-02-20 18:55:31.000000000 -0400 -+++ potrace-1.7x/src/curve.h 2005-11-11 20:44:08.000000000 -0400 -@@ -20,6 +20,10 @@ - int *tag; /* tag[n]: POTRACE_CORNER or POTRACE_CURVETO */ - dpoint_t (*c)[3]; /* c[n][i]: control points. - c[n][0] is unused for tag[n]=POTRACE_CORNER */ -+ /* the remainder of this structure is special to privcurve, and is -+ used in EPS debug output and special EPS "short coding". These -+ fields are valid only if "alphacurve" is set. */ -+ int alphacurve; /* have the following fields been initialized? */ - dpoint_t *vertex; /* for POTRACE_CORNER, this equals c[1] */ - double *alpha; /* only for POTRACE_CURVETO */ - double *alpha0; /* "uncropped" alpha parameter - for debug output only */ -diff -Naur potrace-1.7/src/decompose.c potrace-1.7x/src/decompose.c ---- potrace-1.7/src/decompose.c 2005-03-06 02:35:51.000000000 -0400 -+++ potrace-1.7x/src/decompose.c 2005-11-11 20:35:42.000000000 -0400 -@@ -194,6 +194,7 @@ - /* add point to path */ - if (len>=size) { - size+=100; -+ size*=1.3; - pt1 = (point_t *)realloc(pt, size * sizeof(point_t)); - if (!pt1) { - goto error; -diff -Naur potrace-1.7/src/main.c potrace-1.7x/src/main.c ---- potrace-1.7/src/main.c 2005-02-22 17:31:23.000000000 -0400 -+++ potrace-1.7x/src/main.c 2005-11-11 22:30:31.000000000 -0400 -@@ -1024,7 +1024,7 @@ - if (filename == NULL || strcmp(filename, "-") == 0) { - return stdin; - } -- return fopen(filename, "r"); -+ return fopen(filename, "rb"); - } - - /* open a file for writing. Return stdout if filename is NULL or "-" */ -@@ -1032,7 +1032,7 @@ - if (filename == NULL || strcmp(filename, "-") == 0) { - return stdout; - } -- return fopen(filename, "w"); -+ return fopen(filename, "wb"); - } - - /* close a file, but do nothing is filename is NULL or "-" */ -@@ -1172,6 +1172,10 @@ - int i; - char *outfile; - -+ /* platform-specific initializations, e.g., set file i/o to binary */ -+ platform_init(); -+ -+ /* process options */ - dopts(ac, av); - - b = info.backend; -diff -Naur potrace-1.7/src/mkbitmap.c potrace-1.7x/src/mkbitmap.c ---- potrace-1.7/src/mkbitmap.c 2005-02-20 18:55:33.000000000 -0400 -+++ potrace-1.7x/src/mkbitmap.c 2005-11-11 21:12:48.000000000 -0400 -@@ -583,7 +583,7 @@ - if (filename == NULL || strcmp(filename, "-") == 0) { - return stdin; - } -- return fopen(filename, "r"); -+ return fopen(filename, "rb"); - } - - /* open a file for writing. Return stdout if filename is NULL or "-" */ -@@ -591,7 +591,7 @@ - if (filename == NULL || strcmp(filename, "-") == 0) { - return stdout; - } -- return fopen(filename, "w"); -+ return fopen(filename, "wb"); - } - - /* close a file, but do nothing is filename is NULL or "-" */ -@@ -639,6 +639,9 @@ - int i; - char *outfile; - -+ /* platform-specific initializations, e.g., set file i/o to binary */ -+ platform_init(); -+ - /* process options */ - dopts(ac, av); - -diff -Naur potrace-1.7/src/platform.h potrace-1.7x/src/platform.h ---- potrace-1.7/src/platform.h 2005-02-20 18:55:33.000000000 -0400 -+++ potrace-1.7x/src/platform.h 2005-11-11 22:07:13.000000000 -0400 -@@ -13,4 +13,17 @@ - unsigned int _CRT_fmode = _O_BINARY; - #endif - -+#ifdef __CYGWIN__ -+#include -+#include -+static inline void platform_init(void) { -+ setmode(0,O_BINARY); -+ setmode(1,O_BINARY); -+} -+#else -+static inline void platform_init(void) { -+ /* NOP */ -+} -+#endif -+ - #endif /* PLATFORM_H */ -diff -Naur potrace-1.7/src/potracelib.c potrace-1.7x/src/potracelib.c ---- potrace-1.7/src/potracelib.c 2005-02-26 21:47:04.000000000 -0400 -+++ potrace-1.7x/src/potracelib.c 2005-11-11 20:35:42.000000000 -0400 -@@ -64,7 +64,7 @@ - prog.d_prev = param->progress.min; - - /* allocate state object */ -- st = (potrace_state_t *)malloc(sizeof(potrace_state_t *)); -+ st = (potrace_state_t *)malloc(sizeof(potrace_state_t)); - if (!st) { - return NULL; - } -@@ -80,6 +80,7 @@ - - st->status = POTRACE_STATUS_OK; - st->plist = plist; -+ st->priv = NULL; /* private state currently unused */ - - progress_subrange_end(&prog, &subprog); - -diff -Naur potrace-1.7/src/potracelib_demo.c potrace-1.7x/src/potracelib_demo.c ---- potrace-1.7/src/potracelib_demo.c 2005-02-21 13:28:12.000000000 -0400 -+++ potrace-1.7x/src/potracelib_demo.c 2005-11-11 20:35:42.000000000 -0400 -@@ -51,6 +51,14 @@ - return bm; - } - -+/* free a bitmap */ -+static void bm_free(potrace_bitmap_t *bm) { -+ if (bm != NULL) { -+ free(bm->map); -+ } -+ free(bm); -+} -+ - /* ---------------------------------------------------------------------- */ - /* demo */ - -@@ -91,6 +99,7 @@ - fprintf(stderr, "Error tracing bitmap: %s\n", strerror(errno)); - return 1; - } -+ bm_free(bm); - - /* output vector data, e.g. as a rudimentary EPS file */ - printf("%%!PS-Adobe-3.0 EPSF-3.0\n"); -@@ -128,9 +137,8 @@ - printf("grestore\n"); - printf("%%EOF\n"); - -+ potrace_state_free(st); -+ potrace_param_free(param); -+ - return 0; - } -- -- -- -- -diff -Naurw potrace-1.7/src/trace.c potrace-1.7x/src/trace.c ---- potrace-1.7/src/trace.c 2005-02-26 21:54:08.000000000 -0400 -+++ potrace-1.7x/src/trace.c 2005-05-06 20:54:42.000000000 -0300 -@@ -891,6 +891,7 @@ - curve->alpha[j] = alpha; /* store the "cropped" value of alpha */ - curve->beta[j] = 0.5; - } -+ curve->alphacurve = 1; - - return 0; - } -@@ -1165,6 +1166,7 @@ - i1 = mod(i+1,om); - pp->ocurve.beta[i] = s[i] / (s[i] + t[i1]); - } -+ pp->ocurve.alphacurve = 1; - - free(pt); - free(pen); diff --git a/potrace-1.7.tar.bz2 b/potrace-1.7.tar.bz2 deleted file mode 100644 index f3bc4e7..0000000 --- a/potrace-1.7.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4ef6bcf1500f0084c46d9f91820c38e1e2aa3f1699c0671c7956c78513b8a53b -size 348500 diff --git a/potrace-1.8-xfig.patch b/potrace-1.8-xfig.patch new file mode 100644 index 0000000..2409b80 --- /dev/null +++ b/potrace-1.8-xfig.patch @@ -0,0 +1,114 @@ +Index: ChangeLog +=================================================================== +--- ChangeLog (revision 153) ++++ ChangeLog (revision 154) +@@ -1,5 +1,9 @@ + ChangeLog + ++ (2007/05/22) PS1 - xfig backend: added depth to opaque components ++ to avoid them floating to the background. Suggested by Rafael ++ Laboissiere. ++ + v1.8 2007/04/09 + (2007/04/08) PS1 - portability: use 'test' instead of '[' in shell + scripts. +Index: src/backend_xfig.c +=================================================================== +--- src/backend_xfig.c (revision 153) ++++ src/backend_xfig.c (revision 154) +@@ -124,13 +124,13 @@ + return n; + } + +-/* do one path. First should be 1 on the very first path, else 0. */ +-static int xfig_path(FILE *fout, potrace_curve_t *curve, trans_t t, int sign) { ++/* do one path. */ ++static void xfig_path(FILE *fout, potrace_curve_t *curve, trans_t t, int sign, int depth) { + int i; + dpoint_t *c; + int m = curve->n; + +- fprintf(fout, "3 1 0 0 0 %d 50 0 20 0.000 0 0 0 %d\n", sign=='+' ? 32 : 33, npoints(curve, m)); ++ 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)); + + for (i=0; ic[i]; +@@ -154,15 +154,43 @@ + break; + } + } +- return 0; + } + ++/* render a whole tree */ ++static void xfig_write_paths(FILE *fout, potrace_path_t *plist, trans_t t, int depth) { ++ potrace_path_t *p, *q; ++ ++ for (p=plist; p; p=p->sibling) { ++ xfig_path(fout, &p->curve, t, p->sign, depth); ++ for (q=p->childlist; q; q=q->sibling) { ++ xfig_path(fout, &q->curve, t, q->sign, depth >= 1 ? depth-1 : 0); ++ } ++ for (q=p->childlist; q; q=q->sibling) { ++ xfig_write_paths(fout, q->childlist, t, depth >= 2 ? depth-2 : 0); ++ } ++ } ++} ++ ++/* calculate the depth of a tree. Call with d=0. */ ++static int xfig_get_depth(potrace_path_t *plist) { ++ potrace_path_t *p; ++ int max =0; ++ int d; ++ ++ for (p=plist; p; p=p->sibling) { ++ d = xfig_get_depth(p->childlist); ++ if (d > max) { ++ max = d; ++ } ++ } ++ return max + 1; ++} ++ + /* ---------------------------------------------------------------------- */ + /* Backend. */ + + /* public interface for XFIG */ + int page_xfig(FILE *fout, potrace_path_t *plist, imginfo_t *imginfo) { +- potrace_path_t *p; + trans_t t; + double si, co; + double origx = imginfo->trans.orig[0] + imginfo->lmar; +@@ -174,6 +202,7 @@ + pageformat_t *f; + int i; + int x0, y0, x1, y1; /* in xfig's coordinates */ ++ int depth; + + si = sin(info.angle/180*M_PI); + co = cos(info.angle/180*M_PI); +@@ -220,11 +249,21 @@ + fprintf(fout, "0 33 #%06x\n", info.fillcolor); + fprintf(fout, "6 %d %d %d %d\n", x0-75, y1-35, x1+75, y0+35); /* bounding box */ + ++ /* determine depth of the tree */ ++ depth = xfig_get_depth(plist); ++ ++ /* figure out appropriate xfig starting depth. Note: xfig only has 1000 depths available */ ++ if (depth <= 40) { ++ depth = 50; ++ } else if (depth < 990) { ++ depth += 10; ++ } else { ++ depth = 999; ++ } ++ + /* write paths. Note: can never use "opticurve" with this backend - + it just does not approximate Bezier curves closely enough. */ +- list_forall (p, plist) { +- xfig_path(fout, &p->curve, t, p->sign); +- } ++ xfig_write_paths(fout, plist, t, depth); + + fprintf(fout, "-6\n"); /* end bounding box */ + diff --git a/potrace-1.8.tar.bz2 b/potrace-1.8.tar.bz2 new file mode 100644 index 0000000..467bfe2 --- /dev/null +++ b/potrace-1.8.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:417cb87251bce541c2cce1620afeceffc87f7e5fe38c117af8c9ae07a00f15c4 +size 302204 diff --git a/potrace.changes b/potrace.changes index 3dfb1fc..295b0ef 100644 --- a/potrace.changes +++ b/potrace.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Jul 26 18:46:12 CEST 2007 - sbrabec@suse.cz + +- Updated to version 1.8: + * minor bugfixes and portability improvements + * rotation is now implemented in the PDF backend + ------------------------------------------------------------------- Thu Mar 29 17:12:49 CEST 2007 - rguenther@suse.de diff --git a/potrace.spec b/potrace.spec index aa183b2..a7df50f 100644 --- a/potrace.spec +++ b/potrace.spec @@ -1,5 +1,5 @@ # -# spec file for package potrace (Version 1.7) +# spec file for package potrace (Version 1.8) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,17 +11,17 @@ # norootforbuild Name: potrace -BuildRequires: zlib-devel Summary: Utility for Tracing a Bitmap to Scalable Outline Image -Version: 1.7 -Release: 45 -License: GNU General Public License (GPL) +Version: 1.8 +Release: 1 +License: GPL v2 or later Group: Productivity/Graphics/Convertors -Autoreqprov: on +BuildRequires: licenses zlib-devel +Requires: licenses Provides: bitmap_tracing URL: http://potrace.sourceforge.net/ Source: %{name}-%{version}.tar.bz2 -Patch: %{name}-%{version}-io.patch +Patch: %{name}-%{version}-xfig.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -41,18 +41,16 @@ Authors: %prep %setup -%patch -p1 +%patch %build -%{?suse_update_config:%{suse_update_config -f}} -CFLAGS="$RPM_OPT_FLAGS" \ -./configure --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --mandir=%{_mandir} -make +autoreconf -f -i +%configure +make %{?jobs:-j%jobs} %install -make DESTDIR=$RPM_BUILD_ROOT install +%makeinstall +ln -sf /usr/share/doc/licenses/md5/$(md5sum COPYING | sed 's/ .*//') COPYING %clean rm -fr $RPM_BUILD_ROOT @@ -61,9 +59,13 @@ rm -fr $RPM_BUILD_ROOT %defattr(-,root,root) %doc AUTHORS ChangeLog COPYING NEWS README %{_prefix}/bin/* -%{_mandir}/man?/*.* +%doc %{_mandir}/man?/*.* %changelog +* Thu Jul 26 2007 - sbrabec@suse.cz +- Updated to version 1.8: + * minor bugfixes and portability improvements + * rotation is now implemented in the PDF backend * Thu Mar 29 2007 - rguenther@suse.de - add zlib-devel BuildRequires. * Wed Nov 15 2006 - jw@suse.de