8 my $fountain = Imager::Fountain->new();
9 $fountain->add(end=>0.8,
10 c0=>NC(hsv=>[90, 0.5, 0.5], alpha=>64),
11 c1=>NC(hsv=>[90, 1, 0.8], alpha=>192),
13 $fountain->add(start=>0.8,
14 c0=>NC(hsv=>[90, 1, 0.8], alpha=>192),
15 c1=>NC(255, 255, 255, 128));
17 unless (-d 'combines') {
19 or die "combines directory does not exist and could not be created: $!";
22 open HTML, "> combines.html"
23 or die "Cannot create combines.html: $!";
26 <HTML><HEAD><TITLE>Imager - Combining Modes</TITLE></HEAD><BODY BGCOLOR="FFFFFF">
28 <CENTER><FONT FACE="Helvetica, Arial" SIZE="6" COLOR="CC0000"><B>
31 <HR WIDTH="65%" NOSHADE>
32 <TABLE><TR><TD WIDTH="70%">
35 <TR><TH>Name</TH><TH>Result</TH><TH>Base</TH></TR>
38 # build our base image
39 # this is similar to the test image used for some of Imager's tests
40 my $green = NC(0, 255, 0);
41 my $lblue = NC(128, 128, 255);
42 my $dred = NC(128, 64, 64);
43 my $base = Imager->new(xsize=>150, ysize=>150);
44 $base->box(xmin=>70, ymin=>25, xmax=>130, ymax=>125, color=>$green, filled=>1);
45 $base->box(xmin=>20, ymin=>25, xmax=>80, ymax=>125, color=>$lblue, filled=>1);
46 $base->arc(r=>30, color=>$dred);
47 $base->filter(type=>'conv', coef=>[0.1, 0.2, 0.4, 0.2, 0.1]);
49 $base->write(file=>"combines/base.jpg", jpegquality=>100)
50 or die "Cannot save combines/base.jpg: ",$base->errstr;
52 # we fill the top with a fountain fill, and the bottom with a solid color
53 my $solid_left = NC(128, 32, 32, 128);
54 my $solid_right = NC(128, 32, 32, 255);
56 for my $combine (Imager::Fill->combines) {
57 my $work = $base->copy();
59 fill=>{ fountain=>'radial',
62 xa=>75, ya=>50, xb=>15, yb=>50,
66 $work->box(ymin=>75, xmax=>74,
67 fill=>{ solid=>$solid_left, combine=>$combine })
69 $work->box(ymin=>75, xmin=>75,
70 fill=>{ solid=>$solid_right, combine=>$combine })
73 $work->write(file=>"combines/$combine.jpg", jpegquality=>100)
74 or die "Cannot save combines/$combine.jpg: ",$work->errstr;
79 <TD><IMG SRC="combines/$combine.jpg" WIDTH="150" HEIGHT="150"></TD>
80 <TD><IMG SRC="combines/base.jpg" WIDTH="150" HEIGHT="150"></TD>
88 <P>The following code was used to generate this page:</p>
94 or die "Can't open myself: $!";
96 print HTML encode_entities($_);
103 <HR WIDTH="75%" NOSHADE ALIGN="LEFT">
105 Send errors/fixes/suggestions to: <B>tony</B>_at_<B>develop-help.com</B>