private void ExecuteCopyPixels(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 == "geometry")
arguments["geometry"] = Variables.GetValue<MagickGeometry>(attribute);
else if (attribute.Name == "offset")
arguments["offset"] = Variables.GetValue<PointD>(attribute);
else if (attribute.Name == "x")
arguments["x"] = Variables.GetValue<Int32>(attribute);
else if (attribute.Name == "y")
arguments["y"] = Variables.GetValue<Int32>(attribute);
}
foreach (XmlElement elem in element.SelectNodes("*"))
{
arguments[elem.Name] = CreateMagickImage(elem);
}
if (OnlyContains(arguments, "source"))
image.CopyPixels((MagickImage)arguments["source"]);
else if (OnlyContains(arguments, "source", "channels"))
image.CopyPixels((MagickImage)arguments["source"], (Channels)arguments["channels"]);
else if (OnlyContains(arguments, "source", "geometry"))
image.CopyPixels((MagickImage)arguments["source"], (MagickGeometry)arguments["geometry"]);
else if (OnlyContains(arguments, "source", "geometry", "channels"))
image.CopyPixels((MagickImage)arguments["source"], (MagickGeometry)arguments["geometry"], (Channels)arguments["channels"]);
else if (OnlyContains(arguments, "source", "geometry", "offset"))
image.CopyPixels((MagickImage)arguments["source"], (MagickGeometry)arguments["geometry"], (PointD)arguments["offset"]);
else if (OnlyContains(arguments, "source", "geometry", "offset", "channels"))
image.CopyPixels((MagickImage)arguments["source"], (MagickGeometry)arguments["geometry"], (PointD)arguments["offset"], (Channels)arguments["channels"]);
else if (OnlyContains(arguments, "source", "geometry", "x", "y"))
image.CopyPixels((MagickImage)arguments["source"], (MagickGeometry)arguments["geometry"], (Int32)arguments["x"], (Int32)arguments["y"]);
else if (OnlyContains(arguments, "source", "geometry", "x", "y", "channels"))
image.CopyPixels((MagickImage)arguments["source"], (MagickGeometry)arguments["geometry"], (Int32)arguments["x"], (Int32)arguments["y"], (Channels)arguments["channels"]);
else
throw new ArgumentException("Invalid argument combination for 'copyPixels', allowed combinations are: [source] [source, channels] [source, geometry] [source, geometry, channels] [source, geometry, offset] [source, geometry, offset, channels] [source, geometry, x, y] [source, geometry, x, y, channels]");
}
private void ExecuteCrop(XmlElement element, MagickImage image)