NAME
Math::Color - Perl class to represent rotations
HIERARCHY
-+- Math::Vec3 -+- Math::Color
SEE ALSO
Math::Color, Math::Image, Math::Vec2, Math::Vec3, Math::Rotation Math::Quaternion
SYNOPSIS
use Math::Color;
my $c = new Math::Color; # Make a new Color
my $c1 = new Math::Color(0,1,0);
DESCRIPTION
METHODS
- new(r,g,b)
-
r, g, b are given on [0, 1].
my $c = new Math::Color; my $c1 = new Math::Color($v); my $c2 = new Math::Color(0, 0.5, 1); my $c3 = new Math::Color([0, 0.5, 1]);
- copy
-
Makes a copy of the rotation
$c2 = $c1->copy; $c2 = new Math::Color($c1);
- setValue(r,g,b)
-
Sets the value of the color. r, g, b are given on [0, 1].
$c1->setValue(0, 0.2, 1);
- setRed(r)
-
Sets the first value of the color r is given on [0, 1].
$c1->setRed(1); $c1->red = 1; $c1->r = 1; $c1->[0] = 1;
- setGreen(g)
-
Sets the second value of the color. g is given on [0, 1].
$c1->setGreen(0.2); $c1->green = 0.2; $c1->g = 0.2; $c1->[1] = 0.2;
- setBlue(b)
-
Sets the third value of the color. b is given on [0, 1].
$c1->setZ(0.3); $c1->z = 0.3; $c1->[2] = 0.3;
- getValue
-
Returns the @value of the color.
@v = $c1->getValue;
- getRed
-
Returns the first value of the color.
$r = $c1->getRed; $r = $c1->red; $r = $c1->r; $r = $c1->[0];
- getGreen
-
Returns the second value of the color.
$g = $c1->getGreen; $g = $c1->green; $g = $c1->g; $g = $c1->[1];
- getBlue
-
Returns the third value of the color.
$b = $c1->getBlue; $b = $c1->blue; $b = $c1->b; $b = $c1->[2];
- setHSV(h,s,v)
-
h, s, v are given on [0, 1]. RGB are each returned on [0, 1].
$c->setHSV(1/12,1,1); # 1 0.5 0
- getHSV
-
h, s, v are each returned on [0, 1].
@hsv = $c->getHSV;
- stringify
-
Returns a string representation of the color. This is used to overload the '""' operator, so that color may be freely interpolated in strings.
my $c = new Math::Color(0.1, 0.2, 0.3); print $c->stringify; # "0.1, 0.2, 0.3" print "$c"; # "0.1, 0.2, 0.3"
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 37:
=over without closing =back