private void ToggleColorEffect(bool fromNormal) { if (fromNormal) { if (Configuration.Current.SmoothToggles) { BuiltinMatrices.InterpolateColorEffect(BuiltinMatrices.Identity, currentMatrix); } else { BuiltinMatrices.ChangeColorEffect(currentMatrix); } } else { if (Configuration.Current.SmoothToggles) { BuiltinMatrices.InterpolateColorEffect(currentMatrix, BuiltinMatrices.Identity); } else { BuiltinMatrices.ChangeColorEffect(BuiltinMatrices.Identity); } } }
/// <summary> /// Check if the magnification api is in a state where a color effect can be applied, then proceed. /// </summary> /// <param name="matrix"></param> private void SafeChangeColorEffect(float[,] matrix) { if (!mainLoopPaused && !exiting) { try { if (Configuration.Current.SmoothTransitions) { BuiltinMatrices.InterpolateColorEffect(currentMatrix, matrix); } else { BuiltinMatrices.ChangeColorEffect(matrix); } } // Ignore ColorEffectChangeException, probably thrown because the Windows Magnifier has its color inversion enabled. catch (CannotChangeColorEffectException) { // But we don't change the current matrix. return; } } currentMatrix = matrix; }