AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
November 1998

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



1998.11.13 23:12 "Tiff Version 3.4 Beta 037 Patch to fix tiff2ps deadzone handling", by John Wehle

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  |                         |
-------------------------------------------------------------------------