Beispiel #1
0
 private void ExecuteTint(XmlElement element, MagickImage image)
 {
   String opacity_ = Variables.GetValue<String>(element, "opacity");
   image.Tint(opacity_);
 }
Beispiel #2
0
 private void ExecuteTint(XmlElement element, MagickImage image)
 {
   Hashtable arguments = new Hashtable();
   foreach (XmlAttribute attribute in element.Attributes)
   {
     if (attribute.Name == "color")
       arguments["color"] = Variables.GetValue<MagickColor>(attribute);
     else if (attribute.Name == "opacity")
       arguments["opacity"] = Variables.GetValue<String>(attribute);
   }
   if (OnlyContains(arguments, "opacity"))
     image.Tint((String)arguments["opacity"]);
   else if (OnlyContains(arguments, "opacity", "color"))
     image.Tint((String)arguments["opacity"], (MagickColor)arguments["color"]);
   else
     throw new ArgumentException("Invalid argument combination for 'tint', allowed combinations are: [opacity] [opacity, color]");
 }
    public void Test_Tint()
    {
      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        image.Settings.FillColor = MagickColors.Gold;
        image.Tint("1x2");
        image.Clamp();

        ColorAssert.AreEqual(new MagickColor("#dee500000000"), image, 400, 205);
        ColorAssert.AreEqual(MagickColors.Black, image, 400, 380);
      }
    }