Yeah, the pixeling effect was a really nice touch!
Thanks.
How did you do the SNES-like pixeling effect?
Toward the bottom of the source code (
http://www.meatfighter.com/j4k2007/pitfall/M.java), see this section:
1 2 3 4 5 6 7 8 9
| if (bluring > 0) { int bx = (int)(320*blur*blur); int by = (int)(240*blur*blur); imageGraphics.drawImage(image, 0, 0, bx, by, 0, 0, 320, 240, null); panelGraphics.drawImage(image, 0, 0, 640, 480, 0, 0, bx, by, null); } else { panelGraphics.drawImage(image, 0, 0, 640, 480, null); } |
The bluring variable is a counter and when it's greater-than zero, bluring is occurring. The variable blur is a double that varies between 0.0 and 1.0, where 0 is max blurred and 1 is normal. The image variable is the BufferedImage used for double buffering.
When blurring is occurring, the image, which is normally just rendered to the screen (the else case), is drawn to itself but scaled by the blur scaling factor (well actually blur-squared to make the effect less linear). The scaled-down region is scaled back up to screen size. The smaller the blur scaling factor, the more blocky (low rez) the result.