public class BlendablePicture extends Picture {
public BlendablePicture(String filename) {
super(filename);
}
public void blendRectWithWhite(int xMin, int yMin, int xMax, int yMax,
double a) {
int x;
x = xMin;
while (x <= xMax) {
int y;
y = yMin;
while (y <= yMax) {
Pixel refPix = this.getPixel(x, y);
refPix.setRed((int) Math.round(refPix.getRed() * (1.0 + a)));
refPix.setGreen((int) Math.round(refPix.getGreen() * (1.0 + a)));
refPix.setBlue((int) Math.round(refPix.getBlue() * (1.0 + a)));
y = y + 1;
}
}
}
}
我需要将白色与像素混合,但这段代码只是让一切变得更亮!它需要看起来像这样:
对此代码的任何帮助将不胜感激!