private void ExecuteGammaCorrect(XmlElement element, MagickImage image) { Hashtable arguments = new Hashtable(); foreach (XmlAttribute attribute in element.Attributes) { arguments[attribute.Name] = Variables.GetValue<double>(attribute); } if (OnlyContains(arguments, "gamma")) image.GammaCorrect((double)arguments["gamma"]); else if (OnlyContains(arguments, "gammaRed", "gammaGreen", "gammaBlue")) image.GammaCorrect((double)arguments["gammaRed"], (double)arguments["gammaGreen"], (double)arguments["gammaBlue"]); else throw new ArgumentException("Invalid argument combination for 'gammaCorrect', allowed combinations are: [gamma] [gammaRed, gammaGreen, gammaBlue]"); }
private void ExecuteGammaCorrect(XmlElement element, MagickImage image) { Hashtable arguments = new Hashtable(); foreach (XmlAttribute attribute in element.Attributes) { if (attribute.Name == "channels") arguments["channels"] = Variables.GetValue<Channels>(attribute); else if (attribute.Name == "gamma") arguments["gamma"] = Variables.GetValue<double>(attribute); } if (OnlyContains(arguments, "gamma")) image.GammaCorrect((double)arguments["gamma"]); else if (OnlyContains(arguments, "gamma", "channels")) image.GammaCorrect((double)arguments["gamma"], (Channels)arguments["channels"]); else throw new ArgumentException("Invalid argument combination for 'gammaCorrect', allowed combinations are: [gamma] [gamma, channels]"); }
public void Test_Gamma() { MagickImage first = new MagickImage(Files.InvitationTif); first.GammaCorrect(2.0); MagickImage second = new MagickImage(Files.InvitationTif); second.GammaCorrect(2.0, 1.0, 0.5); Assert.AreNotEqual(first, second); first.Dispose(); second.Dispose(); }