1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4 <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
5 <TITLE>Magick::Geometry</TITLE>
6 <META NAME="GENERATOR" CONTENT="StarOffice 7 (Solaris Sparc)">
7 <META NAME="AUTHOR" CONTENT="Bob Friesenhahn">
8 <META NAME="CREATED" CONTENT="20020805;15172876">
9 <META NAME="CHANGEDBY" CONTENT="Bob Friesenhahn">
10 <META NAME="CHANGED" CONTENT="20050103;22481700">
11 <META NAME="DESCRIPTION" CONTENT="Documentation for Magick::Geometry class">
14 TD P { color: #000000 }
18 A:link { color: #0000ee }
19 A:visited { color: #551a8b }
23 <BODY LANG="en-US" TEXT="#000000" LINK="#0000ee" VLINK="#551a8b" BGCOLOR="#ffffff" DIR="LTR">
24 <H1 ALIGN=CENTER>Magick::Geometry</H1>
25 <P>Geometry provides a convenient means to specify a geometry
26 argument. The object may be initialized from a C string or C++ string
27 containing a geometry specification. It may also be initialized by
28 more efficient parameterized constructors.
30 <H3><A NAME="X11GeometrySpecifications"></A>X11 Geometry
32 <P>X11 geometry specifications are in the form
33 <TT>"<width>x<height>{+-}<xoffset>{+-}<yoffset>"</TT>
34 (where <I>width</I>, <I>height</I>, <I>xoffset</I>, and <I>yoffset</I>
35 are numbers) for specifying the size and placement location for an
38 <P STYLE="margin-bottom: 0in">The <I>width</I> and <I>height</I>
39 parts of the geometry specification are measured in pixels. The
40 <I>xoffset</I> and <I>yoffset</I> parts are also measured in pixels
41 and are used to specify the distance of the placement coordinate from
42 the left and top and edges of the image, respectively. Both types of
43 offsets are measured from the indicated edge of the object to the
44 corresponding edge of the image. The X offset may be specified in the
48 <TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
53 <P>+<I>xoffset</I></P>
56 <P>The left edge of the object is to be placed <I>xoffset</I>
57 pixels in from the <B>left edge </B>of the image.</P>
62 <P>-<I>xoffset</I></P>
65 <P>The left edge of the object is to be placed outside the image,
66 <I>xoffset</I> pixels out from the <B>left edge </B>of the image.</P>
71 <P STYLE="margin-bottom: 0in">The Y offset has similar meanings:
74 <TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
79 <P>+<I>yoffset</I></P>
82 <P>The top edge of the object is to be <I>yoffset</I> pixels
83 <B>below</B> the <B>top edge </B>of the image.</P>
88 <P>-<I>yoffset</I></P>
91 <P>The top edge of the object is to be <I>yoffset</I> pixels
92 <B>above</B> the <B>top edge</B> of the image.</P>
97 <P>Offsets must be given as pairs; in other words, in order to
98 specify either <I>xoffset</I> or <I>yoffset</I> both must be present.
100 <H3><A NAME="ExtendedX11GeometrySpecifications"></A>ImageMagick
101 Extensions To X11 Geometry Specifications</H3>
102 <P STYLE="margin-bottom: 0in">ImageMagick has added a number of
103 qualifiers to the standard geometry string for use when resizing
104 images. The form of an extended geometry string is
105 "<TT><width>x<height>{+-}<xoffset>{+-}<yoffset>{%}{!}{<}{>}".
106 Extended geometry strings should <B>only</B> be used <B>when resizing
107 an image</B>. Using an extended geometry string for other
108 applications may cause the API call to fail. </TT>The available
109 qualifiers are shown in the following table:
111 <P ALIGN=CENTER STYLE="margin-bottom: 0in"><B>ImageMagick Geometry
114 <TABLE WIDTH=90% BORDER=1 CELLPADDING=2 CELLSPACING=3>
119 <P ALIGN=CENTER><B>Qualifier</B></P>
122 <P ALIGN=CENTER><B>Description</B></P>
127 <P ALIGN=CENTER><B>%</B></P>
130 <P>Interpret width and height as a <B>percentage</B> of the
136 <P ALIGN=CENTER><B>!</B></P>
139 <P>Resize to width and height <B>exactly</B>, loosing original
145 <P ALIGN=CENTER><B><</B></P>
148 <P>Resize only if the image is <B>smaller</B> than the geometry
154 <P ALIGN=CENTER><B>></B></P>
157 <P>Resize only if the image is <B>greater</B> than the geometry
163 <H3><A NAME="PostscriptPageSize"></A>Postscript Page Size Extension
164 To Geometry Specifications</H3>
165 <P>Any geometry string specification supplied to the Geometry
166 constructor is considered to be a Postscript page size nickname if
167 the first character is not numeric. The Geometry constructor converts
168 these page size specifications into the equivalent numeric geometry
169 string specification (preserving any offset component) prior to
170 conversion to the internal object format. Postscript page size
171 specifications are short-hand for the pixel geometry required to fill
172 a page of that size. Since the 11x17 inch page size used in the US
173 starts with a digit, it is not supported as a Postscript page size
174 nickname. Instead, substitute the geometry specification "<TT>792x1224>"</TT>
175 when 11x17 output is desired.
177 <P STYLE="margin-bottom: 0in">An example of a Postscript page size
178 specification is <TT>"letter+43+43>"</TT>.
180 <P ALIGN=CENTER STYLE="margin-bottom: 0in"><B>Postscript Page Size
183 <TABLE WIDTH=70% BORDER=1 CELLPADDING=2 CELLSPACING=3>
188 <P ALIGN=CENTER><B>Postscript Page Size Nickname</B></P>
191 <P ALIGN=CENTER><B>Equivalent Extended Geometry Specification</B></P>
196 <P ALIGN=CENTER><FONT SIZE=2>Ledger</FONT></P>
199 <P ALIGN=CENTER><FONT SIZE=2>1224x792></FONT></P>
204 <P ALIGN=CENTER><FONT SIZE=2>Legal</FONT></P>
207 <P ALIGN=CENTER><FONT SIZE=2>612x1008></FONT></P>
212 <P ALIGN=CENTER><FONT SIZE=2>Letter</FONT></P>
215 <P ALIGN=CENTER><FONT SIZE=2>612x792></FONT></P>
220 <P ALIGN=CENTER><FONT SIZE=2>LetterSmall</FONT></P>
223 <P ALIGN=CENTER><FONT SIZE=2>612x792></FONT></P>
228 <P ALIGN=CENTER><FONT SIZE=2>ArchE</FONT></P>
231 <P ALIGN=CENTER><FONT SIZE=2>2592x3456></FONT></P>
236 <P ALIGN=CENTER><FONT SIZE=2>ArchD</FONT></P>
239 <P ALIGN=CENTER><FONT SIZE=2>1728x2592></FONT></P>
244 <P ALIGN=CENTER><FONT SIZE=2>ArchC</FONT></P>
247 <P ALIGN=CENTER><FONT SIZE=2>1296x1728></FONT></P>
252 <P ALIGN=CENTER><FONT SIZE=2>ArchB</FONT></P>
255 <P ALIGN=CENTER><FONT SIZE=2>864x1296></FONT></P>
260 <P ALIGN=CENTER><FONT SIZE=2>ArchA</FONT></P>
263 <P ALIGN=CENTER><FONT SIZE=2>648x864></FONT></P>
268 <P ALIGN=CENTER><FONT SIZE=2>A0</FONT></P>
271 <P ALIGN=CENTER><FONT SIZE=2>2380x3368></FONT></P>
276 <P ALIGN=CENTER><FONT SIZE=2>A1</FONT></P>
279 <P ALIGN=CENTER><FONT SIZE=2>1684x2380></FONT></P>
284 <P ALIGN=CENTER><FONT SIZE=2>A2</FONT></P>
287 <P ALIGN=CENTER><FONT SIZE=2>1190x1684></FONT></P>
292 <P ALIGN=CENTER><FONT SIZE=2>A3</FONT></P>
295 <P ALIGN=CENTER><FONT SIZE=2>842x1190></FONT></P>
300 <P ALIGN=CENTER><FONT SIZE=2>A4</FONT></P>
303 <P ALIGN=CENTER><FONT SIZE=2>595x842></FONT></P>
308 <P ALIGN=CENTER><FONT SIZE=2>A4Small</FONT></P>
311 <P ALIGN=CENTER><FONT SIZE=2>595x842></FONT></P>
316 <P ALIGN=CENTER><FONT SIZE=2>A5</FONT></P>
319 <P ALIGN=CENTER><FONT SIZE=2>421x595></FONT></P>
324 <P ALIGN=CENTER><FONT SIZE=2>A6</FONT></P>
327 <P ALIGN=CENTER><FONT SIZE=2>297x421></FONT></P>
332 <P ALIGN=CENTER><FONT SIZE=2>A7</FONT></P>
335 <P ALIGN=CENTER><FONT SIZE=2>210x297></FONT></P>
340 <P ALIGN=CENTER><FONT SIZE=2>A8</FONT></P>
343 <P ALIGN=CENTER><FONT SIZE=2>148x210></FONT></P>
348 <P ALIGN=CENTER><FONT SIZE=2>A9</FONT></P>
351 <P ALIGN=CENTER><FONT SIZE=2>105x148></FONT></P>
356 <P ALIGN=CENTER><FONT SIZE=2>A10</FONT></P>
359 <P ALIGN=CENTER><FONT SIZE=2>74x105></FONT></P>
364 <P ALIGN=CENTER><FONT SIZE=2>B0</FONT></P>
367 <P ALIGN=CENTER><FONT SIZE=2>2836x4008></FONT></P>
372 <P ALIGN=CENTER><FONT SIZE=2>B1</FONT></P>
375 <P ALIGN=CENTER><FONT SIZE=2>2004x2836></FONT></P>
380 <P ALIGN=CENTER><FONT SIZE=2>B2</FONT></P>
383 <P ALIGN=CENTER><FONT SIZE=2>1418x2004></FONT></P>
388 <P ALIGN=CENTER><FONT SIZE=2>B3</FONT></P>
391 <P ALIGN=CENTER><FONT SIZE=2>1002x1418></FONT></P>
396 <P ALIGN=CENTER><FONT SIZE=2>B4</FONT></P>
399 <P ALIGN=CENTER><FONT SIZE=2>709x1002></FONT></P>
404 <P ALIGN=CENTER><FONT SIZE=2>B5</FONT></P>
407 <P ALIGN=CENTER><FONT SIZE=2>501x709></FONT></P>
412 <P ALIGN=CENTER><FONT SIZE=2>C0</FONT></P>
415 <P ALIGN=CENTER><FONT SIZE=2>2600x3677></FONT></P>
420 <P ALIGN=CENTER><FONT SIZE=2>C1</FONT></P>
423 <P ALIGN=CENTER><FONT SIZE=2>1837x2600></FONT></P>
428 <P ALIGN=CENTER><FONT SIZE=2>C2</FONT></P>
431 <P ALIGN=CENTER><FONT SIZE=2>1298x1837></FONT></P>
436 <P ALIGN=CENTER><FONT SIZE=2>C3</FONT></P>
439 <P ALIGN=CENTER><FONT SIZE=2>918x1298></FONT></P>
444 <P ALIGN=CENTER><FONT SIZE=2>C4</FONT></P>
447 <P ALIGN=CENTER><FONT SIZE=2>649x918></FONT></P>
452 <P ALIGN=CENTER><FONT SIZE=2>C5</FONT></P>
455 <P ALIGN=CENTER><FONT SIZE=2>459x649></FONT></P>
460 <P ALIGN=CENTER><FONT SIZE=2>C6</FONT></P>
463 <P ALIGN=CENTER><FONT SIZE=2>323x459></FONT></P>
468 <P ALIGN=CENTER><FONT SIZE=2>Flsa</FONT></P>
471 <P ALIGN=CENTER><FONT SIZE=2>612x936></FONT></P>
476 <P ALIGN=CENTER><FONT SIZE=2>Flse</FONT></P>
479 <P ALIGN=CENTER><FONT SIZE=2>612x936></FONT></P>
484 <P ALIGN=CENTER><FONT SIZE=2>HalfLetter</FONT></P>
487 <P ALIGN=CENTER><FONT SIZE=2>396x612></FONT></P>
492 <H3 ALIGN=CENTER>Geometry Methods</H3>
493 <P STYLE="margin-bottom: 0in">Geometry provides methods to initialize
494 its value from strings, from a set of parameters, or via attributes.
495 The methods available for use in Geometry are shown in the following
498 <P ALIGN=CENTER STYLE="margin-bottom: 0in"><B>Geometry Methods</B></P>
499 <TABLE WIDTH=100% BORDER=1 CELLPADDING=2 CELLSPACING=3>
506 <P ALIGN=CENTER><B>Method</B></P>
509 <P ALIGN=CENTER><B>Return Type</B></P>
512 <P ALIGN=CENTER><B>Signature(s)</B></P>
515 <P ALIGN=CENTER><B>Description</B></P>
519 <TD ROWSPAN=3 WIDTH=10%>
522 <TD ROWSPAN=3 WIDTH=10% BGCOLOR="#666666">
526 <P>unsigned int width_, unsigned int height_, unsigned int xOff_ =
527 0, unsigned int yOff_ = 0, bool xNegative_ = false, bool
528 yNegative_ = false</P>
531 <P>Construct X11 geometry via explicit parameters.</P>
536 <P>const string geometry_</P>
539 <P>Construct geometry from C++ string</P>
544 <P>const char * geometry_</P>
547 <P>Construct geometry from C string</P>
551 <TD ROWSPAN=2 WIDTH=10%>
558 <P>unsigned int width_</P>
560 <TD ROWSPAN=2 WIDTH=37%>
573 <TD ROWSPAN=2 WIDTH=10%>
580 <P>unsigned int height_</P>
582 <TD ROWSPAN=2 WIDTH=37%>
595 <TD ROWSPAN=2 WIDTH=10%>
602 <P>unsigned int xOff_</P>
604 <TD ROWSPAN=2 WIDTH=37%>
605 <P>X offset from origin</P>
617 <TD ROWSPAN=2 WIDTH=10%>
624 <P>unsigned int yOff_</P>
626 <TD ROWSPAN=2 WIDTH=37%>
627 <P>Y offset from origin</P>
639 <TD ROWSPAN=2 WIDTH=10%>
646 <P>bool xNegative_</P>
648 <TD ROWSPAN=2 WIDTH=37%>
649 <P>Sign of X offset negative? (X origin at right)</P>
661 <TD ROWSPAN=2 WIDTH=10%>
668 <P>bool yNegative_</P>
670 <TD ROWSPAN=2 WIDTH=37%>
671 <P>Sign of Y offset negative? (Y origin at bottom)</P>
683 <TD ROWSPAN=2 WIDTH=10%>
692 <TD ROWSPAN=2 WIDTH=37%>
693 <P>Width and height are expressed as percentages</P>
705 <TD ROWSPAN=2 WIDTH=10%>
714 <TD ROWSPAN=2 WIDTH=37%>
715 <P>Resize without preserving aspect ratio (!)</P>
727 <TD ROWSPAN=2 WIDTH=10%>
736 <TD ROWSPAN=2 WIDTH=37%>
737 <P>Resize if image is greater than size (>)</P>
749 <TD ROWSPAN=2 WIDTH=10%>
758 <TD ROWSPAN=2 WIDTH=37%>
759 <P>Resize if image is less than size (<)</P>
771 <TD ROWSPAN=2 WIDTH=10%>
780 <TD ROWSPAN=2 WIDTH=37%>
781 <P>Does object contain a valid geometry? May be set to <I>false</I>
782 in order to invalidate an existing geometry object.</P>
798 <P>const Geometry&</P>
801 <P>const string geometry_</P>
804 <P>Set geometry via C++ string</P>
812 <P>const Geometry&</P>
815 <P>const char * geometry_</P>
818 <P>Set geometry via C string</P>
823 <P>operator string</P>
832 <P>Obtain C++ string representation of geometry</P>