05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The pdf_arc( ) function draws an arc of a circle:<br />

pdf_arc(pdf, x, y, r, alpha, beta);<br />

The circle is centered at (x,y) and has radius r. The starting point of the arc is alpha<br />

degrees (measured counterclockwise from the horizontal axis), and the endpoint is<br />

beta degrees.<br />

Use pdf_curveto( ) to draw a Bézier curve from the current point:<br />

pdf_curveto(pdf, x1, y1, x2, y2, x3, y3);<br />

The points (x1,y1), (x2,y2), and (x3,y3) are control points through which the curve<br />

must pass.<br />

You can draw a rectangle with pdf_rect( ):<br />

pdf_rect(pdf, x, y, width, height);<br />

To draw a line from the current point backto the point that started the path, use<br />

pdf_closepath( ):<br />

pdf_closepath(pdf);<br />

Example 10-9 defines a simple path and strokes it.<br />

Example 10-9. A simple graphic path<br />

<br />

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

We can use pdf_closepath( ) and pdf_fill_stroke( ) to close the path and then fill it<br />

with the current fill color by replacing the pdf_stroke( ) call in Example 10-9 with<br />

these two lines:<br />

pdf_closepath($p);<br />

pdf_fill_stroke($p);<br />

250 | Chapter 10: PDF<br />

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

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

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

Saved successfully!

Ooh no, something went wrong!