public class Pixel extends java.lang.Object implements java.lang.Comparable<Pixel>
Modifier and Type | Field and Description |
---|---|
static Pixel |
BLACK
Some constant colors
|
static Pixel |
BLUE |
static Pixel |
GREEN |
static Pixel |
RED |
static Pixel |
WHITE |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Pixel o) |
int |
distance(Pixel px)
Determines how similar this pixel is to another by summing the
(absolute values) of the differences between corresponding
components of the two pixels.
|
boolean |
equals(java.lang.Object other)
Checks whether this pixel has the same components as the given Object.
|
boolean |
equals(Pixel other)
Compares the rgb values of the current Pixel with another to check if
they are the same (and thus whether the two Pixels equal each other)
|
int |
getBlue()
gets the blue component
|
int[] |
getComponents()
get the components as an array of three integers
|
int |
getGreen()
gets the green component
|
int |
getRed()
gets the red component
|
int |
hashCode() |
java.lang.String |
toString()
Returns a String representation of this pixel.
|
public static final Pixel BLACK
public static final Pixel BLUE
public static final Pixel RED
public static final Pixel GREEN
public static final Pixel WHITE
public int getRed()
public int getGreen()
public int getBlue()
public int[] getComponents()
public int distance(Pixel px)
px
- The other pixel with which to comparepublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(Pixel other)
other
- The Pixel being compared to the current Pixelpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object