/*
4 * Authors: see git history
6 * Copyright (C) 2023 Authors
7 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
25 static std::shared_ptr<Colors::CMS::Profile>
srgb_profile;
32RGB::RGB(
Type type,
int components, std::string
name, std::string shortName, std::string icon,
bool spaceIsUnbounded):
33 AnySpace(type, components,
std::move(
name),
std::move(shortName),
std::move(icon), spaceIsUnbounded) {
42std::string
RGB::toString(std::vector<double>
const &values,
bool opacity)
const
50uint32_t
RGB::toRGBA(std::vector<double>
const &values,
double opacity)
const
53 std::vector<double> copy = values;
60uint32_t
RGB::_to_rgba(std::vector<double>
const &values,
double opacity)
const
62 switch (values.size()) {
68 throw ColorError(
"Color values should be size 3 for RGB or 4 for RGBA.");
static std::shared_ptr< Profile > create_srgb()
Construct the default lcms sRGB color profile and return.
static bool append_css_value(std::istringstream &ss, std::vector< double > &output, bool &end, char const sep=0x0, double scale=1.0)
Parse a CSS color number and format it according to it's unit.
std::shared_ptr< Colors::CMS::Profile > srgb_profile
virtual void spaceToProfile(std::vector< double > &io) const
Convert from the space's format, to the profile's data format.
bool parse(std::istringstream &input, std::vector< double > &output) const override
uint32_t _to_rgba(std::vector< double > const &values, double opacity) const
std::shared_ptr< Colors::CMS::Profile > const getProfile() const override
Return the RGB color profile, this is static for all RGB sub-types.
std::string toString(std::vector< double > const &values, bool opacity=true) const override
Print the RGB color to a CSS Hex code of 6 or 8 digits.
uint32_t toRGBA(std::vector< double > const &values, double opacity=1.0) const override
Convert the color into an RGBA32 for use within Gdk rendering.
constexpr uint32_t SP_RGBA32_F_COMPOSE(double r, double g, double b, double a)
std::string rgba_to_hex(uint32_t value, bool alpha)
Output the RGBA value as a #RRGGBB hex color, if alpha is true then the output will be #RRGGBBAA inst...
Authors: see git history.