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


C# MagickImage.Separate方法代码示例

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


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

示例1: Test_Combine

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

示例2: Test_Combine

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

示例3: Test_Separate_Composite

    public void Test_Separate_Composite()
    {
      using (MagickImage logo = new MagickImage(Files.Builtin.Logo))
      {
        using (MagickImage blue = logo.Separate(Channels.Blue).First())
        {
          Test_Separate_Composite(blue, ColorSpace.Gray, 146);

          using (MagickImage green = logo.Separate(Channels.Green).First())
          {
            Test_Separate_Composite(green, ColorSpace.Gray, 62);

            blue.Composite(green, CompositeOperator.Multiply);

            Test_Separate_Composite(blue, ColorSpace.sRGB, 35);
          }
        }
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:19,代码来源:MagickImageTests.cs

示例4: Test_Channels

    public void Test_Channels()
    {
      PixelChannel[] rgb = new PixelChannel[]
      {
        PixelChannel.Red, PixelChannel.Green, PixelChannel.Blue
      };

      PixelChannel[] rgba = new PixelChannel[]
      {
        PixelChannel.Red, PixelChannel.Green, PixelChannel.Blue, PixelChannel.Alpha
      };

      PixelChannel[] gray = new PixelChannel[]
      {
        PixelChannel.Gray
      };

      PixelChannel[] grayAlpha = new PixelChannel[]
      {
        PixelChannel.Gray, PixelChannel.Alpha
      };

      PixelChannel[] cmyk = new PixelChannel[]
      {
        PixelChannel.Cyan, PixelChannel.Magenta, PixelChannel.Yellow, PixelChannel.Black
      };

      PixelChannel[] cmyka = new PixelChannel[]
      {
        PixelChannel.Cyan, PixelChannel.Magenta, PixelChannel.Yellow, PixelChannel.Black, PixelChannel.Alpha
      };

      using (MagickImage image = new MagickImage(Files.RoseSparkleGIF))
      {
        CollectionAssert.AreEqual(rgba, image.Channels.ToArray());

        image.Alpha(AlphaOption.Off);

        CollectionAssert.AreEqual(rgb, image.Channels.ToArray());
      }

      using (MagickImage image = new MagickImage(Files.SnakewarePNG))
      {
        CollectionAssert.AreEqual(grayAlpha, image.Channels.ToArray());

        using (MagickImage redChannel = image.Separate(Channels.Red).First())
        {
          CollectionAssert.AreEqual(gray, redChannel.Channels.ToArray());

          redChannel.Alpha(AlphaOption.On);

          CollectionAssert.AreEqual(grayAlpha, redChannel.Channels.ToArray());
        }
      }

      using (MagickImage image = new MagickImage(Files.SnakewarePNG))
      {
        image.ColorSpace = ColorSpace.CMYK;

        CollectionAssert.AreEqual(cmyka, image.Channels.ToArray());

        image.Alpha(AlphaOption.Off);

        CollectionAssert.AreEqual(cmyk, image.Channels.ToArray());
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:66,代码来源:MagickImageTests.cs

示例5: Test_Separate

    public void Test_Separate()
    {
      using (MagickImage rose = new MagickImage(Files.Builtin.Rose))
      {
        int i = 0;
        foreach (MagickImage image in rose.Separate())
        {
          i++;
          image.Dispose();
        }

        Assert.AreEqual(3, i);

        i = 0;
        foreach (MagickImage image in rose.Separate(Channels.Red | Channels.Green))
        {
          i++;
          image.Dispose();
        }

        Assert.AreEqual(2, i);
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:23,代码来源:MagickImageTests.cs


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