Im trying to make a sepia effect and I need to make some colors be reduced to a certain percent. My compiler errors are these:
Error: The constructor java.awt.Color(double, double, double) is undefined
Error: The constructor java.awt.Color(int, int, double) is undefined
Error: The constructor java.awt.Color(int, int, double) is undefined
This is my code:
public void sepiaTint()
{
Pixel[] pixelArray = this.getPixels();
for (int i = 0; i < pixelArray.length; i++)
{
Pixel pixelObj = pixelArray[i];
int amountRed = pixelObj.getRed();
int amountGreen = pixelObj.getGreen();
int amountBlue = pixelObj.getBlue();
if (amountRed < 60)
{
Color newColor = new Color(amountRed*0.9, amountGreen*0.9, amountBlue*0.9);
pixelObj.setColor(newColor);
}
if (amountRed >= 60 && amountRed <190)
{
Color newColor = new Color(amountRed, amountGreen, amountBlue*0.8);
pixelObj.setColor(newColor);
}
else
{
Color newColor = new Color(amountRed, amountGreen, amountBlue*0.9);
pixelObj.setColor(newColor);
}
}
this.repaint();
}
floatorintmight help.