private void HandleEsc(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { var magEffectInvert = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 1.0f, 0, 0, 0, 0, 0, 1.0f, 0, 0, 0, 0, 0, 1.0f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvert); NativeMethods.InvalidateRect(this.Handle, IntPtr.Zero, true); this.Close(); // mMainForm.Show(); } }
public void setColor() { //normal if (mConfiguration.normal) { var magEffectInvertNormal = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 1.0f, 0, 0, 0, 0, 0, 1.0f, 0, 0, 0, 0, 0, 1.0f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertNormal); } //invertColors if (mConfiguration.invertColors) { var magEffectInvertInvertColors = new NativeMethods.MAGCOLOREFFECT { transform = new[] { -1f, 0, 0, 0, 0, 0, -1f, 0, 0, 0, 0, 0, -1f, 0, 0, 0, 0, 0, 1f, 0, 1f, 1f, 1f, 0, 1f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertInvertColors); } //Protanopia if (mConfiguration.protanopia) { var magEffectInvertProtanopia = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.567f, 0.433f, 0, 0, 0, 0.558f, 0.442f, 0, 0, 0, 0, 0.242f, 0.758f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertProtanopia); } if (mConfiguration.protanomaly) { var magEffectInvertProtanomaly = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.817f, 0.183f, 0, 0, 0, 0.333f, 0.667f, 0, 0, 0, 0, 0.125f, 0.875f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertProtanomaly); //Protanomaly } if (mConfiguration.deuteranopia) { var magEffectInvertDeuteranopia = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.625f, 0.375f, 0, 0, 0, 0.7f, 0.3f, 0, 0, 0, 0, 0.3f, 0.7f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertDeuteranopia); //Deuteranopia } if (mConfiguration.deuteranomaly) { var magEffectInvertDeuteranomaly = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.8f, 0.2f, 0, 0, 0, 0.258f, 0.742f, 0, 0, 0, 0, 0.142f, 0.858f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertDeuteranomaly); //Deuteranomaly } if (mConfiguration.tritanopia) { var magEffectInvertTritanopia = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.95f, 0.05f, 0, 0, 0, 0, 0.433f, 0.567f, 0, 0, 0, 0.475f, 0.525f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertTritanopia); //Tritanopia } if (mConfiguration.tritanomaly) { var magEffectInvertTritanomaly = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.967f, 0.033f, 0, 0, 0, 0, 0.733f, 0.267f, 0, 0, 0, 0.183f, 0.817f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertTritanomaly); //Tritanomaly } if (mConfiguration.achromatopsia) { var magEffectInvertAchromatopsia = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.299f, 0.587f, 0.114f, 0, 0, 0.299f, 0.587f, 0.114f, 0, 0, 0.299f, 0.587f, 0.114f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertAchromatopsia); //Achromatopsia } if (mConfiguration.achromatomaly) { var magEffectInvertAchromatomaly = new NativeMethods.MAGCOLOREFFECT { transform = new[] { 0.618f, 0.320f, 0.062f, 0, 0, 0.163f, 0.775f, 0.062f, 0, 0, 0.163f, 0.320f, 0.516f, 0, 0, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; NativeMethods.MagSetFullscreenColorEffect(ref magEffectInvertAchromatomaly); //Achromatomaly } }