Split out SDL_Color into its own C-level class
[sdlgit/SDL_perl.git] / lib / SDL / Color.pm
CommitLineData
8fde61e3 1package SDL::Color;
8fde61e3 2use strict;
084b921f 3use warnings;
4use Carp;
3e3f41ee 5require Exporter;
6require DynaLoader;
7our @ISA = qw(Exporter DynaLoader);
8bootstrap SDL::Color;
8fde61e3 9
101;
11
3e3f41ee 12__END__
8fde61e3 13
14=pod
15
16=head1 NAME
17
3e3f41ee 18SDL::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 33C<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 39The constructor creates a new color with the specified red, green and
40blue values:
8fde61e3 41
3e3f41ee 42 my $color = SDL::Color->new(255, 0, 0);
8fde61e3 43
3e3f41ee 44=head2 r
8fde61e3 45
3e3f41ee 46If passed a value, this method sets the red component of the color;
47if 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 54If passed a value, this method sets the green component of the color;
55if 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 62If passed a value, this method sets the blue component of the color;
63if 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 70L<SDL::Surface>
8fde61e3 71
72=cut