Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
utils.h File Reference

Go to the source code of this file.

Namespaces

namespace  Inkscape
 Helper class to stream background task notifications as a series of messages.
 
namespace  Inkscape::Colors
 A set of useful color modifying functions which do not fit as generic methods on the color class itself but which are used in various places.
 

Functions

constexpr double SP_COLOR_U_TO_F (uint32_t v)
 
constexpr uint32_t SP_COLOR_F_TO_U (double v)
 
constexpr uint32_t SP_RGBA32_R_U (uint32_t v)
 
constexpr uint32_t SP_RGBA32_G_U (uint32_t v)
 
constexpr uint32_t SP_RGBA32_B_U (uint32_t v)
 
constexpr uint32_t SP_RGBA32_A_U (uint32_t v)
 
constexpr double SP_RGBA32_R_F (uint32_t v)
 
constexpr double SP_RGBA32_G_F (uint32_t v)
 
constexpr double SP_RGBA32_B_F (uint32_t v)
 
constexpr double SP_RGBA32_A_F (uint32_t v)
 
constexpr uint32_t SP_RGBA32_U_COMPOSE (uint32_t r, uint32_t g, uint32_t b, uint32_t a)
 
constexpr uint32_t SP_RGBA32_F_COMPOSE (double r, double g, double b, double a)
 
constexpr uint32_t SP_RGBA32_C_COMPOSE (uint32_t c, double o)
 
constexpr uint32_t compose_argb32 (double a, double r, double g, double b)
 
uint32_t Inkscape::Colors::hex_to_rgba (std::string const &value)
 Parse a color directly without any CSS or CMS support.
 
std::vector< double > Inkscape::Colors::rgba_to_values (uint32_t rgba, bool opacity)
 Convert a 32bit unsigned int into a set of 3 or 4 double values for rgba.
 
std::string Inkscape::Colors::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 instead.
 
std::string Inkscape::Colors::color_to_id (std::optional< Color > const &color)
 Create a somewhat unique id for the given color used for palette identification.
 
std::string Inkscape::Colors::desc_to_id (std::string const &desc)
 Transform a color name or description into an id used for palette identification.
 
Color Inkscape::Colors::make_contrasted_color (Color const &orig, double amount)
 Make a darker or lighter version of the color, useful for making checkerboards.
 
Color Inkscape::Colors::make_theme_color (Color const &orig, bool dark)
 Make a themed dark or light color based on a previous shade, returns RGB color.
 
double Inkscape::Colors::lightness (Color color)
 
double Inkscape::Colors::perceptual_lightness (double l)
 
double Inkscape::Colors::get_perceptual_lightness (Color const &color)
 Return a value for how the light the color appears to be using HSLUV.
 
std::pair< double, double > Inkscape::Colors::get_contrasting_color (double l)
 

Function Documentation

◆ compose_argb32()

constexpr uint32_t compose_argb32 ( double  a,
double  r,
double  g,
double  b 
)
constexpr

Definition at line 73 of file utils.h.

References SP_COLOR_F_TO_U(), and SP_RGBA32_U_COMPOSE().

◆ SP_COLOR_F_TO_U()

◆ SP_COLOR_U_TO_F()

constexpr double SP_COLOR_U_TO_F ( uint32_t  v)
constexpr

Definition at line 19 of file utils.h.

Referenced by SP_RGBA32_A_F(), SP_RGBA32_B_F(), SP_RGBA32_G_F(), and SP_RGBA32_R_F().

◆ SP_RGBA32_A_F()

◆ SP_RGBA32_A_U()

constexpr uint32_t SP_RGBA32_A_U ( uint32_t  v)
constexpr

◆ SP_RGBA32_B_F()

◆ SP_RGBA32_B_U()

◆ SP_RGBA32_C_COMPOSE()

constexpr uint32_t SP_RGBA32_C_COMPOSE ( uint32_t  c,
double  o 
)
constexpr

◆ SP_RGBA32_F_COMPOSE()

◆ SP_RGBA32_G_F()

◆ SP_RGBA32_G_U()

◆ SP_RGBA32_R_F()

◆ SP_RGBA32_R_U()

◆ SP_RGBA32_U_COMPOSE()

constexpr uint32_t SP_RGBA32_U_COMPOSE ( uint32_t  r,
uint32_t  g,
uint32_t  b,
uint32_t  a 
)
constexpr