nCine::Color class

Four-channels color with 8-bits integer per component.

Public static variables

static std::int32_t NumChannels constexpr
static const Color Black
static const Color White
static const Color Red
static const Color Green
static const Color Blue
static const Color Yellow
static const Color Magenta
static const Color Cyan

Constructors, destructors, conversion operators

Color() constexpr noexcept
Default constructor (transparent color)
Color(NoInitT) explicit noexcept
Color(std::uint32_t red, std::uint32_t green, std::uint32_t blue) constexpr noexcept
Three channels constructor.
Color(std::uint32_t red, std::uint32_t green, std::uint32_t blue, std::uint32_t alpha) constexpr noexcept
Four channels constructor.
Color(std::uint32_t hex) explicit
Three channels constructor from a hexadecimal code.
Color(const std::uint32_t channels[NumChannels]) explicit
Four channels constructor from an array.
Color(const Colorf& color) explicit

Public functions

auto Rgba() const -> std::uint32_t
Returns the color as a single RGBA unsigned integer.
auto Argb() const -> std::uint32_t
Returns the color as a single RGBA unsigned integer.
auto Abgr() const -> std::uint32_t
Returns the color as a single ABGR unsigned integer.
auto Bgra() const -> std::uint32_t
Returns the color as a single BGRA unsigned integer.
auto Data() const -> const std::uint8_t*
Returns color array.
auto Data() -> std::uint8_t*
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Set(std::uint32_t red, std::uint32_t green, std::uint32_t blue, std::uint32_t alpha) constexpr
Sets four color channels.
void Set(std::uint32_t red, std::uint32_t green, std::uint32_t blue)
Sets three color channels.
void Set(std::uint32_t hex)
Sets three color channels from a hexadecimal code.
void SetVec(const std::uint32_t channels[NumChannels])
Sets four color channels from an array.
void SetAlpha(std::uint32_t alpha)
Sets the alpha channel.
auto operator=(const Colorf& color) -> Color&
Assigns operator from a normalized float color.
auto operator==(const Color& color) const -> bool
auto operator!=(const Color& color) const -> bool
auto operator+=(const Color& v) -> Color&
auto operator-=(const Color& v) -> Color&
auto operator*=(const Color& color) -> Color&
auto operator*=(float scalar) -> Color&
Multiplies by a constant scalar.
auto operator+(const Color& color) const -> Color
auto operator-(const Color& color) const -> Color
auto operator*(const Color& color) const -> Color
auto operator*(float scalar) const -> Color
Multiplies by a constant scalar.

Public variables

std::uint8_t R
std::uint8_t G
std::uint8_t B
std::uint8_t A