One way to do this is working with RGB matrices.
The product of RGB matrices, with float values between 0 and 1, is the subtractive sum of their colors.
import matplotlib.pyplot as plt
import numpy as np
x = np.ones((1000, 1000, 3)) # Big white square
y = np.ones((1000, 1000, 3)) # Another big white square of the same size as x
x[200: 600, 200: 600] = (1, 1, 0) # Smaller yellow square in x
y[400: 800, 400: 800] = (0, 1, 1) # Smaller cyan square in y
z = x * y # The product of RGB matrices is their subtractive sum
plt.imshow(z)
plt.show()
Example plot
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…