The Source Cod

Lavatron starts by initializing data; which includes loading.the source image and creating the column of bulb images. The last stage of the initialization is painting the offscreen (double buffer) image full of dimmed (black) lightbulbs to start thedisplay with a clean image. Subsequent painting of the offscrecn image begins by using copyAreaf ) to move the existing portion of the image to the left by the width of the column of bulbs about to be added on the right edge. Then the pixel values for the next· column are read and used as the color to fill a column of 8′<8 rectangles at the right edge of the applet. The transparent column of bulbs is painted, and then the wholebacking image ic drawn to the screen. Since this applet doesn’t have to do much except scroll the image, it avoids the normal repaint( ) loop by forking a thread that repeatedly calls paintf ), pausing only to call yield( ) to follow other threads to run.

[vfb id=1]

Share This