Name

setTile( ) — assign a tile pattern for use with an image

Synopsis

GD::Image::setTile(image)

Use the setTile( ) method to assign an image as a tile pattern for use when drawing filled shapes within an image. First call setTile( ) with an image object, then draw using the gdTiledspecial color constant instead of the drawing command’s color parameter:

# Read in a pattern from a GIF file
open INFILE, "wallpaper.gif";
my $wallpaper = newFromGif GD::Image('INFILE');

$ Set $wallpaper as the current tilable pattern
$image->setTile($wallpaper);

# Draw a 100x100 rectangle tiled with the wallpaper pattern
$image->filledRectangle(0, 0, 100, 100, gdTiled);
                        

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.