-3

I don't know how to fix this, the code is to lighten the image but I keep coming across this error and I can't seem to fix it

/** CORE:
     * Make all pixels in the image lighter by 20 greylevels.
     * but make sure that you never go above 255
     */
 public void lightenImage(float value){
        if (value == 0) return;
        
        boolean darken = value < 0;
        value = Math.abs(value);
        for (int x = 0; x < this.image.length; x++)
        for (int y = 0; y < this.image[0].length; y++) {
        Color pixel = this.image[x][y];
        float r = (float)pixel.getRed() / 255;
        float g = (float)pixel.getGreen() / 255;
        float b = (float)pixel.getBlue() / 255;
        float a = (float)pixel.getAlpha() / 255;                
        
        r = darken ? r * (1 - value) : r + (1 - r) * value;
        g = darken ? g * (1 - value) : g + (1 - g) * value;
        b = darken ? b * (1 - value) : b + (1 - b) * value;
        this.image[x][y] = Color(r, g, b, a);
        }
        
    }
Zynbad
  • 1
  • 1

0 Answers0