Shading (Another Technique)

Shading: As with most things, there's more than one approach. This approach should be better in some ways. Basically, idea is to make all the pixels more red, for instance. You could adapt this technique for any color. The results here are much smoother than with the previous method. Here's the key part of the code:
for(int x = 0; x< w * h; x++){ int r = (pixel[x] & 0x00ff0000)>>16; int g = (pixel[x] & 0x0000ff00)>>8; int b = (pixel[x] & 0x000000ff); r+=100; if(r>255) r=255; g-=100; if(g<0) g=0; b-=100; if(b<0) b=0; pixel[x]= (255<<24) | (r<<16) | (g<<8) | b; }
Assignment: - All you have to do is implement this second shading technique in an applet using a picture of your own selection. Instead of shading it red, try shading it green.