05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example 10-8. Nonproportional scaling (continued)<br />

pdf_place_image($p, $im, 200/$nx, 600/$ny, 1.0);<br />

pdf_restore($p); // Restore previous<br />

pdf_close_image ($p,$im);<br />

?><br />

The output of Example 10-8 is shown in Figure 10-8.<br />

Figure 10-8. Nonproportional scaling<br />

Graphics<br />

To draw a graphical shape, first specify a path and then fill and/or stroke the path<br />

with appropriately configured fill and/or stroke colors. The functions that define<br />

these paths are straightforward. For example, to draw a line, you position the cursor<br />

at the starting point of the line using a call to pdf_moveto( ), then specify the path for<br />

this line with a call to pdf_lineto( ). The starting points of other functions, such as<br />

pdf_circle( ) and pdf_rect( ), are defined directly in the calls.<br />

The pdf_moveto( ) function starts the path at a particular point:<br />

pdf_moveto(pdf, x, y);<br />

With pdf_lineto( ), you can draw a line from the current point to another point:<br />

pdf_lineto(pdf, x, y);<br />

Use pdf_circle( ) to draw a circle of radius r at a particular point:<br />

pdf_circle(pdf, x, y, r);<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.<br />

Images and Graphics | 249

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!