Raccoon at TechHub :mastodon: · @Raccoon
115 followers · 916 posts · Server techhub.social

Randomly thinking about something I worked on 10 years ago, going to give it for advice for anyone who's manually a based 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 you're drawing, and one byte referencing the color in that sprite's palette. ( 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

Last updated 1 year ago

Chris Fredregill · @skillmill
11 followers · 49 posts · Server techhub.social

What happens if we allow the color component to out of the ?

In this experiment, the of the Mona Lisa supply us with initial 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 , ∆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

Last updated 2 years ago