summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib/viewpbm.ps
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2013-02-18 22:54:24 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2013-02-18 22:54:24 +0000
commit152319ccddf48a345b38cc725bf839467fd9d57d (patch)
treeccf35a4c175f9b536ac4f32207690e8e355c0526 /Master/tlpkg/tlgs/lib/viewpbm.ps
parent8bf3f3c636bf1dee1cb1b3cfcdaa951c3879c937 (diff)
tlgs: update gs-9.05 -> gs-9.07
git-svn-id: svn://tug.org/texlive/trunk@29151 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlgs/lib/viewpbm.ps')
-rw-r--r--Master/tlpkg/tlgs/lib/viewpbm.ps73
1 files changed, 57 insertions, 16 deletions
diff --git a/Master/tlpkg/tlgs/lib/viewpbm.ps b/Master/tlpkg/tlgs/lib/viewpbm.ps
index c2dbc5701c3..114c3910bae 100644
--- a/Master/tlpkg/tlgs/lib/viewpbm.ps
+++ b/Master/tlpkg/tlgs/lib/viewpbm.ps
@@ -1,4 +1,5 @@
-% Copyright (C) 1992, 1995, 1996, 1998, 1999 Aladdin Enterprises. All rights reserved.
+% Copyright (C) 2001-2012 Artifex Software, Inc.
+% All Rights Reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
@@ -7,18 +8,17 @@
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
-% For more information about licensing, please refer to
-% http://www.ghostscript.com/licensing/. For information on
-% commercial licensing, go to http://www.artifex.com/licensing/ or
-% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
-% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
+% Refer to licensing information at http://www.artifex.com or contact
+% Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
+% CA 94903, U.S.A., +1(415)492-9861, for further information.
+%
-% $Id$
% viewpbm.ps
% Display a PBM/PGM/PPM file.
% Requires the Level 2 `image' operator (to handle variable pixel widths).
% If SCALE is defined, maps input pixels to output pixels with that scale;
% if SCALE is undefined, scales the image to fit the page.
+% If FITPAGE true, it fits the output page size to the image, honouring SCALE
/s 100 string def
/readmaxv { % <file> readmaxv -
@@ -110,17 +110,29 @@
begin
/SCALE where {
pop
+ /FITPAGE where {/FITPAGE get}{false} ifelse
+ {
+ Width 72 mul SCALE mul Height 72 mul SCALE mul
+ }
+ {
% Map pixels SCALE-for-1. Assume orthogonal transformation.
- Width 1 0 dtransform add abs div SCALE mul
- Height 0 1 dtransform add abs div SCALE mul
+ Width 1 0 dtransform add abs div SCALE mul
+ Height 0 1 dtransform add abs div SCALE mul
+ } ifelse
} {
- % Scale the image (uniformly) to fit the page.
- clippath pathbbox pop pop translate
- pathbbox .min exch pop exch pop ceiling
- dup Height Width gt {
- Width mul Height div exch
- } {
- Height mul Width div
+ /FITPAGE where {/FITPAGE get}{false} ifelse
+ {
+ Width 72 mul Height 72 mul
+ }
+ {
+ % Scale the image (uniformly) to fit the page.
+ clippath pathbbox pop pop translate
+ pathbbox .min exch pop exch pop ceiling
+ dup Height Width gt {
+ Width mul Height div exch
+ } {
+ Height mul Width div
+ } ifelse
} ifelse
}
ifelse scale
@@ -133,6 +145,21 @@
(r) file /pf exch def {
pf token not { exit } if
pbmtypes exch get pf exch exec pbmsetup
+ /FITPAGE where
+ {
+ /FITPAGE get
+ {
+ /SCALE where
+ {
+ pop
+ <</PageSize [w 72 mul SCALE mul h 72 mul SCALE mul] >>
+ }
+ {
+ <</PageSize [w 72 mul h 72 mul] >>
+ } ifelse
+ setpagedevice
+ } if
+ } if
dup imagescale image showpage
} loop
end
@@ -164,6 +191,20 @@
dup /DataSource datas put
dup /Decode decode put
/DeviceCMYK setcolorspace
+ /FITPAGE where
+ {
+ /FITPAGE get
+ {
+ /SCALE where
+ {
+ <</PageSize [w SCALE mul h SCALE mul]>>
+ }
+ {
+ <</PageSize [w h]>>
+ }ifelse
+ setpagedevice
+ } if
+ } if
dup imagescale image showpage
end
} def