NAME
SDL::App::FPS::Color - provides color names => SDL::Color mapping
SYNOPSIS
package SDL::App::FPS::Color qw/RED BLUE GREEN/;
my $yellow = SDL::App::FPS::Color::YELLOW();
my $red = RED();
my $blue = BLUE;
EXPORTS
Can export the color names on request.
DESCRIPTION
This package provides SDL::Color objects that corrospond to the basic color names.
METHODS
The following color names exist:
RED GREEN BLUE
ORANGE YELLOW PURPLE
MAGENTA CYAN BROWN
WHITE BLACK
GRAY LIGHTGRAY DARKGRAY
GREY LIGHTGREY DARKGREY
LIGHTRED DARKRED
LIGHTBLUE DARKBLUE
LIGHTGREE DARKGREEN
darken
$new_color = SDL::App::FPS::Color::darken($color,$factor);
$factor
must be between 1 (result is black) and 0 (result is original color). darken()
darkens the color by this factor, for instance 0.5 makes a color of 50% color values from the original color.
lighten
$new_color = SDL::App::FPS::Color::lighten($color,$factor);
$factor
must be between 0 (result is original color) and 1 (result is white). lighten()
darkens the color by this factor, for instance 0.5 makes a color of 50% higher color values from the original color.
blend
$new_color = SDL::App::FPS::Color::blend($color_a,$color_b,$factor);
$factor
must be between 0 (result is $color_a
) and 1 (result is $color_b
). blend()
creates a blended color from the two colors. A factor of 0.5 means it will result in exact the middle of color A and color B.
invert
$new_color = SDL::App::FPS::Color::invert($color);
Inverts a color - black will be white, white will be black, and blue will be yellow, etc.
desaturate
$new_color = SDL::App::FPS::Color::desaturate($color,$rb,$gf,$bf);
Converts a color to grayscale. The default is just averaging the three components red, green and blue (meaning $rf
, $gf
and C>$bf> are 1.0).
You can pass values between 0..1 for $rf
, $gf
and $bf
, for instance:
$gray = SDL::App::FPS::Color::desaturate($color, 0, 1, 1);
This would ignore the red component completely, making the grayscale based only on the green and blue parts. Or maybe you want to simulate that the human eye is more sensitive to green:
$gray = SDL::App::FPS::Color::desaturate($color, 0.6, 1, 0.6);
AUTHORS
(c) 2003 Tels http://bloodgate.com/perl/sdl/
SEE ALSO
SDL:App::FPS, SDL::App and SDL.