本文整理汇总了C#中ImageMagick.MagickImage.Opaque方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Opaque方法的具体用法?C# MagickImage.Opaque怎么用?C# MagickImage.Opaque使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.Opaque方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteOpaque
private void ExecuteOpaque(XmlElement element, MagickImage image)
{
MagickColor target_ = Variables.GetValue<MagickColor>(element, "target");
MagickColor fill_ = Variables.GetValue<MagickColor>(element, "fill");
image.Opaque(target_, fill_);
}
示例2: Test_Opaque
public void Test_Opaque()
{
using (MagickImage image = new MagickImage(Color.Red, 10, 10))
{
Test_Pixel_Equal(image, 0, 0, Color.Red);
image.Opaque(Color.Red, Color.Yellow);
Test_Pixel_Equal(image, 0, 0, Color.Yellow);
image.InverseOpaque(Color.Yellow, Color.Red);
Test_Pixel_Equal(image, 0, 0, Color.Yellow);
image.InverseOpaque(Color.Red, Color.Red);
Test_Pixel_Equal(image, 0, 0, Color.Red);
}
}
示例3: Test_IsOpaque
public void Test_IsOpaque()
{
using (MagickImage image = new MagickImage(Files.MagickNETIconPNG))
{
Assert.IsFalse(image.IsOpaque);
image.ColorAlpha(Color.Purple);
Assert.IsTrue(image.IsOpaque);
}
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
Assert.IsTrue(image.IsOpaque);
image.Opaque(Color.White, MagickColor.Transparent);
Assert.IsFalse(image.IsOpaque);
}
}
示例4: Test_Compare
public void Test_Compare()
{
MagickImage first = new MagickImage(Files.ImageMagickJPG);
ExceptionAssert.Throws<ArgumentNullException>(delegate ()
{
first.Compare(null);
});
MagickImage second = first.Clone();
MagickErrorInfo same = first.Compare(second);
Assert.IsNotNull(same);
Assert.AreEqual(0, same.MeanErrorPerPixel);
double distortion = first.Compare(second, ErrorMetric.Absolute);
Assert.AreEqual(0, distortion);
first.Threshold(new Percentage(50));
MagickErrorInfo different = first.Compare(second);
Assert.IsNotNull(different);
Assert.AreNotEqual(0, different.MeanErrorPerPixel);
distortion = first.Compare(second, ErrorMetric.Absolute);
Assert.AreNotEqual(0, distortion);
MagickImage difference = new MagickImage();
distortion = first.Compare(second, ErrorMetric.RootMeanSquared, difference);
Assert.AreNotEqual(0, distortion);
Assert.AreNotEqual(first, difference);
Assert.AreNotEqual(second, difference);
second.Dispose();
first.Opaque(MagickColors.Black, MagickColors.Green);
first.Opaque(MagickColors.White, MagickColors.Green);
second = first.Clone();
second.FloodFill(MagickColors.Gray, 0, 0);
distortion = first.Compare(second, ErrorMetric.Absolute, Channels.Green);
Assert.AreEqual(0, distortion);
distortion = first.Compare(second, ErrorMetric.Absolute, Channels.Red);
Assert.AreNotEqual(0, distortion);
}
示例5: Test_Tile
public void Test_Tile()
{
using (MagickImage image = new MagickImage(Files.Builtin.Logo))
{
using (MagickImage checkerboard = new MagickImage(Files.Patterns.Checkerboard))
{
image.Opaque(MagickColors.White, MagickColors.Transparent);
image.Tile(checkerboard, CompositeOperator.DstOver);
ColorAssert.AreEqual(new MagickColor("#66"), image, 578, 260);
}
}
}
示例6: Test_Opaque
public void Test_Opaque()
{
using (MagickImage image = new MagickImage(MagickColors.Red, 10, 10))
{
ColorAssert.AreEqual(MagickColors.Red, image, 0, 0);
image.Opaque(MagickColors.Red, MagickColors.Yellow);
ColorAssert.AreEqual(MagickColors.Yellow, image, 0, 0);
image.InverseOpaque(MagickColors.Yellow, MagickColors.Red);
ColorAssert.AreEqual(MagickColors.Yellow, image, 0, 0);
image.InverseOpaque(MagickColors.Red, MagickColors.Red);
ColorAssert.AreEqual(MagickColors.Red, image, 0, 0);
}
}