summaryrefslogtreecommitdiffstats
path: root/src/display/cairo-utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/display/cairo-utils.cpp')
-rw-r--r--src/display/cairo-utils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index 9655fc194..831b37899 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -597,6 +597,15 @@ void ink_cairo_surface_average_color_premul(cairo_surface_t *surface, double &r,
a = CLAMP(a, 0.0, 1.0);
}
+void srgb_to_linear( double* c ) {
+
+ if( *c < 0.04045 ) {
+ *c /= 12.92;
+ } else {
+ *c = pow( (*c+0.055)/1.055, 2.4 );
+ }
+}
+
void srgb_to_linear( guint32* c, guint32 a ) {
*c = unpremul_alpha( *c, a );