Received: by smtp02.oce.nl (4.1/SMI-4.1)
	id AA18025; Sat, 14 Nov 98 01:39:45 +0100
Received: from sgi.sgi.com (SGI.COM [192.48.153.1])
	by oce.nl (8.9.0/8.9.0) with ESMTP id BAA16602
	for <rvdt@oce.nl>; Sat, 14 Nov 1998 01:18:07 +0100 (MET)
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) 
	by sgi.sgi.com (980327.SGI.8.8.8-aspam/980304.SGI-aspam:
       SGI does not authorize the use of its proprietary
       systems or networks for unsolicited or bulk email
       from the Internet.) 
	via ESMTP id QAA01112; Fri, 13 Nov 1998 16:09:59 -0800 (PST)
	mail_from (owner-tiff@sgi.engr.sgi.com)
Received: (from majordomo-owner@localhost)
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	id PAA01593
	for tiff-list;
	Fri, 13 Nov 1998 15:12:06 -0800 (PST)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from sgi.sgi.com (sgi.engr.sgi.com [192.26.80.37])
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	via ESMTP id PAA09106
	for <tiff-relay@cthulhu.engr.sgi.com>;
	Fri, 13 Nov 1998 15:12:04 -0800 (PST)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from feith1.FEITH.COM (feith1.FEITH.COM [192.251.93.1]) 
	by sgi.sgi.com (980327.SGI.8.8.8-aspam/980304.SGI-aspam:
       SGI does not authorize the use of its proprietary
       systems or networks for unsolicited or bulk email
       from the Internet.) 
	via ESMTP id PAA09080
	for <tiff@sgi.com>; Fri, 13 Nov 1998 15:12:03 -0800 (PST)
	mail_from (john@feith.com)
Received: from jwlab.FEITH.COM (jwlab.FEITH.COM [192.251.93.16])
	by feith1.FEITH.COM (8.9.1/8.9.1) with ESMTP id SAA09128
	for <tiff@sgi.com>; Fri, 13 Nov 1998 18:12:02 -0500 (EST)
Received: (from john@localhost)
	by jwlab.FEITH.COM (8.8.8+Sun/8.8.8) id SAA14803
	for tiff@sgi.com; Fri, 13 Nov 1998 18:12:00 -0500 (EST)
Date: Fri, 13 Nov 1998 18:12:00 -0500 (EST)
From: John Wehle <john@feith.com>
Message-Id: <199811132312.SAA14803@jwlab.FEITH.COM>
To: tiff@sgi.com
Subject: Tiff Version 3.4 Beta 037 Patch to fix tiff2ps deadzone handling
Content-Type: text
Sender: owner-tiff@fddi-sgi.sgi.com
Precedence: bulk

This patch fixes the deadzone handling for multipage tiffs.

Changes:

  1) Output AvoidDeadZonePreamble for each page since showpage causes
     initgraphics to run which resets the current transformation matrix.

Enjoy,

John Wehle
john@feith.com

PS: I'm not on the tiff mailing list so please copy any reponses to me
    via my email address.  Thanks.
--------------8<------------------8<-------------------8<--------------------
*** tiff/tools/tiff2ps.c.ORIGINAL	Tue Sep  2 13:54:38 1997
--- tiff/tools/tiff2ps.c	Thu Nov 12 15:16:07 1998
*************** static 	tsize_t	tf_rowsperstrip;
*** 328,333 ****
--- 328,343 ----
  static	tsize_t	tf_numberstrips;
  static	char *hex = "0123456789abcdef";
  
+ static char AvoidDeadZonePreamble[] = "\
+ gsave newpath clippath pathbbox grestore\n\
+   4 2 roll 2 copy translate\n\
+   exch 3 1 roll sub 3 1 roll sub exch\n\
+   currentpagedevice /PageSize get aload pop\n\
+   exch 3 1 roll div 3 1 roll div abs exch abs\n\
+   2 copy gt { exch } if pop\n\
+   dup 1 lt { dup scale } { pop } ifelse\n\
+ ";
+ 
  
  /* returns the sequence number of the page processed */
  int
*************** TIFF2PS(FILE* fd, TIFF* tif, float pw, f
*** 383,388 ****
--- 393,400 ----
  			fprintf(fd, "%%%%Page: %d %d\n", npages, npages);
  			fprintf(fd, "gsave\n");
  			fprintf(fd, "100 dict begin\n");
+ 			if (PSavoiddeadzone && level2)
+ 	        		fprintf(fd, "%s", AvoidDeadZonePreamble);
  			if (pw != 0 && ph != 0) {
  				/* NB: maintain image aspect ratio */
  				scale = (pw*PS_UNIT_SIZE/prw) < (ph*PS_UNIT_SIZE/prh) ?
*************** end\n\
*** 431,446 ****
  %%EndFeature\n\
  ";
  
- static char AvoidDeadZonePreamble[] = "\
- gsave newpath clippath pathbbox grestore\n\
-   4 2 roll 2 copy translate\n\
-   exch 3 1 roll sub 3 1 roll sub exch\n\
-   currentpagedevice /PageSize get aload pop\n\
-   exch 3 1 roll div 3 1 roll div abs exch abs\n\
-   2 copy gt { exch } if pop\n\
-   dup 1 lt { dup scale } { pop } ifelse\n\
- ";
- 
  void
  PSHead(FILE *fd, TIFF *tif, uint32 w, uint32 h, float pw, float ph,
  	float ox, float oy)
--- 443,448 ----
*************** PSHead(FILE *fd, TIFF *tif, uint32 w, ui
*** 466,473 ****
  	        fprintf(fd, "%s", DuplexPreamble);
  	if (PStumble)
  	        fprintf(fd, "%s", TumblePreamble);
- 	if (PSavoiddeadzone && level2)
- 	        fprintf(fd, "%s", AvoidDeadZonePreamble);
  	fprintf(fd, "%%%%EndSetup\n");
  }
  
--- 468,473 ----
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------

