Have an object that stores/renders a texture, store it and update/render it any way you want as longs as itās fast. Have an external method that allows modifying/getting of that data. How the values that are passed into the modifying function are generated shouldnāt matter. Just assume itās random data.
Yea, assume that itāll call the modify function on one or more random x/y pair to set it to a random color. The update and render functions will be called atleast 60 times per second. From your objects point of view, there is no way itāll be able to assume any patterns on the data coming in. The only thing it could reliably assume is that x/y will be in a valid range and color will be a valid color value (in whatever way you wish to store that data).
An example:
Create texture 800x600, set all pixels to black.
setPixel(100,200 red) is called.
The texture is updated(). Itās all black, except pixel x=100/y=200 is red.
texture is rendered() and displayed to the user
setPixel(200,100, blue) is called.
The texture is updated(). Itās all black, except pixel x=100/y=200 is red, pixel x=200/y=100 is blue
texture is rendered() and displayed to the user
setPixel(100,200 black)
setPixel(200,100, black)
The texture is updated(). Itās all black again.
texture is rendered() and displayed to the user.