Example #1
0
		private bool InteriorFits(Region interior, Region top, Region bottom, Region left,
			Region right, IBoundingBox topleft, IBoundingBox bottomleft, IBoundingBox topright, IBoundingBox bottomright)
		{

			if (interior == null)
				return true;

			if (interior.Bitmap.Width == 1 && interior.Bitmap.Height == 1 && interior.MatchStrategy.Equals("horizontal"))
				return true;

			if (interior.MatchStrategy.Equals("horizontal"))
				return interior.Bitmap.Height == bottomleft.Top + bottomleft.Height - topleft.Top - top.Bitmap.Height - bottom.Bitmap.Height;

			if (interior.MatchStrategy.Equals("vertical"))
				return interior.Bitmap.Width == topright.Left + topright.Width - topleft.Left - left.Bitmap.Width - right.Bitmap.Width;

			return false;
		}
		private static Dictionary<string, Region> GetRegions(JArray regionsJson){
			Dictionary<string, Region> regions = new Dictionary<string, Region>();
			foreach(JObject robj in regionsJson){


				string name = robj["name"].Value<string>();
				string strategy = robj["matchstrategy"].Value<string>();
				Bitmap pixels =  BitmapFromJson(robj);

				Region region = new Region(strategy, pixels);

				regions.Add(name, region);
			}

			return regions;
		}