我有一个getPixelColour
功能:
Color getPixelColor(int x, int y) {
if(mazeImage == null) System.out.println(":(");
int pixel = mazeImage.getRGB(x, y);
int red = (pixel & 0x00ff0000) >> 16;
int green = (pixel & 0x0000ff00) >> 8;
int blue = pixel & 0x000000ff;
return new Color(red,green,blue);
}
例如一个像素是黑色的,并且System.out.println(getPixelColor(x,y) + " " + Color.BLACK);
写java.awt.Color[r=0,g=0,b=0] java.awt.Color[r=0,g=0,b=0]
但getPixelColor(x,y) == Color.BLACK
回报false
。它出什么问题了?