Documentation | InterfaceKit | rgb_color
SYNOPSIS
Perl
use HaikuR1::rgb_color; my $color = HaikuR1::rgb_color->new($red, $green, $blue, $alpha); $color->set_to($red2, $green2, $blue2, $alpha2);
Python
from HaikuR1.InterfaceKit import rgb_color color = rgb_color(red, green, blue, alpha) color.set_to(red2, green2, blue2, alpha2)
DESCRIPTION
Exposes the rgb_color
structure.
As a convenience, wherever a method expects an rgb_color as input, you may
pass a four-item native list or
native map instead. (The alpha component may
be omitted, in which case it will default to 255
.) In addition, you may
treat an rgb_color object like a native list.
For more information on rgb_color, see the Be Book description.
Perl
# input converters $message->AddColor("color", [$red, $green, $blue, $alpha]); $message->AddColor("color", { red => $red, green => $green, blue => $blue, alpha => $alpha }); # list accessors $rect->[0] = $red; $rect->[1] = $green; $rect->[2] = $blue; $rect->[3] = $alpha;
Python
# input converters message.AddColor("color", [red, green, blue, alpha]) message.AddColor("color", { red = red, green = green, blue = blue, alpha = alpha }) # list accessors rect[0] = red rect[1] = green rect[2] = blue rect[3] = alpha
PROPERTIES
red
green
blue
An integer from 0
to 255
.
alpha
An integer from 0
(completely transparent) to 255
(completely opaque).
METHODS
Constructor
Creates an rgb_color.
Perl
HaikuR1::rgb_color->new( red => $red, green => $green, blue => $blue, alpha => $alpha, );
Python
rgb_color( red = red, green = green, blue = blue, alpha = alpha, )
- red
- green
blue
An integer from
0
to255
.alpha
An integer from
0
(completely transparent) to255
(completely opaque).
Brightness
Returns an integer representing the brightness of the color.
Perl
$rgb_color->Brightness();
Python
rgb_color.Brightness()
set_to
Sets the color components and returns a copy of the new color.
Perl
$rgb_color->set_to( red => $red, green => $green, blue => $blue, alpha => $alpha, );
Python
rgb_color.set_to( red = red, green = green, blue = blue, alpha = alpha, )
- red
- green
blue
An integer from
0
to255
.alpha
An integer from
0
(completely transparent) to255
(completely opaque).
OPERATORS
==
Returns true if the rgb_color objects refer to the same color.
!=
Returns true if the rgb_color objects do not refer to the same color.