本文整理汇总了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);
}
示例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:");
});
}
示例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();
}
示例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);
}
示例5: Test_Dispose
public void Test_Dispose()
{
MagickImage image = new MagickImage();
image.Dispose();
image.Verbose = true;
}