SDL::App::FPS::Color - provides color names => SDL::Color mapping
package SDL::App::FPS::Color qw/RED BLUE GREEN/; my $yellow = SDL::App::FPS::Color::YELLOW(); my $red = RED(); my $blue = BLUE;
Can export the color names on request.
This package provides SDL::Color objects that corrospond to the basic color names.
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
$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.
$factor
darken()
$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.
lighten()
$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.
$color_a
$color_b
blend()
$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.
$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).
$rf
$gf
You can pass values between 0..1 for $rf, $gf and $bf, for instance:
$bf
$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);
(c) 2003 Tels http://bloodgate.com/perl/sdl/
SDL:App::FPS, SDL::App and SDL.
To install SDL::App::FPS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SDL::App::FPS
CPAN shell
perl -MCPAN -e shell install SDL::App::FPS
For more information on module installation, please visit the detailed CPAN module installation guide.