Randomly thinking about something I worked on 10 years ago, going to give it for advice for anyone who's manually #programming a #GameEngine #Sprite based #graphics from scratch...
The most efficient way to draw sprites to a layer is to run-length index them with a colorkey, meaning you have one byte for how many #pixels you're drawing, and one byte referencing the color in that sprite's palette. (#gif does this) You do this with an array of 255 32-bit ints, one per color, and by drawing the sprite in a triple for-loop: i for each line, j for each run, and k each pixel run.
The run value of zero represents the end of a line, and is handled by skipping to the next number in the i loop. The color key of 255 is transparent, and is implemented by simply skipping forward by the run length in the j loop. Otherwise, the k loop memcopies whatever value in your color map array corresponds to the index of the color key directly to the buffer.
(cntd)
#programming #gameengine #sprite #graphics #Pixels #GIF #graphicsprogramming #pixelart
What happens if we allow the color component to #diffuse out of the #MonaLisa?
In this experiment, the #pixels of the Mona Lisa supply us with initial #RGB color component values, ranging from 0 to 255 (256 possible states for each component, for each pixel, at time t = 0).
We then allow the red color component to diffuse out, according to the #HeatEquation, ∆u = ∂u/∂t; we step forward in time, solving for all color component values u, at each spatial location (x, y) in the painting 🖼 (along the edges of the painting, color components are held constant, so that we have a well-defined boundary value problem).
We can see here what happens to the image as the red component diffuses out.
Enjoy!
#diffuse #monalisa #Pixels #RGB #heatequation