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.

The width and height parameters specify the size of the pattern. If you are creating a<br />

pattern from an image, these are the dimensions of the image. The xstep and ystep<br />

parameters specify the horizontal and vertical tiling spacing (i.e., the distance<br />

between repetitions of the image). To tile the image without a gap between repetitions,<br />

set the xstep and ystep arguments to the same values as width and height. The<br />

final argument, painttype, can be either 1 or 2. 1 means that the pattern supplies its<br />

own color information. 2 means that the current fill and stroke colors are used<br />

instead. Patterns based on images only use a painttype of 1.<br />

Example 10-10 creates a pattern from a small <strong>PHP</strong> logo image and uses it to fill a<br />

circle.<br />

Example 10-10. Filling with a pattern<br />

<br />

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

Templates<br />

It is common to have parts of a document, such as header/footer sections or background<br />

watermarks, repeated on multiple pages. It would be trivial to write a little<br />

<strong>PHP</strong> function to generate such things on each page, but if you did this the final PDF<br />

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

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

Images and Graphics | 253

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

Saved successfully!

Ooh no, something went wrong!