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