本文整理汇总了C#中System.Image.View方法的典型用法代码示例。如果您正苦于以下问题:C# Image.View方法的具体用法?C# Image.View怎么用?C# Image.View使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Image
的用法示例。
在下文中一共展示了Image.View方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImageView_IsSolid
public void ImageView_IsSolid()
{
Image i = new Image(256, 256);
ImageView iv = i.View(0, 0, 256, 256);
Assert.IsTrue(iv.IsSolid());
i.SetPixel(0, 0, new Color("red"));
iv = i.View(0, 0, 256, 256);
Assert.IsFalse(iv.IsSolid());
}
示例2: ImageView_Init
public void ImageView_Init()
{
Map m = new Map(256, 256);
Image i = new Image(256, 256);
ImageView iv = i.View(0, 0, 256, 256);
Assert.IsTrue(iv.IsSolid());
Color pixel = iv.GetPixel(0, 0);
Assert.AreEqual(pixel.ToString(), "rgba(0,0,0,0.0)");
m.Background = new Color(255, 255, 255);
m.Render(i);
iv = i.View(0, 0, 256, 256);
Assert.IsTrue(iv.IsSolid());
pixel = iv.GetPixel(0, 0);
Assert.AreEqual(pixel.ToString(), "rgb(255,255,255)");
}
示例3: ImageView_Encode
public void ImageView_Encode()
{
Map m = new Map(100, 100);
Image i = new Image(100, 100);
m.Background = new Color("green");
m.Render(i);
ImageView iv = i.View(0, 0, 10, 10);
byte[] bytes1 = iv.Encode("png");
byte[] bytes2 = File.ReadAllBytes(@".\data\10x10green.png");
CollectionAssert.AreEqual(bytes1, bytes2);
}
示例4: ImageView_Save
public void ImageView_Save()
{
Map m = new Map(100, 100);
Image i = new Image(100, 100);
m.Background = new Color("green");
m.Render(i);
ImageView iv = i.View(0,0,10,10);
string filename = @".\data\tmp\" + Guid.NewGuid().ToString() + ".png";
iv.Save(filename);
byte[] bytes1 = File.ReadAllBytes(filename);
byte[] bytes2 = File.ReadAllBytes(@".\data\10x10green.png");
CollectionAssert.AreEqual(bytes1, bytes2);
}