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.

Here’s some code that experiments with different shapes and stroking or filling. Its<br />

output is shown in Figure 10-11.<br />

// circle<br />

pdf_setcolor($p,"fill","rgb", 0.8, 0.5, 0.8);<br />

pdf_circle($p,400,600,75);<br />

pdf_fill_stroke($p);<br />

// funky arc<br />

pdf_setcolor($p,"fill","rgb", 0.8, 0.5, 0.5);<br />

pdf_moveto($p,200,600);<br />

pdf_arc($p,300,600,50,0,120);<br />

pdf_closepath($p);<br />

pdf_fill_stroke($p);<br />

// dashed rectangle<br />

pdf_setcolor($p,"stroke","rgb", 0.3, 0.8, 0.3);<br />

pdf_setdash($p,4,6);<br />

pdf_rect($p,50,500,500,300);<br />

pdf_stroke($p);<br />

Figure 10-11. Different shapes and stroking and filling styles<br />

Patterns<br />

A pattern is a reusable component, defined outside of a page context, that is used in<br />

place of a color for filling or stroking a path.<br />

The pdf_begin_pattern( ) call returns a pattern handle:<br />

$pattern = pdf_begin_pattern(pdf, width, height, xstep, ystep, painttype);<br />

252 | 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!