private void ExecuteRandomThreshold(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 == "high")
arguments["high"] = Variables.GetValue<QuantumType>(attribute);
else if (attribute.Name == "low")
arguments["low"] = Variables.GetValue<QuantumType>(attribute);
else if (attribute.Name == "percentageHigh")
arguments["percentageHigh"] = Variables.GetValue<Percentage>(attribute);
else if (attribute.Name == "percentageLow")
arguments["percentageLow"] = Variables.GetValue<Percentage>(attribute);
}
if (OnlyContains(arguments, "low", "high"))
image.RandomThreshold((QuantumType)arguments["low"], (QuantumType)arguments["high"]);
else if (OnlyContains(arguments, "low", "high", "channels"))
image.RandomThreshold((QuantumType)arguments["low"], (QuantumType)arguments["high"], (Channels)arguments["channels"]);
else if (OnlyContains(arguments, "percentageLow", "percentageHigh"))
image.RandomThreshold((Percentage)arguments["percentageLow"], (Percentage)arguments["percentageHigh"]);
else if (OnlyContains(arguments, "percentageLow", "percentageHigh", "channels"))
image.RandomThreshold((Percentage)arguments["percentageLow"], (Percentage)arguments["percentageHigh"], (Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'randomThreshold', allowed combinations are: [low, high] [low, high, channels] [percentageLow, percentageHigh] [percentageLow, percentageHigh, channels]");
}
private void ExecuteReduceNoise(XmlElement element, MagickImage image)