本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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());
}
}
示例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);
}
}