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


C# MagickImage.GetWritablePixels方法代码示例

本文整理汇总了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 });
						}
					}
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:58,代码来源:WritablePixelCollectionTests.cs

示例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);
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:10,代码来源:WritablePixelCollectionTests.cs

示例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);
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:12,代码来源:WritablePixelCollectionTests.cs


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