Issue #17 new

Colors not equals

Federico Pacheco
created an issue

Colors taken from an image with Image.getColor() or Image.getGraphics().getPixel() sometimes are not equals to theis corresponding color from the Color class.

Image img = new Image(10,10);
img.getGraphics.setColor(Color.darkGray);
img.getGraphics().fillRect(0,0,1,1);
img.getGraphics.flush();
(img.getColor(0,0).equal(Color.darkGray)) <-- That results false when it's supposed to                    result true 

Also, if you print the colors: img.getColor() prints "Color (0.29803923,0.29803923,0.29803923,1.0)" Color.darkGray prints "Color (0.3,0.3,0.3,1.0)"

Notice theres some kind of approximation of the number. This also happens with colors created with Color.color.darker()

Comments (1)

  1. Log in to comment