本文整理汇总了C#中Pixel.ToColor方法的典型用法代码示例。如果您正苦于以下问题:C# Pixel.ToColor方法的具体用法?C# Pixel.ToColor怎么用?C# Pixel.ToColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pixel
的用法示例。
在下文中一共展示了Pixel.ToColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AreNotEqual
public static void AreNotEqual(Pixel expected, Pixel actual)
{
Assert.IsNotNull(expected);
Assert.IsNotNull(actual);
AreNotEqual(expected.ToColor(), actual.ToColor());
}
示例2: Test_ToColor
public void Test_ToColor()
{
QuantumType half = (QuantumType)(Quantum.Max / 2.0);
#if Q16HDRI
int colorHalf = 128;
#else
int colorHalf = 127;
#endif
Pixel pixel = new Pixel(0, 0, 1);
pixel.Set(new QuantumType[] { Quantum.Max });
ColorAssert.AreEqual(Color.FromArgb(255, 255, 255), pixel.ToColor());
pixel = new Pixel(0, 0, 2);
pixel.Set(new QuantumType[] { Quantum.Max, 0 });
Assert.IsNull(pixel.ToColor());
pixel = new Pixel(0, 0, 3);
pixel.Set(new QuantumType[] { Quantum.Max, 0, half });
ColorAssert.AreEqual(Color.FromArgb(255, 0, colorHalf), pixel.ToColor());
pixel = new Pixel(0, 0, 4);
pixel.Set(new QuantumType[] { 0, half, Quantum.Max, Quantum.Max });
ColorAssert.AreEqual(Color.FromArgb(255, 0, colorHalf, 255), pixel.ToColor());
pixel = new Pixel(0, 0, 5);
pixel.Set(new QuantumType[] { Quantum.Max, 0, half, Quantum.Max, Quantum.Max });
Assert.IsNull(pixel.ToColor());
}
示例3: AreNotEqual
private static void AreNotEqual(MagickColor expected, Pixel actual)
{
AreNotEqual(expected, actual.ToColor());
}
示例4: Test_ToColor
public void Test_ToColor()
{
QuantumType half = (QuantumType)(Quantum.Max / 2.0);
Pixel pixel = new Pixel(0, 0, 1);
pixel.Set(new QuantumType[] { Quantum.Max });
ColorAssert.AreEqual(new MagickColor(Quantum.Max, Quantum.Max, Quantum.Max), pixel.ToColor());
pixel = new Pixel(0, 0, 2);
pixel.Set(new QuantumType[] { Quantum.Max, 0 });
ColorAssert.AreEqual(new MagickColor(Quantum.Max, Quantum.Max, Quantum.Max, 0), pixel.ToColor());
pixel = new Pixel(0, 0, 3);
pixel.Set(new QuantumType[] { Quantum.Max, 0, half });
ColorAssert.AreEqual(new MagickColor(Quantum.Max, 0, half), pixel.ToColor());
pixel = new Pixel(0, 0, 4);
pixel.Set(new QuantumType[] { 0, half, Quantum.Max, Quantum.Max });
ColorAssert.AreEqual(new MagickColor(0, half, Quantum.Max, Quantum.Max), pixel.ToColor());
pixel = new Pixel(0, 0, 5);
pixel.Set(new QuantumType[] { Quantum.Max, 0, half, Quantum.Max, Quantum.Max });
ColorAssert.AreEqual(new MagickColor(Quantum.Max, 0, half, Quantum.Max), pixel.ToColor());
}