private string UpdateRegionRequestParam(PageTileInfo tile, string oldRegion, int width, int height) { if (oldRegion == "full") return "full"; int x, y, h, w; GetDimsInPx(oldRegion, width, height, out x, out y, out w, out h); //if we have exact region in tile if (tile.Heigth == h && tile.Width == w && tile.XOffset == x && tile.YOffset == y) { return "full"; } //old w and h remains, but x and y are going to get new values return (x - tile.XOffset) + "," + (y - tile.YOffset) + "," + w + "," + h; }
private bool RegionFitsInTile(PageTileInfo pageTile, string region, int width, int height) { int x, y, h, w; GetDimsInPx(region, width, height, out x, out y, out w, out h); return (x >= pageTile.XOffset && x < pageTile.XOffset + pageTile.Width && y >= pageTile.YOffset && y < pageTile.YOffset + pageTile.Heigth && x+w <= pageTile.XOffset + pageTile.Width && y + h <= pageTile.YOffset + pageTile.Heigth); }