mlaily/NegativeScreen

Lacks description of the matrix components

ststeiger opened this issue · 2 comments

I can't find a description of the matrices components anywhere in the config file.
I wanted to add color-blindness filters, as in the link in reddit.com below.
But unfortunately no time to read the source-code right now.
Maybe you could add them, when you have a moment's spare time ?

https://www.reddit.com/r/gamedev/comments/2i9edg/code_to_create_filters_for_colorblind/
http://web.archive.org/web/20081014161121/http://www.colorjack.com/labs/colormatrix/
http://colrd.com/labs/colormatrix/

I assume the 3x3 matrix starting topLeft is RGB.
What is the 4th factor ? Alpha ?

I assume it's a standard GDI color matrix ?
http://www.c-sharpcorner.com/article/color-transformations-and-the-color-matrix/
https://www.codeproject.com/Articles/3772/ColorMatrix-Basics-Simple-Image-Color-Adjustment
https://msdn.microsoft.com/en-us/library/windows/desktop/ms533875(v=vs.85).aspx

So I assume this is correct:


Normal=win+alt+F12
{ 1.0,  0.0,  0.0,  0.0,  0.0 }
{ 0.0,  1.0,  0.0,  0.0,  0.0 }
{ 0.0,  0.0,  1.0,  0.0,  0.0 }
{ 0.0,  0.0,  0.0,  1.0,  0.0 }
{ 0.0,  0.0,  0.0,  0.0,  1.0 }


# http://www.color-blindness.com/protanopia-red-green-color-blindness/
# Red-Green Color Blindness   - Male Population: 1.01%, Female 0.02
Protanopia (Red-Green Color Blindness)=win+alt+F13
{ 0.567,  0.433,  0.0  ,  0.0,  0.0 }
{ 0.558,  0.442,  0.0  ,  0.0,  0.0 }
{ 0.0  ,  0.242,  0.758,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }


# http://www.color-blindness.com/protanopia-red-green-color-blindness/
#Protanomaly (red-weak)  - Male Population: 1.08%, 0.03%
Protanomaly (red-weak)=win+alt+F14
{ 0.817,  0.183,  0.0  ,  0.0,  0.0 }
{ 0.333,  0.667,  0.0  ,  0.0,  0.0 }
{ 0.0  ,  0.125,  0.857,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }


# http://www.color-blindness.com/deuteranopia-red-green-color-blindness/
# http://www.colour-blindness.com/general/prevalence/
# Deuteranopia (also called green-blind) - Male Population: 1%, Female Population: 0.1%
Deuteranopia (green-blind)=win+alt+F15
{ 0.625,  0.375,  0.0,  0.0,  0.0 }
{ 0.7  ,  0.3  ,  0.0,  0.0,  0.0 }
{ 0.0  ,  0.3  ,  0.7,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0,  0.0,  1.0 }


# http://www.colour-blindness.com/general/prevalence/
# Deuteranomaly (green-weak) - Male Population: 5%, Female Population: 0.35%
Deuteranomaly (green-weak)=win+alt+F16
{ 0.8  ,  0.2  ,  0.0  ,  0.0,  0.0 }
{ 0.258,  0.742,  0.0  ,  0.0,  0.0 }
{ 0.0  ,  0.142,  0.858,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }


# http://www.color-blindness.com/tritanopia-blue-yellow-color-blindness/
# http://www.colour-blindness.com/general/prevalence/
# Tritanopia – Blue-Yellow Color Blindness - rare. Some sources estimate 0.008% 
Tritanopia (Blue-Yellow Color Blindness - rare)=win+alt+F17
{ 0.95 ,  0.05 ,  0.0  ,  0.0,  0.0 }
{ 0.0  ,  0.433,  0.567,  0.0,  0.0 }
{ 0.0  ,  0.475,  0.525,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }


# http://www.color-blindness.com/tritanopia-blue-yellow-color-blindness/
# http://www.colour-blindness.com/general/prevalence/
# Tritanomaly (blue-yellow weak) - Male 0.01%, Female 0.01%
Tritanomaly (blue-yellow weak)=win+alt+F18
{ 0.967,  0.033,  0.0  ,  0.0,  0.0 }
{ 0.0  ,  0.733,  0.267,  0.0,  0.0 }
{ 0.0  ,  0.183,  0.817,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }


# http://www.color-blindness.com/2007/07/20/monochromacy-complete-color-blindness/
# Total color blindness - Occurrences are estimated to be between 1 : 30’000 and 1 : 50’000.
Achromatopsia (Total color blindness)=win+alt+F19
{ 0.299,  0.587,  0.114,  0.0,  0.0 }
{ 0.299,  0.587,  0.114,  0.0,  0.0 }
{ 0.299,  0.587,  0.114,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }


# http://www.color-blindness.com/2007/07/20/monochromacy-complete-color-blindness/
# All color-weak - Different sources vary between 1 in 33’000 to 100’000 (0.001%).
Achromatomaly (Total color weakness)=win+alt+F20
{ 0.618,  0.320,  0.062,  0.0,  0.0 }
{ 0.163,  0.775,  0.062,  0.0,  0.0 }
{ 0.163,  0.320,  0.516,  0.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  1.0,  0.0 }
{ 0.0  ,  0.0  ,  0.0  ,  0.0,  1.0 }

Thanks for your work.

You are right, the color matrices are standard GDI color matrices, and the four components are R,G,B,A.

I'm not too keen on the maths, so maybe I'm missing some things, but here is my basic understanding of what does what in a color matrix, when applied to a color vector:

r*=x		g+=x*r		b+=x*r		a+=x*r		0
r+=x*g		g*=x		b+=x*g		a+=x*g		0
r+=x*b		g+=x*b		b*=x		a+=x*b		0
r+=x*a		g+=x*a		b+=x*a		a*=x		0
r+=x		g+=x		b+=x		a+=x		1

where x is the value in the matrix.

I guess I should add this somewhere to the documentation...

Anyway, your matrices don't work as intended: the matrix format used in your source link is not the same as the one used by NegativesScreen, the rows and columns are flipped.

But you are lucky, someone already asked the same thing as you by mail, so I already have the matrices adapted for NegativeScreen.

Here they are :

# http://www.color-blindness.com/protanopia-red-green-color-blindness/
# Red-Green Color Blindness   - Male Population: 1.01%, Female 0.02
Protanopia (Red-Green Color Blindness)=win+alt+F13
{ 0.567, 0.558, 0, 0, 0 }
{ 0.433, 0.442, 0.242, 0, 0 }
{ 0, 0, 0.758, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.color-blindness.com/protanopia-red-green-color-blindness/
# Protanomaly (red-weak)  - Male Population: 1.08%, 0.03%
Protanomaly (red-weak)=win+alt+F14
{ 0.817, 0.333, 0, 0, 0 }
{ 0.183, 0.667, 0.125, 0, 0 }
{ 0, 0, 0.875, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.color-blindness.com/deuteranopia-red-green-color-blindness/
# http://www.colour-blindness.com/general/prevalence/
# Deuteranopia (also called green-blind) - Male Population: 1%, Female Population: 0.1%
Deuteranopia (green-blind)=win+alt+F15
{ 0.625, 0.7, 0, 0, 0 }
{ 0.375, 0.3, 0.3, 0, 0 }
{ 0, 0, 0.7, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.colour-blindness.com/general/prevalence/
# Deuteranomaly (green-weak) - Male Population: 5%, Female Population: 0.35%
Deuteranomaly (green-weak)=win+alt+F16
{ 0.8, 0.258, 0, 0, 0 }
{ 0.2, 0.742, 0.142, 0, 0 }
{ 0, 0, 0.858, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.color-blindness.com/tritanopia-blue-yellow-color-blindness/
# http://www.colour-blindness.com/general/prevalence/
# Tritanopia – Blue-Yellow Color Blindness - rare. Some sources estimate 0.008% 
Tritanopia (Blue-Yellow Color Blindness - rare)=win+alt+F17
{ 0.95, 0, 0, 0, 0 }
{ 0.05, 0.433, 0.475, 0, 0 }
{ 0, 0.567, 0.525, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.color-blindness.com/tritanopia-blue-yellow-color-blindness/
# http://www.colour-blindness.com/general/prevalence/
# Tritanomaly (blue-yellow weak) - Male 0.01%, Female 0.01%
Tritanomaly (blue-yellow weak)=win+alt+F18
{ 0.967, 0, 0, 0, 0 }
{ 0.033, 0.733, 0.183, 0, 0 }
{ 0, 0.267, 0.817, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.color-blindness.com/2007/07/20/monochromacy-complete-color-blindness/
# Total color blindness - Occurrences are estimated to be between 1 : 30’000 and 1 : 50’000.
Achromatopsia (Total color blindness)=win+alt+F19
{ 0.299, 0.299, 0.299, 0, 0 }
{ 0.587, 0.587, 0.587, 0, 0 }
{ 0.114, 0.114, 0.114, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }


# http://www.color-blindness.com/2007/07/20/monochromacy-complete-color-blindness/
# All color-weak - Different sources vary between 1 in 33’000 to 100’000 (0.001%).
Achromatomaly (Total color weakness)=win+alt+F20
{ 0.618, 0.163, 0.163, 0, 0 }
{ 0.32, 0.775, 0.32, 0, 0 }
{ 0.062, 0.062, 0.516, 0, 0 }
{ 0, 0, 0, 1, 0 }
{ 0, 0, 0, 0, 1 }

(Thanks for taking the time to add nice info next to each matrix btw)

OK thanks for the info - closing issue.