.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05) .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "PostScript::Simple::EPS 3pm" .TH PostScript::Simple::EPS 3pm "2005-03-03" "perl v5.10.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" PostScript::Simple::EPS \- EPS support for PostScript::Simple .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use PostScript::Simple; \& \& # create a new PostScript object \& $p = new PostScript::Simple(papersize => "A4", \& colour => 1, \& units => "in"); \& \& # create a new page \& $p\->newpage; \& \& # add an eps file \& $p\->add_eps({xsize => 3}, "test.eps", 1,1); \& $p\->add_eps({yscale => 1.1, xscale => 1.8}, "test.eps", 4,8); \& \& # create an eps object \& $e = new PostScript::Simple::EPS(file => "test.eps"); \& $e\->rotate(90); \& $e\->xscale(0.5); \& $p\->add_eps($e, 3, 3); # add eps object to postscript object \& $e\->xscale(2); \& $p\->add_eps($e, 2, 5); # add eps object to postscript object again \& \& # write the output to a file \& $p\->output("file.ps"); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" PostScript::Simple::EPS allows you to add \s-1EPS\s0 files into PostScript::Simple objects. Included \s-1EPS\s0 files can be scaled and rotated, and placed anywhere inside a PostScript::Simple page. .PP Remember when using translate/scale/rotate that you will normally need to do the operations in the reverse order to that which you expect. .SH "PREREQUISITES" .IX Header "PREREQUISITES" This module requires \f(CW\*(C`PostScript::Simple\*(C'\fR, \f(CW\*(C`strict\*(C'\fR, \f(CW\*(C`Carp\*(C'\fR and \f(CW\*(C`Exporter\*(C'\fR. .Sh "\s-1EXPORT\s0" .IX Subsection "EXPORT" None. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .ie n .IP """new(options)""" 4 .el .IP "\f(CWnew(options)\fR" 4 .IX Item "new(options)" Create a new PostScript::Simple::EPS object. The options that can be set are: .RS 4 .IP "file" 4 .IX Item "file" \&\s-1EPS\s0 file to be included. This or \f(CW\*(C`source\*(C'\fR must exist when the \f(CW\*(C`new\*(C'\fR method is called. .IP "source" 4 .IX Item "source" PostScript code for the \s-1EPS\s0 document. Either this or \f(CW\*(C`file\*(C'\fR must be set when \&\f(CW\*(C`new\*(C'\fR is called. .IP "clip" 4 .IX Item "clip" Set to 0 to disable clipping to the \s-1EPS\s0 bounding box. Default is to clip. .RE .RS 4 .Sp Example: .Sp .Vb 5 \& $ps = new PostScript::Simple(landscape => 1, \& eps => 0, \& xsize => 4, \& ysize => 3, \& units => "in"); \& \& $eps = new PostScript::Simple::EPS(file => "test.eps"); \& \& $eps\->scale(0.5); .Ve .Sp Scale the \s-1EPS\s0 file by x0.5 in both directions. .Sp .Vb 2 \& $ps\->newpage(); \& $ps\->importeps($eps, 1, 1); .Ve .Sp Add the \s-1EPS\s0 file to the PostScript document at coords (1,1). .Sp .Vb 1 \& $ps\->importepsfile("another.eps", 1, 2, 4, 4); .Ve .Sp Easily add an \s-1EPS\s0 file to the PostScript document using bounding box (1,2),(4,4). .Sp The methods \f(CW\*(C`importeps\*(C'\fR and \f(CW\*(C`importepsfile\*(C'\fR are described in the documentation of \f(CW\*(C`PostScript::Simple\*(C'\fR. .RE .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" All object methods return 1 for success or 0 in some error condition (e.g. insufficient arguments). Error message text is also drawn on the page. .ie n .IP """get_bbox""" 4 .el .IP "\f(CWget_bbox\fR" 4 .IX Item "get_bbox" Returns the \s-1EPS\s0 bounding box, as specified on the %%BoundingBox line of the \s-1EPS\s0 file. Units are standard PostScript points. .Sp Example: .Sp .Vb 1 \& ($x1, $y1, $x2, $y2) = $eps\->get_bbox(); .Ve .ie n .IP """width""" 4 .el .IP "\f(CWwidth\fR" 4 .IX Item "width" Returns the \s-1EPS\s0 width. .Sp Example: .Sp .Vb 1 \& print "EPS width is " . abs($eps\->width()) . "\en"; .Ve .ie n .IP """height""" 4 .el .IP "\f(CWheight\fR" 4 .IX Item "height" Returns the \s-1EPS\s0 height. .Sp Example: .Sp To scale \f(CW$eps\fR to 72 points high, do: .Sp .Vb 1 \& $eps\->scale(1, 72/$eps\->height()); .Ve .ie n .IP """scale(x, y)""" 4 .el .IP "\f(CWscale(x, y)\fR" 4 .IX Item "scale(x, y)" Scales the \s-1EPS\s0 file. To scale in one direction only, specify 1 as the other scale. To scale the \s-1EPS\s0 file the same in both directions, you may use the shortcut of just specifying the one value. .Sp Example: .Sp .Vb 2 \& $eps\->scale(1.2, 0.8); # make wider and shorter \& $eps\->scale(0.5); # shrink to half size .Ve .ie n .IP """rotate(deg)""" 4 .el .IP "\f(CWrotate(deg)\fR" 4 .IX Item "rotate(deg)" Rotates the \s-1EPS\s0 file by \f(CW\*(C`deg\*(C'\fR degrees anti-clockwise. The \s-1EPS\s0 file is rotated about it's own origin (as defined by it's bounding box). To rotate by a particular co-ordinate (again, relative to the \s-1EPS\s0 file, not the main PostScript document), use translate, too. .Sp Example: .Sp .Vb 1 \& $eps\->rotate(180); # turn upside\-down .Ve .Sp To rotate 30 degrees about point (50,50): .Sp .Vb 3 \& $eps\->translate(50, 50); \& $eps\->rotate(30); \& $eps\->translate(\-50, \-50); .Ve .ie n .IP """translate(x, y)""" 4 .el .IP "\f(CWtranslate(x, y)\fR" 4 .IX Item "translate(x, y)" Move the \s-1EPS\s0 file by \f(CW\*(C`x\*(C'\fR,\f(CW\*(C`y\*(C'\fR PostScript points. .Sp Example: .Sp .Vb 1 \& $eps\->translate(10, 10); # move 10 points in both directions .Ve .ie n .IP """reset""" 4 .el .IP "\f(CWreset\fR" 4 .IX Item "reset" Clear all translate, rotate and scale operations. .Sp Example: .Sp .Vb 1 \& $eps\->reset(); .Ve .ie n .IP """load""" 4 .el .IP "\f(CWload\fR" 4 .IX Item "load" Reads the \s-1EPS\s0 file into memory, to save reading it from file each time if inserted many times into a document. Can not be used with \f(CW\*(C`preload\*(C'\fR. .ie n .IP """preload(object)""" 4 .el .IP "\f(CWpreload(object)\fR" 4 .IX Item "preload(object)" Experimental: defines the \s-1EPS\s0 at in the document prolog, and just runs a command to insert it each time it is used. \f(CW\*(C`object\*(C'\fR is a PostScript::Simple object. If the \s-1EPS\s0 file is included more than once in the PostScript file then this will probably shrink the filesize quite a lot. .Sp Can not be used at the same time as \f(CW\*(C`load\*(C'\fR, or when using \s-1EPS\s0 objects defined from PostScript source. .Sp Example: .Sp .Vb 3 \& $p = new PostScript::Simple(); \& $e = new PostScript::Simple::EPS(file => "test.eps"); \& $e\->preload($p); .Ve .SH "BUGS" .IX Header "BUGS" This is software in development; some current functionality may not be as expected, and/or may not work correctly. .SH "AUTHOR" .IX Header "AUTHOR" The PostScript::Simple::EPS module was written by Matthew Newton, after prods for such a feature from several people around the world. A useful importeps function that provides scaling and aspect ratio operations was gratefully received from Glen Harris, and merged into this module. .PP Copyright (C) 2002\-2003 Matthew C. Newton / Newton Computing .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation, version 2. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \&\s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \&\s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details, available at http://www.gnu.org/licenses/gpl.html. .SH "SEE ALSO" .IX Header "SEE ALSO" PostScript::Simple