Alpha Numbers - Introduction
I made a new version of the applet that shows a girl in a green swimsuit riding some numbers. To view this applet, follow this (local) link:
If you want to enjoy this offline, you may also download a zip archive with all the relevant files:
This applet opens a control frame that allows the user to set some parameters. The following list explains those parameters. By hiting the “hints”-button, you also can get a (short) list of which parameter has which effect.
After changing one or more parameters, you have to hit the “update”-button to force the applet to update the parameters.
Now, as promised, some words about alpha. If you put an image A on an image B, A can be opaque, that means, you see A, and B is hidden. Or A is transparent, that means, you see B, and A is invisible. Or A is partly opaque, partly transparent: some parts opaque, some parts transparent. This is the case with many GIF-images, it allows to use images that seems to be non-rectangular. But A can also be translucent, partly transparent, partly opaque. That means, you can see B through A. If different parts of A have to be differently transparent, you need an additional channel besides the usual red, green and blue channel: an alpha channel. An alpha value can be 0 (full transparency) or 1 resp. 255 (perfectly opacue) or 0.5 resp 128 (half way transparent). A PNG-image, for example, has a full alpha channel (but this is, so far, only supported by Netscape 6 and the Internet Explorer for the Mac). Java also has a full alpha channel for its images. But if you paste an image A with different alpha values on an image B, with present Virtual Machines, something unpleasent happen. Let us consider an example: A blue square which becomes more and more transparent towards the bottom edge, displayed on a checkerboard structure:
On the right, you see what you would expect: the tiny black and white squares becomes more and more blue. On the left, you see what most Virtual Machines display. Let us take a closer look and enlarge the image:
Most Virtual Machine (except Opera) do not really mix images A and B: they just turn some of A’s pixel on and some off, simulating a full alpha channel like a (bitwise transparent) GIF-image.
Depending on context, this is perfectly sufficient. But as you can see, on other occasions, the result is very unsatisfying. Therefor, my applet use its own private paste method to render alpha channels correct. But unfortunatly, my method relies on Java’s pixelGrabber()-method. Which is buggy in Netscape Navigator 4: it turns blue background pixels to white, red and green pixels to black. Therefor, my applet also supports the standard method. If you are interested in the source code, here it is:
Return to main pages:
complete update 27.5.2001