当前位置: 首页>>代码示例>>C#>>正文


C# Tile.AsQuantified方法代码示例

本文整理汇总了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();
		}
开发者ID:tomgrv,项目名称:pa.toolbox,代码行数:34,代码来源:QuantifiedTests.cs

示例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");
        }
开发者ID:tomgrv,项目名称:PA.TileList,代码行数:37,代码来源:TileTests.cs


注:本文中的Tile.AsQuantified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。