private MagickImage ExecuteCombine(XmlElement element, MagickImageCollection collection) { Hashtable arguments = new Hashtable(); foreach (XmlAttribute attribute in element.Attributes) { arguments[attribute.Name] = Variables.GetValue <Channels>(attribute); } if (arguments.Count == 0) { return(collection.Combine()); } else if (OnlyContains(arguments, "channels")) { return(collection.Combine((Channels)arguments["channels"])); } else { throw new ArgumentException("Invalid argument combination for 'combine', allowed combinations are: [] [channels]"); } }
public void Test_Combine() { using (MagickImage rose = new MagickImage(Files.Builtin.Rose)) { using (MagickImageCollection collection = new MagickImageCollection()) { ExceptionAssert.Throws<InvalidOperationException>(delegate () { collection.Combine(); }); collection.AddRange(rose.Separate(Channels.RGB)); Assert.AreEqual(3, collection.Count); MagickImage image = collection.Merge(); Assert.AreNotEqual(rose.TotalColors, image.TotalColors); image.Dispose(); image = collection.Combine(); Assert.AreEqual(rose.TotalColors, image.TotalColors); } } }
public void Test_Combine() { using (MagickImage rose = new MagickImage(Files.Builtin.Rose)) { using (MagickImageCollection collection = new MagickImageCollection(rose.Separate(Channels.RGB))) { Assert.AreEqual(3, collection.Count); MagickImage image = collection.Merge(); Assert.AreNotEqual(rose.TotalColors, image.TotalColors); image.Dispose(); image = collection.Combine(); Assert.AreEqual(rose.TotalColors, image.TotalColors); } } }
private MagickImage ExecuteCombine(XmlElement element, MagickImageCollection collection) { Hashtable arguments = new Hashtable(); foreach (XmlAttribute attribute in element.Attributes) { arguments[attribute.Name] = Variables.GetValue<Channels>(attribute); } if (arguments.Count == 0) return collection.Combine(); else if (OnlyContains(arguments, "channels")) return collection.Combine((Channels)arguments["channels"]); else throw new ArgumentException("Invalid argument combination for 'combine', allowed combinations are: [] [channels]"); }