1SDL::Color(3pm)       User Contributed Perl Documentation      SDL::Color(3pm)
2
3
4

NAME

6       SDL::Color - Format independent color description
7
8   CATEGORY
9       Core, Video, Structure
10

SYNOPSIS

12        my $black = SDL::Color->new(0, 0, 0);
13        my $color = SDL::Color->new(255, 0, 0);
14        my $r = $color->r; # 255
15        my $g = $color->g; # 0
16        my $b = $color->b; # 0
17        $color->g(255);
18        $color->b(255);
19        # $color is now white
20

DESCRIPTION

22       "SDL_Color" describes a color in a format independent way.
23

METHODS

25   new
26        my $color = SDL::Color->new(255, 0, 0);
27
28       The constructor creates a new color with the specified red, green and
29       blue values.
30
31   r
32        my $r = $color->r;
33        $color->r(128);
34
35       If passed a value, this method sets the red component of the color; if
36       not, it returns the red component of the color.
37
38   g
39        my $g = $color->g;
40        $color->g(128);
41
42       If passed a value, this method sets the green component of the color;
43       if not, it returns the green component of the color.
44
45   b
46        my $b = $color->b;
47        $color->b(128);
48
49       If passed a value, this method sets the blue component of the color; if
50       not, it returns the blue component of the color.
51

SEE ALSO

53       SDL::Surface
54

AUTHORS

56       See "AUTHORS" in SDL.
57
58
59
60perl v5.38.0                      2023-07-21                   SDL::Color(3pm)
Impressum