|
|
imager-devel |
/ help / lists / applications / search / |
| molar.is > lists > imager-devel > 2001-08 | / threads / authors / dates / subjects / |
Named parametersFrom: Tony Cook (03105@xyz.molar.is)Date: Sun 12 Aug 2001 - 04:04:29 UTC
On Fri, 18 May 2001, Mike Depot wrote:
I thought you might want to know that I just committed named parameter
Now we just need to do it for all the other places...
Tony
An excerpt from Imager/Color.pm:
You can specify colors in several different ways, you can just supply
=over
=item *
simple numeric parameters - if you supply 3 or 4 numeric arguments, you
=item *
a six hex digit web color, either 'RRGGBB' or '#RRGGBB'
=item *
an eight hex digit web color, either 'RRGGBBAA' or '#RRGGBBAA'.
=item *
a 3 hex digit web color, '#RGB' - a value of F becomes 255.
=item *
a color name, from whichever of the gimp Named_Colors file or X
=back
You can supply named parameters:
=over
=item *
'red', 'green' and 'blue', optionally shortened to 'r', 'g' and 'b'.
# all of the following are equivalent
=item *
'hue', 'saturation' and 'value', optionally shortened to 'h', 's' and
# the same as RGB(127,255,127)
=item *
'web', which can specify a 6 or 3 hex digit web color, in any of the
my $c1 = Imager::Color->new(web=>'#FFC0C0'); # pale red
=item *
'gray' or 'grey' which specifies a single channel, from 0 to 255.
# exactly the same
=item *
'rgb' which takes a 3 member arrayref, containing each of the red,
# the same
=item *
'hsv' which takes a 3 member arrayref, containting each of hue,
# the same
=item *
'gimp' which specifies a color from a GIMP palette file. You can
my $c1 = Imager::Color->new(gimp=>'snow');
=item *
'xname' which specifies a color from an X11 rgb.txt file. You can
my $c1 = Imager::Color->new(xname=>'blue') # usually RGB(0, 0, 255)
=item *
'name' which specifies a name from either a GIMP palette or an X
=item *
'channel0', 'channel1', etc, each of which specifies a single channel.
=item *
'channels' which takes an arrayref of the channel values.
=back
Optionally you can add an alpha channel to a color with the 'alpha' or
These color specifications can be used for both constructing new
|
|
© 2000-2002 Bjarni R. Einarsson / feedback / legalese / credits / Last modified 12-08-2001. |
|