public class Pixel
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
darken()
This method darkens a pixel by taking the red, green, and blue values
and decreasing them.
|
int |
getBlue()
This method returns the blue value of the pixel.
|
java.awt.Color |
getColor()
This method returns all three colours of the pixel as a Colour object
|
double |
getDistance(java.awt.Color c)
This method returns the color distance between this pixel and a specified color.
|
double |
getDistance(int r,
int g,
int b)
This method returns the color distance between this pixel and a specified color.
|
double |
getDistance(Pixel p)
This method returns the color distance between this and another Pixel's color.
|
int |
getGreen()
This method returns the green value of the pixel.
|
int |
getRed()
This method returns the red value of the pixel.
|
byte |
getTransparency()
This method returns the transparency value of the pixel.
|
void |
lighten()
This method lightens a pixel by taking the red, green, and blue values
and increasing them
|
void |
setBlue(int b)
This method sets the blue value of the pixel.
|
void |
setColor(java.awt.Color c)
This method changes all three colours in one method by accepting
a Colour object as a paramter
|
void |
setColor(int r,
int g,
int b)
This method changes all three colours in one method
|
void |
setGreen(int g)
This method sets the green value of the pixel.
|
void |
setRed(int r)
This method sets the red value of the pixel.
|
void |
setTransparency(byte t)
This method sets the transparency value of the pixel.
|
java.lang.String |
toString()
This method returns a string representation of the Pixel object
|
public double getDistance(int r, int g, int b)
r
- the red of the colorg
- the green of the colorb
- the blue of the colorpublic double getDistance(java.awt.Color c)
c
- a Colourpublic double getDistance(Pixel p)
p
- the other pixelpublic int getRed()
public int getGreen()
public int getBlue()
public byte getTransparency()
public void setRed(int r)
r
- (the new red value)public void setGreen(int g)
g
- (the new green value)public void setBlue(int b)
b
- (the new blue value)public void setTransparency(byte t)
t
- (the new transparency value)public java.awt.Color getColor()
public void setColor(int r, int g, int b)
r
- (the new red value)g
- (the new green value)b
- (the new blue value)public void setColor(java.awt.Color c)
c
- (the Colour object representation of red, green, blue)public void lighten()
public void darken()
public java.lang.String toString()
toString
in class java.lang.Object