3 use Imager ':handy'; # handy functions like NC
9 or die "hatches directory does not exist and could not be created: $!";
12 open HTML, "> hatches.html"
13 or die "Cannot create hatches.html: $!";
15 <HTML><HEAD><TITLE>Imager - Hatched Fills</TITLE></HEAD><BODY BGCOLOR="FFFFFF">
17 <CENTER><FONT FACE="Helvetica, Arial" SIZE="6" COLOR="CC0000"><B>
20 <HR WIDTH="65%" NOSHADE>
21 <TABLE><TR><TD WIDTH="70%">
24 <TR><TH>Filled area</TH><TH>Close-up</TH><TH>Name</TH></TR>
27 my $red = NC(255, 0, 0);
28 my $yellow = NC(255, 255, 0);
31 my $custom = [ 0xFF, 0x01, 0x7D, 0x45, 0x5D, 0x41, 0x7F, 0x00 ];
33 for my $hatch (Imager::Fill->hatches, $custom) {
34 my $area = Imager->new(xsize=>100, ysize=>100);
35 $area->box(xmax=>50, fill => { hatch => $hatch });
37 fill => { hatch => $hatch,
40 my $name = ref($hatch) ? "custom" : $hatch;
42 $area->write(file=>"hatches/area_$name.png")
43 or die "Cannot save hatches/area_$name.png: ",$area->errstr;
45 my $subset = $area->crop(width=>20, height=>20);
46 # we use the HTML to zoom up
47 $subset->write(file=>"hatches/zoom_$name.png")
48 or die "Cannot save hatches/zoom_$name.png: ",$subset->errstr;
52 <TD><IMG SRC="hatches/area_$name.png" WIDTH="100" HEIGHT="100" BORDER=1></TD>
53 <TD><IMG SRC="hatches/zoom_$name.png" WIDTH="100" HEIGHT="100" BORDER=1></TD>
62 <P>The following code was used to generate this page:</p>
68 or die "Can't open myself: $!";
70 print HTML encode_entities($_);
77 <HR WIDTH="75%" NOSHADE ALIGN="LEFT">
79 Send errors/fixes/suggestions to: <B>tony</B>_at_<B>develop-help.com</B>