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