win_magnification.effects

@MaxBQb

Aug 11, 2023

Color effects (color transformation matrices)
Inspired by:
inversion(value=1.0) types.ColorMatrix[source]
Invert colors (black -> white, white -> black)
Parameters

value – Power of effect applied

Returns

Color inversion effect matrix

grayscale(value=1.0) types.ColorMatrix[source]
All colors become shades of gray
Parameters

value – Power of effect applied

Returns

Color grayscale effect matrix

sepia(value=1.0) types.ColorMatrix[source]
All colors become shades of brown
Parameters

value – Power of effect applied

Returns

Color sepia effect matrix

contrast(value=1.0) types.ColorMatrix[source]
Make colors more bright and contrast
Example:
>>> tools.print_matrix(contrast())
1.2  0.0  0.0  0.0 -0.2
0.0  1.2  0.0  0.0 -0.2
0.0  0.0  1.2  0.0 -0.2
0.0  0.0  0.0  1.0  0.0
0.0  0.0  0.0  0.0  1.0
Parameters

value – Power of effect applied

Returns

Color sepia effect matrix

binary(value=1) types.ColorMatrix[source]
Only white and black colors stay
Example:
>>> tools.print_matrix(binary())
 127.0  127.0  127.0  0.0  0.0
 127.0  127.0  127.0  0.0  0.0
 127.0  127.0  127.0  0.0  0.0
 0.0    0.0    0.0    1.0  0.0
-180.0 -180.0 -180.0  0.0  1.0
Parameters

value – Power of effect applied, normally uses -1, 0, 1, on low values (like 0.001) act like get_transition() value

Returns

Color binary effect matrix

blindness_deuteranopia(value=1.0) types.ColorMatrix[source]
Simulates color blindness: Deuteranomaly (green-weak)
Parameters

value – Power of effect applied

Returns

Color effect matrix adjusted for deuteranopia

blindness_protanopia(value=1.0) types.ColorMatrix[source]
Simulates color blindness: Protanomaly (red-weak)
Parameters

value – Power of effect applied

Returns

Color effect matrix adjusted for protanopia

blindness_tritanopia(value=1.0) types.ColorMatrix[source]
Simulates color blindness: Tritanomaly (blue-yellow weak)
Parameters

value – Power of effect applied

Returns

Color effect matrix adjusted for tritanopia