Class endstone::Color¶
Represents a color with red, green, blue, and alpha components.
- #include <endstone/util/color.h>
Public Static Attributes¶
| Type | Name | 
|---|---|
| constexpr int | BIT_MASK   = 0xff | 
| constexpr int | DEFAULT_ALPHA   = 255 | 
Public Functions¶
| Type | Name | 
|---|---|
| constexpr | Color (const std::uint8_t red, const std::uint8_t green, const std::uint8_t blue, const std::uint8_t alpha=DEFAULT_ALPHA) | 
| int | asABGR () const Gets the color as an ABGR integer. | 
| int | asBGR () const Gets the color as an BGR integer. | 
| int | asRGB () const Gets the color as an RGB integer. | 
| int | asRGBA () const Gets the color as an RGBA integer. | 
| int | getAlpha () const Gets the alpha component of the color. | 
| int | getBlue () const Gets the blue component of the color. | 
| int | getGreen () const Gets the green component of the color. | 
| int | getRed () const Gets the red component of the color. | 
| bool | operator!= (const Color & other) const | 
| bool | operator== (const Color & other) const | 
| Result< Color > | setAlpha (const int alpha) const Creates a new Color object with specified component. | 
| Result< Color > | setBlue (const int blue) const Creates a new Color object with specified component. | 
| Result< Color > | setGreen (const int green) const Creates a new Color object with specified component. | 
| Result< Color > | setRed (const int red) const Creates a new Color object with specified component. | 
Public Static Functions¶
| Type | Name | 
|---|---|
| Result< Color > | fromABGR (const int abgr) Creates a new color object from an integer that contains the alpha, blue, green, and red bytes. | 
| Result< Color > | fromBGR (const int blue, const int green, const int red) Creates a new Color object from a blue, green, and red. | 
| Result< Color > | fromBGR (const int bgr) | 
| Result< Color > | fromRGB (const int red, const int green, const int blue) Creates a new Color object from a red, green, and blue. | 
| Result< Color > | fromRGB (const int rgb) Creates a new color object from an integer that contains the red, green, and blue bytes in the lowest order 24 bits. | 
| Result< Color > | fromRGBA (int red, int green, int blue, int alpha) Creates a new Color object from a red, green, blue, and alpha. | 
| Result< Color > | fromRGBA (const int rgba) Creates a new color object from an integer that contains the red, green, blue, and alpha bytes. | 
Public Static Attributes Documentation¶
variable BIT_MASK¶
variable DEFAULT_ALPHA¶
Public Functions Documentation¶
function Color¶
inline constexpr endstone::Color::Color (
    const std::uint8_t red,
    const std::uint8_t green,
    const std::uint8_t blue,
    const std::uint8_t alpha=DEFAULT_ALPHA
) 
function asABGR¶
Gets the color as an ABGR integer.
Returns:
An integer representation of this color, as 0xAABBGGRR
function asBGR¶
Gets the color as an BGR integer.
Returns:
An integer representation of this color, as 0xBBGGRR
function asRGB¶
Gets the color as an RGB integer.
Returns:
An integer representation of this color, as 0xRRGGBB
function asRGBA¶
Gets the color as an RGBA integer.
Returns:
An integer representation of this color, as 0xRRGGBBAA
function getAlpha¶
Gets the alpha component of the color.
Returns:
The alpha component (0–255) of the color.
function getBlue¶
Gets the blue component of the color.
Returns:
The blue component (0–255) of the color.
function getGreen¶
Gets the green component of the color.
Returns:
The green component (0–255) of the color.
function getRed¶
Gets the red component of the color.
Returns:
The red component (0–255) of the color.
function operator!=¶
function operator==¶
function setAlpha¶
Creates a new Color object with specified component.
Parameters:
- alphathe alpha component, from 0 to 255
Returns:
a new color object with the alpha component
function setBlue¶
Creates a new Color object with specified component.
Parameters:
- bluethe blue component, from 0 to 255
Returns:
a new color object with the blue component
function setGreen¶
Creates a new Color object with specified component.
Parameters:
- greenthe green component, from 0 to 255
Returns:
a new color object with the green component
function setRed¶
Creates a new Color object with specified component.
Parameters:
- redthe red component, from 0 to 255
Returns:
a new color object with the red component
Public Static Functions Documentation¶
function fromABGR¶
Creates a new color object from an integer that contains the alpha, blue, green, and red bytes.
Parameters:
- abgrthe integer storing the alpha, blue, green, and red values
Returns:
a new color object for specified values
function fromBGR [½]¶
Creates a new Color object from a blue, green, and red.
static inline Result< Color > endstone::Color::fromBGR (
    const int blue,
    const int green,
    const int red
) 
Parameters:
- blueinteger from 0-255
- greeninteger from 0-255
- redinteger from 0-255
Returns:
a new Color object for the red, green, blue
function fromBGR [2/2]¶
function fromRGB [½]¶
Creates a new Color object from a red, green, and blue.
static inline Result< Color > endstone::Color::fromRGB (
    const int red,
    const int green,
    const int blue
) 
Parameters:
- redinteger from 0-255
- greeninteger from 0-255
- blueinteger from 0-255
Returns:
a new Color object for the red, green, blue
function fromRGB [2/2]¶
Creates a new color object from an integer that contains the red, green, and blue bytes in the lowest order 24 bits.
Parameters:
- rgbthe integer storing the red, green, and blue values
Returns:
a new color object for specified values
function fromRGBA [½]¶
Creates a new Color object from a red, green, blue, and alpha.
Parameters:
- redinteger from 0-255
- greeninteger from 0-255
- blueinteger from 0-255
- alphainteger from 0-255
Returns:
a new Color object for the red, green, blue, alpha
function fromRGBA [2/2]¶
Creates a new color object from an integer that contains the red, green, blue, and alpha bytes.
Parameters:
- rgbathe integer storing the red, green, blue, and alpha values
Returns:
a new color object for specified values
The documentation for this class was generated from the following file include/endstone/util/color.h