The operation you describe can be expressed as linear convolution followed by zeroing out the spots that were zero before:
>>> import numpy as np
>>> from scipy import signal
>>>
>>> kernel = np.array([[0,1,0], [8,1,2], [0,4,0]])[::-1, ::-1]
>>>
>>> pattern = np.random.randint(0, 2, (10, 10))
>>>
>>> pattern
array([[0, 1, 1, 1, 1, 1, 1, 0, 1, 1],
[1, 0, 1, 0, 1, 0, 0, 0, 0, 0],
[0, 1, 0, 1, 1, 1, 0, 1, 0, 1],
[1, 0, 1, 0, 0, 1, 1, 0, 0, 0],
[0, 1, 0, 1, 1, 1, 1, 1, 1, 1],
[0, 1, 0, 0, 0, 1, 0, 1, 1, 0],
[0, 0, 0, 1, 1, 0, 1, 0, 1, 0],
[0, 1, 0, 0, 0, 0, 1, 0, 1, 0],
[0, 1, 1, 1, 0, 1, 0, 1, 1, 0],
[0, 1, 0, 1, 1, 1, 0, 1, 0, 0]])
>>>
>>> pattern * signal.convolve(pattern, kernel, 'same')
array([[ 0, 3, 15, 11, 15, 11, 9, 0, 3, 9],
[ 1, 0, 2, 0, 6, 0, 0, 0, 0, 0],
[ 0, 1, 0, 3, 12, 13, 0, 1, 0, 1],
[ 1, 0, 1, 0, 0, 8, 13, 0, 0, 0],
[ 0, 5, 0, 3, 11, 16, 12, 15, 15, 9],
[ 0, 2, 0, 0, 0, 2, 0, 4, 14, 0],
[ 0, 0, 0, 3, 9, 0, 5, 0, 6, 0],
[ 0, 5, 0, 0, 0, 0, 2, 0, 6, 0],
[ 0, 8, 11, 13, 0, 5, 0, 7, 10, 0],
[ 0, 2, 0, 4, 11, 10, 0, 2, 0, 0]])