Skip to content
Permalink
Browse files

Revert grayscale luminance constants

While dcc5a1f updated the CVD grayscale simulation
to match Chromium and Firefox, Nguyen (2017)
(https://doi.org/10.1109/CVPR.2017.627) writes that
those constants incorrectly assume a conversion from
the NTSC color space. QGIS was previously using
constants from sRGB, and this commit reverts them,
adding decimal points to correspond to Nguyen.
  • Loading branch information
willcohen authored and nyalldawson committed Oct 27, 2020
1 parent d91c671 commit f909c70cd97c9f7014994f30557a5127136c3ec2
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/gui/qgsprevieweffect.cpp
@@ -124,7 +124,7 @@ QRgb QgsPreviewEffect::simulateColorBlindness( QRgb &originalColor, QgsPreviewEf

void QgsPreviewEffect::simulateGrayscale( int &r, int &g, int &b, int &red, int &green, int &blue )
{
r = ( 0.299 * red ) + ( 0.587 * green ) + ( 0.114 * blue );
r = ( 0.2126 * red ) + ( 0.7152 * green ) + ( 0.0722 * blue );
g = r;
b = r;
}

0 comments on commit f909c70

Please sign in to comment.
You can’t perform that action at this time.