public ArrayGrid <T> ExtractBlock(Rectangle block) { float top = (float)block.Top; float left = (float)block.Left; float right = (float)block.Right; float bottom = (float)block.Bottom; top = Math.Max(0, top); left = Math.Max(0, left); right = Math.Min((int)Size.X, right); bottom = Math.Min((int)Size.Y, bottom); var ret = new ArrayGrid <T>(new Vector2(right - left, bottom - top)); foreach (var cell in ret.Points) { var src = GetFromPoint(cell.Translate(left, top)); ret.Set(cell, src); } return(ret); }
public void Set(T value) { Grid.Set(Position, value); }