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


C# MagickImage.Dispose方法代码示例

本文整理汇总了C#中MagickImage.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.Dispose方法的具体用法?C# MagickImage.Dispose怎么用?C# MagickImage.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MagickImage的用法示例。


在下文中一共展示了MagickImage.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_Clone

		//===========================================================================================
		private static void Test_Clone(MagickImage first, MagickImage second)
		{
			Assert.AreEqual(first, second);
			second.Format = MagickFormat.Jp2;
			Assert.AreEqual(first.Format, MagickFormat.Png);
			Assert.AreEqual(second.Format, MagickFormat.Jp2);
			second.Dispose();
			Assert.AreEqual(first.Format, MagickFormat.Png);
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:10,代码来源:MagickImageTests.cs

示例2: Test_Read

		public void Test_Read()
		{
			MagickImage image = new MagickImage();

			ExceptionAssert.Throws<ArgumentException>(delegate()
			{
				image.Read(new byte[0]);
			});

			ExceptionAssert.Throws<ArgumentNullException>(delegate()
			{
				image.Read((byte[])null);
			});

			ExceptionAssert.Throws<ArgumentNullException>(delegate()
			{
				image.Read((Bitmap)null);
			});

			ExceptionAssert.Throws<ArgumentNullException>(delegate()
			{
				image.Read((Stream)null);
			});

			ExceptionAssert.Throws<ArgumentNullException>(delegate()
			{
				image.Read((string)null);
			});

			ExceptionAssert.Throws<ArgumentException>(delegate()
			{
				image.Read(Files.Missing);
			});

			ExceptionAssert.Throws<ArgumentException>(delegate()
			{
				image.Read("png:" + Files.Missing);
			});

			image.Read(File.ReadAllBytes(Files.SnakewarePNG));

			using (Bitmap bitmap = new Bitmap(Files.SnakewarePNG))
			{
				image.Read(bitmap);
				Assert.AreEqual(MagickFormat.Png, image.Format);
			}

			using (Bitmap bitmap = new Bitmap(100, 100, PixelFormat.Format24bppRgb))
			{
				image.Read(bitmap);
				Assert.AreEqual(MagickFormat.Bmp, image.Format);
			}

			using (FileStream fs = File.OpenRead(Files.SnakewarePNG))
			{
				image.Read(fs);
			}

			image.Read(Files.SnakewarePNG);

			image.Read("rose:");

			image.Read(Files.RoseSparkleGIF);
			Assert.AreEqual("RoseSparkle.gif", Path.GetFileName(image.FileName));

			image.Read("png:" + Files.SnakewarePNG);
			MagickColor red = new MagickColor("red");

			image.Read(red, 50, 50);
			Assert.AreEqual(50, image.Width);
			Assert.AreEqual(50, image.Height);
			Test_Pixel(image, 10, 10, red);

			image.Read("xc:red", 50, 50);
			Assert.AreEqual(50, image.Width);
			Assert.AreEqual(50, image.Height);
			Test_Pixel(image, 5, 5, red);

			image.Dispose();

			ExceptionAssert.Throws<ObjectDisposedException>(delegate()
				{
					image.Read("logo:");
				});
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:85,代码来源:MagickImageTests.cs

示例3: Test_IComparable

		public void Test_IComparable()
		{
			MagickImage first = new MagickImage(Color.Red, 10, 5);

			Assert.AreEqual(0, first.CompareTo(first));
			Assert.AreEqual(1, first.CompareTo(null));
			Assert.IsFalse(first < null);
			Assert.IsFalse(first <= null);
			Assert.IsTrue(first > null);
			Assert.IsTrue(first >= null);
			Assert.IsTrue(null < first);
			Assert.IsTrue(null <= first);
			Assert.IsFalse(null > first);
			Assert.IsFalse(null >= first);

			MagickImage second = new MagickImage(Color.Green, 5, 5);

			Assert.AreEqual(1, first.CompareTo(second));
			Assert.IsFalse(first < second);
			Assert.IsFalse(first <= second);
			Assert.IsTrue(first > second);
			Assert.IsTrue(first >= second);

			second = new MagickImage(Color.Red, 5, 10);

			Assert.AreEqual(0, first.CompareTo(second));
			Assert.IsFalse(first == second);
			Assert.IsFalse(first < second);
			Assert.IsTrue(first <= second);
			Assert.IsFalse(first > second);
			Assert.IsTrue(first >= second);

			first.Dispose();
			second.Dispose();
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:35,代码来源:MagickImageTests.cs

示例4: Test_IEquatable

		public void Test_IEquatable()
		{
			MagickImage first = new MagickImage(Color.Red, 10, 10);

			Assert.IsFalse(first == null);
			Assert.IsFalse(first.Equals(null));
			Assert.IsTrue(first.Equals(first));
			Assert.IsTrue(first.Equals((object)first));

			MagickImage second = new MagickImage(Color.Red, 10, 10);

			Assert.IsTrue(first == second);
			Assert.IsTrue(first.Equals(second));
			Assert.IsTrue(first.Equals((object)second));

			second = new MagickImage(Color.Green, 10, 10);

			Assert.IsTrue(first != second);
			Assert.IsFalse(first.Equals(second));

			first.Dispose();
			second.Dispose();

			first = null;
			Assert.IsTrue(first == null);
			Assert.IsFalse(first != null);
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:27,代码来源:MagickImageTests.cs

示例5: Test_Dispose

		public void Test_Dispose()
		{
			MagickImage image = new MagickImage();
			image.Dispose();
			image.Verbose = true;
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:6,代码来源:MagickImageTests.cs


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