本文整理汇总了C#中ImageMagick.MagickImageCollection.Ping方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImageCollection.Ping方法的具体用法?C# MagickImageCollection.Ping怎么用?C# MagickImageCollection.Ping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImageCollection
的用法示例。
在下文中一共展示了MagickImageCollection.Ping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_ReadSettings
public void Test_ReadSettings()
{
MagickReadSettings settings = new MagickReadSettings();
settings.FontFamily = "Courier New";
settings.FillColor = MagickColors.Gold;
settings.FontPointsize = 80;
settings.Format = MagickFormat.Text;
settings.TextGravity = Gravity.Center;
using (MagickImageCollection images = new MagickImageCollection(Files.ImageMagickTXT, settings))
{
Assert.AreEqual(2, images.Count);
ColorAssert.AreEqual(MagickColors.Gold, images[0], 348, 648);
}
using (MagickImageCollection images = new MagickImageCollection())
{
images.Ping(Files.ImageMagickTXT, settings);
Assert.AreEqual(2, images.Count);
ExceptionAssert.Throws<InvalidOperationException>(() =>
{
ColorAssert.AreEqual(MagickColors.Gold, images[0], 348, 648);
});
}
}
示例2: Test_Ping
public void Test_Ping()
{
MagickImageCollection collection = new MagickImageCollection();
ExceptionAssert.Throws<ArgumentException>(delegate ()
{
collection.Ping(new byte[0]);
});
ExceptionAssert.Throws<ArgumentNullException>(delegate ()
{
collection.Ping((byte[])null);
});
ExceptionAssert.Throws<ArgumentNullException>(delegate ()
{
collection.Ping((Stream)null);
});
ExceptionAssert.Throws<ArgumentNullException>(delegate ()
{
collection.Ping((string)null);
});
ExceptionAssert.Throws<ArgumentException>(delegate ()
{
collection.Ping(Files.Missing);
});
collection.Ping(Files.FujiFilmFinePixS1ProJPG);
Test_Ping(collection);
Assert.AreEqual(600, collection[0].Width);
Assert.AreEqual(400, collection[0].Height);
collection.Ping(new FileInfo(Files.FujiFilmFinePixS1ProJPG));
Test_Ping(collection);
Assert.AreEqual(600, collection[0].Width);
Assert.AreEqual(400, collection[0].Height);
collection.Ping(File.ReadAllBytes(Files.FujiFilmFinePixS1ProJPG));
Test_Ping(collection);
Assert.AreEqual(600, collection[0].Width);
Assert.AreEqual(400, collection[0].Height);
collection.Read(Files.SnakewarePNG);
Assert.AreEqual(286, collection[0].Width);
Assert.AreEqual(67, collection[0].Height);
using (PixelCollection pixels = collection[0].GetPixels())
{
Assert.AreEqual(38324, pixels.ToArray().Length);
}
collection.Dispose();
}