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