NAME
SDL::Color - Format independent color description
CATEGORY
Core, Video, Structure
SYNOPSIS
my $black = SDL::Color->new( 0, 0, 0);
my $color = SDL::Color->new(255, 0, 0);
my $r = $color->r; # 255
my $g = $color->g; # 0
my $b = $color->b; # 0
$color->g(255);
$color->b(255);
# $color is now white
DESCRIPTION
SDL_Color
describes a color in a format independent way.
METHODS
new ( $r, $g, $b )
The constructor creates a new color with the specified red, green and blue values:
my $color = SDL::Color->new(255, 0, 0);
r
If passed a value, this method sets the red component of the color; if not, it returns the red component of the color:
my $r = $color->r; # 255
$color->r(128);
g
If passed a value, this method sets the green component of the color; if not, it returns the green component of the color:
my $g = $color->g; # 255
$color->g(128);
b
If passed a value, this method sets the blue component of the color; if not, it returns the blue component of the color:
my $b = $color->b; # 255
$color->b(128);