本文整理汇总了C#中MagickImage.GetWritablePixels方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.GetWritablePixels方法的具体用法?C# MagickImage.GetWritablePixels怎么用?C# MagickImage.GetWritablePixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagickImage
的用法示例。
在下文中一共展示了MagickImage.GetWritablePixels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Set
public void Test_Set()
{
using (MagickImage image = new MagickImage(Color.Red, 5, 10))
{
using (WritablePixelCollection pixels = image.GetWritablePixels())
{
ExceptionAssert.Throws<ArgumentNullException>(delegate()
{
pixels.Set((QuantumType[])null);
});
ExceptionAssert.Throws<ArgumentNullException>(delegate()
{
pixels.Set((Pixel)null);
});
ExceptionAssert.Throws<ArgumentNullException>(delegate()
{
pixels.Set((Pixel[])null);
});
Test_Set(pixels, new QuantumType[] { });
Test_Set(pixels, new QuantumType[] { 0 });
Test_Set(pixels, new QuantumType[] { 0, 0 });
Test_Set(pixels, new QuantumType[] { 0, 0, 0 });
pixels.Set(new QuantumType[] { 0, 0, 0, 0, 0 });
Test_PixelColor(pixels, Color.Black);
pixels.Write();
}
using (PixelCollection pixels = image.GetReadOnlyPixels())
{
Test_PixelColor(pixels, Color.Black);
}
using (WritablePixelCollection pixels = image.GetWritablePixels())
{
pixels.Set(new uint[] { 4294967295, 0, 0, 0, 0 });
Test_PixelColor(pixels, Color.Red);
pixels.Set(new ushort[] { 0, 0, 65535, 0, 0 });
Test_PixelColor(pixels, Color.Blue);
pixels.Set(new byte[] { 0, 255, 0, 0, 0 });
Test_PixelColor(pixels, Color.Lime);
}
using (WritablePixelCollection pixels = image.GetWritablePixels())
{
for (int x = 0; x < pixels.Width; x++)
{
for (int y = 0; y < pixels.Height; y++)
{
pixels.Set(x, y, new QuantumType[] { 0, 0, 0, 0, 0 });
}
}
}
}
}
示例2: Test_GetValue
public void Test_GetValue()
{
using (MagickImage image = new MagickImage(Color.Red, 5, 10))
{
using (WritablePixelCollection pixels = image.GetWritablePixels())
{
Test_PixelColor(pixels, Color.Red);
}
}
}
示例3: Test_Dimensions
public void Test_Dimensions()
{
using (MagickImage image = new MagickImage(Color.Red, 5, 10))
{
using (WritablePixelCollection pixels = image.GetWritablePixels())
{
Assert.AreEqual(5, pixels.Width);
Assert.AreEqual(10, pixels.Height);
Assert.AreEqual(5 * 10 * 5, pixels.GetValues().Length);
}
}
}