private void ExecuteContrastStretch(XmlElement element, MagickImage image)
{
Hashtable arguments = new Hashtable();
foreach (XmlAttribute attribute in element.Attributes)
{
if (attribute.Name == "blackPoint")
arguments["blackPoint"] = Variables.GetValue<Percentage>(attribute);
else if (attribute.Name == "channels")
arguments["channels"] = Variables.GetValue<Channels>(attribute);
else if (attribute.Name == "whitePoint")
arguments["whitePoint"] = Variables.GetValue<Percentage>(attribute);
}
if (OnlyContains(arguments, "blackPoint"))
image.ContrastStretch((Percentage)arguments["blackPoint"]);
else if (OnlyContains(arguments, "blackPoint", "whitePoint"))
image.ContrastStretch((Percentage)arguments["blackPoint"], (Percentage)arguments["whitePoint"]);
else if (OnlyContains(arguments, "blackPoint", "whitePoint", "channels"))
image.ContrastStretch((Percentage)arguments["blackPoint"], (Percentage)arguments["whitePoint"], (Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'contrastStretch', allowed combinations are: [blackPoint] [blackPoint, whitePoint] [blackPoint, whitePoint, channels]");
}
private void ExecuteCopyPixels(XmlElement element, MagickImage image)