Say I have the following array/matrix in python (any language will do, to be honest).
 A = 

```
[0 0 0 0 0 0 0 0 0 0
 0 0 1 1 1 1 0 0 0 0
 0 1 1 1 1 1 0 0 0 0
 0 1 1 1 1 1 1 0 0 0
 0 0 1 1 1 1 1 1 0 0
 0 0 1 1 1 1 1 0 0 0
 0 0 1 1 1 1 1 0 0 0
 0 0 0 1 1 1 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0]

```

Is there any easy way to manipulate entries in this array as if they are pixels. Example, would there be any way to create an interior and a surface of arbitrary length, to get, for example:

```
[0 0 0 0 0 0 0 0 0 0
 0 0 1 1 1 1 0 0 0 0
 0 1 1 0 0 1 0 0 0 0
 0 1 1 0 0 0 1 0 0 0
 0 0 1 0 0 0 1 1 0 0
 0 0 1 0 0 0 1 0 0 0
 0 0 1 1 0 1 1 0 0 0
 0 0 0 1 1 1 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0]

```

Perhaps there is some way to recursively solve this, or maybe in a different way, which would rely on the entries around each element. Any thoughts?