7 # It's just a front end to the XS creation functions.
10 # Parse color spec into an a set of 4 colors
13 return (@_,255) if @_ == 3;
14 return (@_ ) if @_ == 4;
16 /^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/i) {
17 return (hex($1),hex($2),hex($3),hex($4));
19 if ($_[0] =~ /^\#?([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/i) {
20 return (hex($1),hex($2),hex($3),255);
28 shift; # get rid of class name.
30 return @arg ? new_internal($arg[0],$arg[1],$arg[2],$arg[3]) : ();
37 return @arg ? set_internal($self, $arg[0],$arg[1],$arg[2],$arg[3]) : ();
50 Imager::Color - Color handling for Imager.
54 $color = Imager::Color->new($red, $green, $blue);
55 $color = Imager::Color->new($red, $green, $blue, $alpha);
56 $color = Imager::Color->new("#C0C0FF"); # html color specification
58 $color->set($red, $green, $blue);
59 $color->set($red, $green, $blue, $alpha);
60 $color->set("#C0C0FF"); # html color specification
62 ($red, $green, $blue, $alpha) = $color->rgba();
63 @hsv = $color->hsv(); # not implemented but proposed
70 This module handles creating color objects used by imager. The idea is
71 that in the future this module will be able to handle colorspace calculations
78 This creates a color object to pass to functions that need a color argument.
82 This changes an already defined color. Note that this does not affect any places
83 where the color has been used previously.
87 This returns the rgba code of the color the object contains.
91 Calling info merely dumps the relevant colorcode to the log.
97 Arnar M. Hrafnkelsson, addi@umich.edu
98 And a great deal of help from others - see the README for a complete
104 http://www.eecs.umich.edu/~addi/perl/Imager/