945ad00a85f2f6cd9640116de1df28259fed28d2
[sdlgit/SDL_perl.git] / lib / SDL / Color.pm
1 package SDL::Color;
2 use strict;
3 use warnings;
4 require Exporter;
5 require DynaLoader;
6 our @ISA = qw(Exporter DynaLoader);
7 bootstrap SDL::Color;
8
9 1;
10
11 __END__
12
13 =pod
14
15 =head1 NAME
16
17 SDL::Color - Format independent color description
18
19 =head1 SYNOPSIS
20
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
29
30 =head1 DESCRIPTION
31
32 C<SDL_Color> describes a color in a format independent way.
33
34 =head1 METHODS
35
36 =head2 new ( $r, $g, $b )
37
38 The constructor creates a new color with the specified red, green and
39 blue values:
40
41   my $color = SDL::Color->new(255, 0, 0);
42
43 =head2 r
44
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:
47
48   my $r = $color->r; # 255
49   $color->r(128);
50
51 =head2 g
52
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:
55
56   my $g = $color->g; # 255
57   $color->g(128);
58
59 =head2 b
60
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:
63
64   my $b = $color->b; # 255
65   $color->b(128);
66
67 =head1 SEE ALSO
68
69 L<SDL::Surface>
70
71 =cut