1Convert::Color::RGB16(3U)ser Contributed Perl DocumentatiCoonnvert::Color::RGB16(3)
2
3
4

NAME

6       "Convert::Color::RGB16" - a color value represented as red/green/blue
7       in 16-bit integers
8

SYNOPSIS

10       Directly:
11
12        use Convert::Color::RGB16;
13
14        my $red = Convert::Color::RGB16->new( 65535, 0, 0 );
15
16        # Can also parse strings
17        my $pink = Convert::Color::RGB16->new( '65535,49152,49152' );
18
19        # or
20        $pink = Convert::Color::RGB16->new( 'ffffc000c000' );
21
22       Via Convert::Color:
23
24        use Convert::Color;
25
26        my $cyan = Convert::Color->new( 'rgb16:0,65535,65535' );
27

DESCRIPTION

29       Objects in this class represent a color in RGB space, as a set of three
30       integer values in the range 0 to 65535; i.e. as 16 bits.
31
32       For representations using floating point values, see
33       Convert::Color::RGB.  For representations using 8-bit integers, see
34       Convert::Color::RGB8.
35

CONSTRUCTOR

37   $color = Convert::Color::RGB16->new( $red, $green, $blue )
38       Returns a new object to represent the set of values given. These values
39       should be integers between 0 and 65535. Values outside of this range
40       will be clamped.
41
42   $color = Convert::Color::RGB16->new( $string )
43       Parses $string for values, and construct a new object similar to the
44       above three-argument form. The string should be in the form
45
46        red,green,blue
47
48       containing the three integer values in decimal notation. It can also be
49       given in the form of a hex encoded string, such as would be returned by
50       the "rgb16_hex" method:
51
52        rrrrggggbbbb
53

METHODS

55   $r = $color->red
56   $g = $color->green
57   $b = $color->blue
58       Accessors for the three components of the color.
59
60   ( $red, $green, $blue ) = $color->rgb16
61       Returns the individual red, green and blue color components of the
62       color value in RGB16 space.
63
64   $str = $color->hex
65       Returns a string representation of the color components in the RGB16
66       space, in a convenient "RRRRGGGGBBBB" hex string.
67
68   $mix = $color->alpha_blend( $other, [ $alpha ] )
69       Return a new color which is a blended combination of the two passed
70       into it.  The optional $alpha parameter defines the mix ratio between
71       the two colors, defaulting to 0.5 if not defined. Values closer to 0
72       will blend more of $color, closer to 1 will blend more of $other.
73
74   $mix = $color->alpha16_blend( $other, [ $alpha ] )
75       Similar to "alpha_blend" but works with integer arithmetic. $alpha
76       should be an integer in the range 0 to 65535.
77
78   $measure = $color->dst_rgb16( $other )
79       Return a measure of the distance between the two colors. This is the
80       unweighted Euclidean distance of the three color components. Two
81       identical colors will have a measure of 0, pure black and pure white
82       have a distance of 1, and all others will lie somewhere inbetween.
83
84   $measure = $color->dst_rgb16_cheap( $other )
85       Return a measure of the distance between the two colors. This is the
86       sum of the squares of the differences of each of the color components.
87       This is part of the value used to calculate "dst_rgb16", but since it
88       involves no square root it will be cheaper to calculate, for use in
89       cases where only the relative values matter, such as when picking the
90       "best match" out of a set of colors.  It ranges between 0 for identical
91       colours and 3*(65535^2) for the distance between pure black and pure
92       white.
93

SEE ALSO

95       ยท   Convert::Color - color space conversions
96

AUTHOR

98       Paul Evans <leonerd@leonerd.org.uk>
99
100
101
102perl v5.28.0                      2018-07-14          Convert::Color::RGB16(3)
Impressum