diff options
Diffstat (limited to 'src/display/grayscale.cpp')
| -rw-r--r-- | src/display/grayscale.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/display/grayscale.cpp b/src/display/grayscale.cpp index 37f2b255c..f59cf6d23 100644 --- a/src/display/grayscale.cpp +++ b/src/display/grayscale.cpp @@ -21,14 +21,22 @@ namespace Grayscale { +/* Original values from Johan: +const float red_factor = 0.3; +const float green_factor = 0.59; +const float blue_factor = 0.11; +*/ + +// Values below are from the SVG specification +const float red_factor = 0.2125; +const float green_factor = 0.7154; +const float blue_factor = 0.0721; + guint32 process(guint32 rgba) { return process(SP_RGBA32_R_U(rgba), SP_RGBA32_G_U(rgba), SP_RGBA32_B_U(rgba), SP_RGBA32_A_U(rgba)); } guint32 process(guchar r, guchar g, guchar b, guchar a) { - float red_factor = 0.3; - float green_factor = 0.59; - float blue_factor = 0.11; /** To reduce banding in gradients, this calculation is tweaked a bit * by outputing blue+1 or red+1 or both. The luminance is calculated @@ -65,7 +73,8 @@ guchar luminance(guchar r, guchar g, guchar b) { return luminance & 0xff; } -/** @brief Use this method if there is no other way to find out if grayscale view or not +/** + * Use this method if there is no other way to find out if grayscale view or not. * * In some cases, the choice between normal or grayscale is so deep in the code hierarchy, * that it is not possible to determine whether grayscale is desired or not, without using @@ -74,7 +83,7 @@ guchar luminance(guchar r, guchar g, guchar b) { */ bool activeDesktopIsGrayscale() { if (SP_ACTIVE_DESKTOP) { - return (SP_ACTIVE_DESKTOP->getColorMode() == Inkscape::COLORRENDERMODE_GRAYSCALE); + return (SP_ACTIVE_DESKTOP->getColorMode() == Inkscape::COLORMODE_GRAYSCALE); } else { return false; } |
