Class Color
java.lang.Object
zombie.core.Color
- All Implemented Interfaces:
Serializable
A simple wrapper round the values required for a colour
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloatThe alpha component of the colourfloatThe blue component of the colourstatic final ColorThe fixed colour blackstatic final ColorThe fixed colour bluestatic final ColorThe fixed colour cyanstatic final ColorThe fixed colour dark graystatic final ColorThe fixed colour dark greenfloatThe green component of the colourstatic final ColorThe fixed colour graystatic final ColorThe fixed colour greenstatic final ColorThe fixed colour light graystatic final ColorThe fixed colour light greenstatic final ColorThe fixed colour dark magentastatic final ColorThe fixed colour dark orangestatic final ColorThe fixed colour dark pinkstatic final ColorThe fixed colour purplefloatThe red component of the colourstatic final ColorThe fixed colour redstatic final ColorThe fixed color transparentstatic final ColorThe fixed colour whitestatic final ColorThe fixed colour yellow -
Constructor Summary
ConstructorsConstructorDescriptionColor()Color(float _r, float _g, float _b) Create a 3 component colourColor(float _r, float _g, float _b, float _a) Create a 4 component colourColor(int value) Create a colour from an evil integer packed 0xAARRGGBB.Color(int _r, int _g, int _b) Create a 3 component colourColor(int _r, int _g, int _b, int _a) Create a 4 component colourCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorabgrToColor(int valueABGR, Color out_result) voidAdd another colour to this oneAdd another colour to this onestatic intblendABGR(int valueABGR, int targetABGR) static intblendBGR(int valueABGR, int targetABGR) brighter()Make a brighter instance of this colourbrighter(float scale) Make a brighter instance of this colourvoidchangeHSBValue(float hFactor, float sFactor, float bFactor) static intcolorToABGR(float _r, float _g, float _b, float _a) static intcolorToABGR(Color val) static intcolorToABGR(ColorInfo colorInfo) darker()Make a darker instance of this colourdarker(float scale) Make a darker instance of this colourstatic ColorDecode a number in a string and process it as a colour reference.booleanequalBytes(Color color0) booleanvoidfromColor(int valueABGR) Deprecated.intgetAlpha()get the alpha byte component of this colourintget the alpha byte component of this colourstatic floatgetAlphaChannelFromABGR(int valueABGR) floatfloatgetB()intgetBlue()get the blue byte component of this colourintget the blue byte component of this colourstatic floatgetBlueChannelFromABGR(int valueABGR) floatfloatgetG()intgetGreen()get the green byte component of this colourintget the green byte component of this colourstatic floatgetGreenChannelFromABGR(int valueABGR) floatfloatgetR()intgetRed()get the red byte component of this colourintget the red byte component of this colourstatic floatgetRedChannelFromABGR(int valueABGR) floatinthashCode()static ColorHSBtoRGB(float hue, float saturation, float brightness) static Colorvoidstatic intlerpABGR(int colA, int colB, float alpha) voidload(ByteBuffer byteBuffer, int var2) voidloadCompact(ByteBuffer byteBuffer) voidloadCompactNoAlpha(ByteBuffer byteBuffer) Multiply this color by anotherstatic intmultiplyABGR(int valueABGR, int multiplierABGR) static intmultiplyBGR(int valueABGR, int multiplierABGR) static Colorrandom()Create a random color.voidsave(ByteBuffer byteBuffer) voidsaveCompact(ByteBuffer byteBuffer) voidsaveCompactNoAlpha(ByteBuffer byteBuffer) scale(float value) Scale the components of the colour by the given valuescaleCopy(float value) Scale the components of the colour by the given valueset(float _r, float _g, float _b) set(float _r, float _g, float _b, float _a) voidsetABGR(int valueABGR) static intsetAlphaChannelToABGR(int valueABGR, float _a) static intsetBlueChannelToABGR(int valueABGR, float _b) voidstatic intsetGreenChannelToABGR(int valueABGR, float _g) static intsetRedChannelToABGR(int valueABGR, float _r) static inttintABGR(int targetABGR, int tintABGR) toString()
-
Field Details
-
transparent
The fixed color transparent -
white
The fixed colour white -
yellow
The fixed colour yellow -
red
The fixed colour red -
purple
The fixed colour purple -
blue
The fixed colour blue -
green
The fixed colour green -
black
The fixed colour black -
gray
The fixed colour gray -
cyan
The fixed colour cyan -
darkGray
The fixed colour dark gray -
lightGray
The fixed colour light gray -
pink
The fixed colour dark pink -
orange
The fixed colour dark orange -
magenta
The fixed colour dark magenta -
darkGreen
The fixed colour dark green -
lightGreen
The fixed colour light green -
a
public float aThe alpha component of the colour -
b
public float bThe blue component of the colour -
g
public float gThe green component of the colour -
r
public float rThe red component of the colour
-
-
Constructor Details
-
Color
public Color() -
Color
Copy constructor- Parameters:
color- The color to copy into the new instance
-
Color
public Color(float _r, float _g, float _b) Create a 3 component colour- Parameters:
_r- The red component of the colour (0.0_g- The green component of the colour (0.0_b- The blue component of the colour (0.0
-
Color
public Color(float _r, float _g, float _b, float _a) Create a 4 component colour- Parameters:
_r- The red component of the colour (0.0_g- The green component of the colour (0.0_b- The blue component of the colour (0.0_a- The alpha component of the colour (0.0
-
Color
-
Color
public Color(int _r, int _g, int _b) Create a 3 component colour- Parameters:
_r- The red component of the colour (0_g- The green component of the colour (0_b- The blue component of the colour (0
-
Color
public Color(int _r, int _g, int _b, int _a) Create a 4 component colour- Parameters:
_r- The red component of the colour (0_g- The green component of the colour (0_b- The blue component of the colour (0_a- The alpha component of the colour (0
-
Color
public Color(int value) Create a colour from an evil integer packed 0xAARRGGBB. If AA is specified as zero then it will be interpreted as unspecified and hence a value of 255 will be recorded.- Parameters:
value- The value to interpret for the colour
-
-
Method Details
-
getR
public float getR() -
getG
public float getG() -
getB
public float getB() -
setColor
-
fromColor
Deprecated.Converts the supplied binary value into color values, and sets the result to this object. Performs a clamp on the alpha channel. Performs a special-case on the alpha channel, where if it is 0, it is set to MAX instead. -
setABGR
public void setABGR(int valueABGR) -
abgrToColor
-
colorToABGR
-
colorToABGR
-
colorToABGR
public static int colorToABGR(float _r, float _g, float _b, float _a) -
multiplyABGR
public static int multiplyABGR(int valueABGR, int multiplierABGR) -
multiplyBGR
public static int multiplyBGR(int valueABGR, int multiplierABGR) -
blendBGR
public static int blendBGR(int valueABGR, int targetABGR) -
blendABGR
public static int blendABGR(int valueABGR, int targetABGR) -
tintABGR
public static int tintABGR(int targetABGR, int tintABGR) -
lerpABGR
public static int lerpABGR(int colA, int colB, float alpha) -
getAlphaChannelFromABGR
public static float getAlphaChannelFromABGR(int valueABGR) -
getBlueChannelFromABGR
public static float getBlueChannelFromABGR(int valueABGR) -
getGreenChannelFromABGR
public static float getGreenChannelFromABGR(int valueABGR) -
getRedChannelFromABGR
public static float getRedChannelFromABGR(int valueABGR) -
setAlphaChannelToABGR
public static int setAlphaChannelToABGR(int valueABGR, float _a) -
setBlueChannelToABGR
public static int setBlueChannelToABGR(int valueABGR, float _b) -
setGreenChannelToABGR
public static int setGreenChannelToABGR(int valueABGR, float _g) -
setRedChannelToABGR
public static int setRedChannelToABGR(int valueABGR, float _r) -
random
Create a random color. -
decode
-
add
-
addToCopy
-
brighter
Make a brighter instance of this colour- Returns:
- The brighter version of this colour
-
brighter
Make a brighter instance of this colour- Parameters:
scale- The scale up of RGB (i.e. if you supply 0.03 the colour will be brightened by 3%)- Returns:
- The brighter version of this colour
-
darker
Make a darker instance of this colour- Returns:
- The darker version of this colour
-
darker
Make a darker instance of this colour- Parameters:
scale- The scale down of RGB (i.e. if you supply 0.03 the colour will be darkened by 3%)- Returns:
- The darker version of this colour
-
equals
-
equalBytes
-
set
-
set
-
set
-
save
-
load
-
getAlpha
public int getAlpha()get the alpha byte component of this colour- Returns:
- The alpha component (range 0-255)
-
getAlphaFloat
public float getAlphaFloat() -
getRedFloat
public float getRedFloat() -
getGreenFloat
public float getGreenFloat() -
getBlueFloat
public float getBlueFloat() -
getAlphaByte
public int getAlphaByte()get the alpha byte component of this colour- Returns:
- The alpha component (range 0-255)
-
getBlue
public int getBlue()get the blue byte component of this colour- Returns:
- The blue component (range 0-255)
-
getBlueByte
public int getBlueByte()get the blue byte component of this colour- Returns:
- The blue component (range 0-255)
-
getGreen
public int getGreen()get the green byte component of this colour- Returns:
- The green component (range 0-255)
-
getGreenByte
public int getGreenByte()get the green byte component of this colour- Returns:
- The green component (range 0-255)
-
getRed
public int getRed()get the red byte component of this colour- Returns:
- The red component (range 0-255)
-
getRedByte
public int getRedByte()get the red byte component of this colour- Returns:
- The red component (range 0-255)
-
hashCode
-
multiply
-
scale
Scale the components of the colour by the given value- Parameters:
value- The value to scale by
-
scaleCopy
Scale the components of the colour by the given value- Parameters:
value- The value to scale by- Returns:
- The copy which has been scaled
-
toString
-
interp
-
changeHSBValue
public void changeHSBValue(float hFactor, float sFactor, float bFactor) -
HSBtoRGB
-
HSBtoRGB
-
saveCompactNoAlpha
- Throws:
IOException
-
loadCompactNoAlpha
- Throws:
IOException
-
saveCompact
- Throws:
IOException
-
loadCompact
- Throws:
IOException
-