本文整理汇总了C#中Tile.AsQuantified方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.AsQuantified方法的具体用法?C# Tile.AsQuantified怎么用?C# Tile.AsQuantified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.AsQuantified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CoordinatesIn
public void CoordinatesIn()
{
Tile<TileTests.Item> t0 = new Tile<TileTests.Item>(new Area(0, 0, 100, 100), new TileTests.Item(0, 0, Color.Red));
t0.Fill(c => c.X > 25 && c.X < 75 && c.Y > 30 && c.Y < 60 ? new TileTests.Item(c.X, c.Y, c.X == c.Y ? Color.Yellow : Color.Green) : new TileTests.Item(c.X, c.Y, Color.Red));
IQuantifiedTile<TileTests.Item> q0 = t0.AsQuantified(10, 10);
string signature0 = q0.GetImage(1000, 1000, (z, s) =>
z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
foreach (ICoordinate c in q0.GetCoordinatesIn(250, 250, 600, 600))
{
t0.Find(c).Color = Color.Blue;
}
string signature1 = q0.GetImage(1000, 1000, (z, s) =>
z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
foreach (ICoordinate c in q0.GetCoordinatesIn(52, 52, 62, 62))
{
t0.Find(c).Color = Color.White;
}
string signature2 = q0.GetImage(1000, 1000, (z, s) =>
z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
foreach (ICoordinate c in q0.GetCoordinatesIn(12, 12, 13, 13))
{
t0.Find(c).Color = Color.Black;
}
string signature3 = q0.GetImage(1000, 1000, (z, s) =>
z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
}
示例2: Crop
public void Crop()
{
var t0 = new Tile<Item>(new Zone(0, 0, 100, 100), new Item(0, 0, Color.Red));
t0.Fill(
c =>
(c.X > 25) && (c.X < 75) && (c.Y > 30) && (c.Y < 60)
? new Item(c.X, c.Y, c.X == c.Y ? Color.Yellow : Color.Green)
: new Item(c.X, c.Y, Color.Red));
var q0 = t0.AsQuantified();
var c0 = t0.GetChecksum(i => i.Color.Name);
// var s0 = q0.GetImage(1000, 1000, (z, s) => z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
// Assert.AreEqual("BFE39DA3858C0A979B54F99442B397DA", s0, "Image hash");
Assert.AreEqual("0,0;100,100", t0.GetZone().ToString(), "Area");
var crop1 = t0.Take(new Zone(25, 30, 75, 60));
var t1 = new Tile<Item>(crop1);
//string signature1 = t1.AsQuantified().GetImage(1000, 1000, (z, s) =>
// z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
//Assert.AreEqual("742D809F5440028ED7F86072C4FC2FA9", signature1, "Image hash");
Assert.AreEqual("25,30;75,60", t1.GetZone().ToString(), "Area");
var crop2 = t0.TakeWhile(t => t.Color != Color.Yellow);
var t2 = new Tile<Item>(crop2);
//string signature2 = t2.AsQuantified().GetImage(1000, 1000, (z, s) =>
// z.ToBitmap(100, 50, z.X + "\n" + z.Y)).Item.GetSignature();
//Assert.AreEqual("6A226FC4E4EC36837BA5042FBFE8D923", signature2, "Image hash");
Assert.AreEqual("31,31;59,59", t2.GetZone().ToString(), "Area");
}