本文整理汇总了C#中System.Image.Width方法的典型用法代码示例。如果您正苦于以下问题:C# Image.Width方法的具体用法?C# Image.Width怎么用?C# Image.Width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Image
的用法示例。
在下文中一共展示了Image.Width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Image_Init
public void Image_Init()
{
Image i = new Image(256, 256);
Assert.AreEqual(i.Width(), 256);
Assert.AreEqual(i.Height(), 256);
Assert.IsFalse(i.Painted());
}
示例2: Image_Compare
public void Image_Compare()
{
Map m1 = new Map(256, 256);
Map m2 = new Map(256, 256);
Image i1 = new Image(256, 256);
Image i2 = new Image(256, 256);
Assert.AreEqual(i1.Compare(i2), 0);
i1.SetPixel(0, 0, new Color("white"));
Assert.AreEqual(i1.Compare(i2), 1);
m1.Background = new Color("black");
m1.Render(i1);
Assert.AreEqual(i1.Width() * i1.Height(), i1.Compare(i2));
//test options
m1.Background= new Color(100, 100, 100, 255);
m1.Render(i1);
i2 = new Image(256, 256);
m2.Background = new Color(100,100,100,100);
m2.Render(i2);
Dictionary<string, object> options;
options = new Dictionary<string, object> { { "Alpha", false } };
Assert.AreEqual(i1.Compare(i2, options), 0);
m1.Background = new Color(255, 255, 255);
m1.Render(i1);
m2.Background = new Color(255, 255, 255);
m2.Render(i2);
i2.SetPixel(0, 0, new Color(250, 250, 250));
options = new Dictionary<string, object> { { "Threshold", 5 } };
Assert.AreEqual(i1.Compare(i2, options), 0);
}