Commit | Line | Data |
896b04ee |
1 | =pod |
2 | |
3 | =head1 NAME |
4 | |
5 | SDL::Color - Format independent color description |
6 | |
7 | =head1 SYNOPSIS |
8 | |
9 | my $black = SDL::Color->new( 0, 0, 0); |
10 | my $color = SDL::Color->new(255, 0, 0); |
11 | my $r = $color->r; # 255 |
12 | my $g = $color->g; # 0 |
13 | my $b = $color->b; # 0 |
14 | $color->g(255); |
15 | $color->b(255); |
16 | # $color is now white |
17 | |
18 | =head1 DESCRIPTION |
19 | |
20 | C<SDL_Color> describes a color in a format independent way. |
21 | |
22 | =head1 METHODS |
23 | |
24 | =head2 new ( $r, $g, $b ) |
25 | |
26 | The constructor creates a new color with the specified red, green and |
27 | blue values: |
28 | |
29 | my $color = SDL::Color->new(255, 0, 0); |
30 | |
31 | =head2 r |
32 | |
33 | If passed a value, this method sets the red component of the color; |
34 | if not, it returns the red component of the color: |
35 | |
36 | my $r = $color->r; # 255 |
37 | $color->r(128); |
38 | |
39 | =head2 g |
40 | |
41 | If passed a value, this method sets the green component of the color; |
42 | if not, it returns the green component of the color: |
43 | |
44 | my $g = $color->g; # 255 |
45 | $color->g(128); |
46 | |
47 | =head2 b |
48 | |
49 | If passed a value, this method sets the blue component of the color; |
50 | if not, it returns the blue component of the color: |
51 | |
52 | my $b = $color->b; # 255 |
53 | $color->b(128); |
54 | |
55 | =head1 SEE ALSO |
56 | |
57 | L<SDL::Surface> |
58 | |
59 | =cut |