Package fr.formiko.usuel.images
Class Pixel
java.lang.Object
fr.formiko.usuel.images.Pixel
Pixel class used by images package.
- Author:
- Hydrolien
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Color
colorToGrey(Color c)
Return Color as a grey color.boolean
Standard equals function.byte
getA()
byte
getB()
byte
getG()
byte
getR()
Return pixel as a Color.void
setA(byte x)
void
setB(byte x)
void
setG(byte x)
void
setR(byte x)
toString()
Return pixel as a String.
-
Field Details
-
r
private byte r -
g
private byte g -
b
private byte b -
a
private byte a
-
-
Constructor Details
-
Pixel
private Pixel(byte r, byte g, byte b, byte a)Main constructor private. Use the int 1 to create a Pixel.- Parameters:
r
- Red value between -128 & 127.g
- Green value between -128 & 127.b
- Blue value between -128 & 127.a
- Alpha value between -128 & 127.
-
Pixel
public Pixel(int r, int g, int b, int a)Main constructor with int.- Parameters:
r
- Red value between 0 & 255.g
- Green value between 0 & 255.b
- Blue value between 0 & 255.a
- Alpha value between 0 & 255.
-
Pixel
public Pixel(int r, int g, int b)Secondary constructor.
It will set Alpha value to 255 (maximum value).- Parameters:
r
- Red value between 0 & 255.g
- Green value between 0 & 255.b
- Blue value between 0 & 255.
-
Pixel
Secondary constructor that use Pheromone.- Parameters:
ph
- Pheromone of the Creature to colored. Pheromone have 3 color value: red, green, blue.
-
-
Method Details
-
getR
public byte getR() -
getG
public byte getG() -
getB
public byte getB() -
getA
public byte getA() -
setR
public void setR(byte x) -
setG
public void setG(byte x) -
setB
public void setB(byte x) -
setA
public void setA(byte x) -
equals
Standard equals function. Null & other class type proof. -
toString
Return pixel as a String.
If alpha value is 127, it will not be print. -
piToColor
Return pixel as a Color. -
colorToGrey
Return Color as a grey color.
-