当前位置: 首页>>代码示例>>C#>>正文


C# MagickImage.Clamp方法代码示例

本文整理汇总了C#中ImageMagick.MagickImage.Clamp方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Clamp方法的具体用法?C# MagickImage.Clamp怎么用?C# MagickImage.Clamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageMagick.MagickImage的用法示例。


在下文中一共展示了MagickImage.Clamp方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_BrightnessContrast

 public void Test_BrightnessContrast()
 {
   using (MagickImage image = new MagickImage(Files.Builtin.Wizard))
   {
     ColorAssert.AreNotEqual(MagickColors.White, image, 340, 295);
     image.BrightnessContrast(new Percentage(50), new Percentage(50));
     image.Clamp();
     ColorAssert.AreEqual(MagickColors.White, image, 340, 295);
   }
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:10,代码来源:MagickImageTests.cs

示例2: ExecuteClamp

 private void ExecuteClamp(XmlElement element, MagickImage image)
 {
   Hashtable arguments = new Hashtable();
   foreach (XmlAttribute attribute in element.Attributes)
   {
     arguments[attribute.Name] = Variables.GetValue<Channels>(attribute);
   }
   if (arguments.Count == 0)
     image.Clamp();
   else if (OnlyContains(arguments, "channels"))
     image.Clamp((Channels)arguments["channels"]);
   else
     throw new ArgumentException("Invalid argument combination for 'clamp', allowed combinations are: [] [channels]");
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:14,代码来源:MagickImage.cs

示例3: Test_Tint

    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);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:12,代码来源:MagickImageTests.cs

示例4: Test_BlueShift

    public void Test_BlueShift()
    {
      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        ColorAssert.AreNotEqual(MagickColors.White, image, 180, 80);

        image.BlueShift(2);

#if Q16HDRI
        ColorAssert.AreNotEqual(MagickColors.White, image, 180, 80);
        image.Clamp();
#endif

        ColorAssert.AreEqual(MagickColors.White, image, 180, 80);

#if Q8 || Q16
        ColorAssert.AreEqual(new MagickColor("#ac2cb333c848"), image, 350, 265);
#elif Q16HDRI
        ColorAssert.AreEqual(new MagickColor("#ac2cb333c848"), image, 350, 265);
#else
#error Not implemented!
#endif
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:24,代码来源:MagickImageTests.cs

示例5: Test_Sharpen

    public void Test_Sharpen()
    {
      using (MagickImage image = new MagickImage(Files.NoisePNG))
      {
        image.Sharpen(10, 20);
        image.Clamp();

        using (MagickImage original = new MagickImage(Files.NoisePNG))
        {
          Assert.AreEqual(0.06675, image.Compare(original, ErrorMetric.RootMeanSquared), 0.00001);
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:13,代码来源:MagickImageTests.cs

示例6: Test_Polaroid

    public void Test_Polaroid()
    {
      using (MagickImage image = new MagickImage(Files.MagickNETIconPNG))
      {
        image.BorderColor = MagickColors.Red;
        image.BackgroundColor = MagickColors.Fuchsia;
        image.Settings.FontPointsize = 20;
        image.Polaroid("Magick.NET", 10, PixelInterpolateMethod.Bilinear);
        image.Clamp();

        ColorAssert.AreEqual(MagickColors.Black, image, 103, 162);
        ColorAssert.AreEqual(MagickColors.Red, image, 99, 97);
#if Q8
        ColorAssert.AreEqual(new MagickColor("#ff00ffbc"), image, 146, 194);
#elif Q16 || Q16HDRI
        ColorAssert.AreEqual(new MagickColor("#ffff0000ffffbbe5"), image, 146, 194);
#else
#error Not implemented!
#endif
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:21,代码来源:MagickImageTests.cs

示例7: Test_LocalContrast

    public void Test_LocalContrast()
    {
      using (MagickImage image = new MagickImage(Files.NoisePNG))
      {
        image.LocalContrast(5.0, (Percentage)75);
        image.Clamp();

        ColorAssert.AreEqual(MagickColors.Black, image, 81, 28);
        ColorAssert.AreEqual(MagickColors.Black, image, 245, 181);
        ColorAssert.AreEqual(MagickColors.White, image, 200, 135);
        ColorAssert.AreEqual(MagickColors.White, image, 200, 135);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:13,代码来源:MagickImageTests.cs

示例8: Test_Edge

    public void Test_Edge()
    {
      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        ColorAssert.AreNotEqual(MagickColors.Black, image, 400, 295);
        ColorAssert.AreNotEqual(MagickColors.Blue, image, 455, 126);

        image.Edge(2);
        image.Clamp();

        ColorAssert.AreEqual(MagickColors.Black, image, 400, 295);
        ColorAssert.AreEqual(MagickColors.Blue, image, 455, 126);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:14,代码来源:MagickImageTests.cs

示例9: Test_Distort

    public void Test_Distort()
    {
      using (MagickImage image = new MagickImage(Files.MagickNETIconPNG))
      {
        ExceptionAssert.Throws<ArgumentNullException>(delegate ()
        {
          image.Distort(DistortMethod.Perspective, null);
        });

        ExceptionAssert.Throws<ArgumentException>(delegate ()
        {
          image.Distort(DistortMethod.Perspective, new double[] { });
        });

        image.BackgroundColor = MagickColors.Cornsilk;
        image.VirtualPixelMethod = VirtualPixelMethod.Background;
        image.Distort(DistortMethod.Perspective, new double[] { 0, 0, 0, 0, 0, 90, 0, 90, 90, 0, 90, 25, 90, 90, 90, 65 });
        image.Clamp();

        ColorAssert.AreEqual(new MagickColor("#0000"), image, 1, 64);
        ColorAssert.AreEqual(MagickColors.Cornsilk, image, 104, 50);
        ColorAssert.AreEqual(new MagickColor("#aa67e157f9da"), image, 66, 62);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:24,代码来源:MagickImageTests.cs


注:本文中的ImageMagick.MagickImage.Clamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。