Imager::Fountain(3pm) | User Contributed Perl Documentation | Imager::Fountain(3pm) |
Imager::Fountain - a class for building fountain fills suitable for use by the fountain filter.
use Imager::Fountain; my $f1 = Imager::Fountain->read(gimp=>$filename); $f->write(gimp=>$filename); my $f1 = Imager::Fountain->new; $f1->add(start=>0, middle=>0.5, end=>1.0, c0=>Imager::Color->new(...), c1=>Imager::Color->new(...), type=>$trans_type, color=>$color_trans_type);
Provide an interface to build arrays suitable for use by the Imager fountain filter. These can be loaded from or saved to a GIMP gradient file or you can build them from scratch.
If the name parameter is supplied as a scalar reference then any name field from newer GIMP gradient files will be returned in it.
my $gradient = Imager::Fountain->read(gimp=>'foo.ggr'); my $name; my $gradient2 = Imager::Fountain->read(gimp=>'bar.ggr', name=>\$name);
The second variant allows the gradient name to be set (for newer versions of the GIMP).
$gradient->write(gimp=>'foo.ggr') or die Imager->errstr; $gradient->write(gimp=>'bar.ggr', name=>'the bar gradient') or die Imager->errstr;
This can take any of the following values:
This can take any of the following values:
In most cases you can ignore some of the arguments, eg.
# assuming $f is a new Imager::Fountain in each case here use Imager ':handy'; # simple transition from red to blue $f->add(c0=>NC('#FF0000'), c1=>NC('#0000FF')); # simple 2 stages from red to green to blue $f->add(end=>0.5, c0=>NC('#FF0000'), c1=>NC('#00FF00')) $f->add(start=>0.5, c0=>NC('#00FF00'), c1=>NC('#0000FF'));
The array references passed as positions and colors must have the same number of elements. They must have at least 2 elements each.
colors must contain Imager::Color or Imager::Color::Float objects.
eg.
my $f = Imager::Fountain->simple(positions=>[0, 0.2, 1.0], colors=>[ NC(255,0,0), NC(0,255,0), NC(0,0,255) ]);
Documented for internal use.
The add() documentation mentions a fill parameter in a few places, this is as good a place as any to discuss it.
The process of deciding the color produced by the gradient works through the following steps:
Tony Cook <tony@develop-help.com>
2023-01-11 | perl v5.36.0 |