SHA256
1
0
forked from pool/texlive
texlive/source-psutils-flip.dif

113 lines
3.9 KiB
Plaintext
Raw Normal View History

Patch for pstops from psutils to allow page flipping (i.<2E>e. mirroring).
Useful for creating of print matrices on transparent films.
http://www.penguin.cz/~utx
ftp://ftp.penguin.cz/pub/users/utx/psutils/psutils-flip.diff
--- utils/psutils/psutils-1.17/pstops.c.orig 1997-03-11 23:53:04.000000000 +0100
+++ utils/psutils/psutils-1.17/pstops.c 2002-07-26 19:14:49.000000000 +0200
@@ -35,7 +35,7 @@
{
fprintf(stderr, "%s: page specification error:\n", program);
fprintf(stderr, " <pagespecs> = [modulo:]<spec>\n");
- fprintf(stderr, " <spec> = [-]pageno[@scale][L|R|U][(xoff,yoff)][,spec|+spec]\n");
+ fprintf(stderr, " <spec> = [-]pageno[@scale][L|R|U|H|V][(xoff,yoff)][,spec|+spec]\n");
fprintf(stderr, " modulo>=1, 0<=pageno<modulo\n");
fflush(stderr);
exit(1);
@@ -81,6 +81,14 @@
tail->rotate += 180;
tail->flags |= ROTATE;
break;
+ case 'h': case 'H':
+ tail->hflip += 1;
+ tail->flags |= HFLIP;
+ break;
+ case 'v': case 'V':
+ tail->vflip += 1;
+ tail->flags |= VFLIP;
+ break;
case '(':
tail->xoff += parsedimen(&str, argerror);
if (*str++ != ',') argerror();
--- utils/psutils/psutils-1.17/psspec.h.orig 1997-03-11 23:53:04.000000000 +0100
+++ utils/psutils/psutils-1.17/psspec.h 2002-07-26 17:41:41.000000000 +0200
@@ -8,12 +8,14 @@
/* pagespec flags */
#define ADD_NEXT (0x01)
#define ROTATE (0x02)
-#define SCALE (0x04)
-#define OFFSET (0x08)
-#define GSAVE (ROTATE|SCALE|OFFSET)
+#define HFLIP (0x04)
+#define VFLIP (0x08)
+#define SCALE (0x10)
+#define OFFSET (0x20)
+#define GSAVE (ROTATE|HFLIP|VFLIP|SCALE|OFFSET)
typedef struct pagespec {
- int reversed, pageno, flags, rotate;
+ int reversed, pageno, flags, rotate, hflip, vflip;
double xoff, yoff, scale;
struct pagespec *next;
} PageSpec ;
--- utils/psutils/psutils-1.17/psspec.c.orig 1997-03-11 23:53:04.000000000 +0100
+++ utils/psutils/psutils-1.17/psspec.c 2002-07-26 19:21:10.000000000 +0200
@@ -22,6 +22,8 @@
if (temp == NULL)
message(FATAL, "out of memory\n");
temp->reversed = temp->pageno = temp->flags = temp->rotate = 0;
+ temp->hflip = 0;
+ temp->vflip = 0;
temp->scale = 1;
temp->xoff = temp->yoff = 0;
temp->next = NULL;
@@ -208,6 +210,14 @@
sprintf(buffer, "%d rotate\n", ps->rotate);
writestring(buffer);
}
+ if ((ps->flags & HFLIP) && (ps->hflip%2)) {
+ sprintf(buffer, "[ -1 0 0 1 %f 0 ] concat\n", width*ps->scale);
+ writestring(buffer);
+ }
+ if ((ps->flags & VFLIP) && (ps->vflip%2)) {
+ sprintf(buffer, "[ 1 0 0 -1 0 %f ] concat\n", height*ps->scale);
+ writestring(buffer);
+ }
if (ps->flags & SCALE) {
sprintf(buffer, "%f dup scale\n", ps->scale);
writestring(buffer);
--- utils/psutils/psutils-1.17/pstops.man.orig 1997-03-11 23:53:04.000000000 +0100
+++ utils/psutils/psutils-1.17/pstops.man 2002-07-26 19:25:37.000000000 +0200
@@ -43,7 +43,7 @@
.I = spec[+specs][,specs]
.TP
.I spec
-.I = [-]pageno[L][R][U][@scale][(xoff,yoff)]
+.I = [-]pageno[L][R][U][H][V][@scale][(xoff,yoff)]
.RE
.sp
.I modulo
@@ -74,8 +74,9 @@
or
.B "h"
to specify as a multiple of the width or height.
-The optional parameters \fIL\fR, \fIR\fR, and \fIU\fR rotate the page left,
-right, or upside-down.
+The optional parameters \fIL\fR, \fIR\fR, \fIU\fR, \fIH\fR and \fIV\fR
+rotate the page left, right, or upside-down, and flip (mirror) page
+horizontally or vertically.
The optional
.I scale
parameter scales the page by the fraction specified.
--- utils/psutils/psutils-1.17/README.orig 1997-03-11 23:53:05.000000000 +0100
+++ utils/psutils/psutils-1.17/README 2002-07-26 19:36:58.000000000 +0200
@@ -181,6 +181,7 @@
Mike Coleman
Dale Scheetz dwarf@polaris.net
Yves Arrouye arrouye@marin.fdn.fr
+ Stanislav Brabec utx@penguin.cz
(Apologies to anyone who I have left out, it was not intentional.)