Package codechicken.lib.colour
Class Colour
java.lang.Object
codechicken.lib.colour.Colour
- Direct Known Subclasses:
ColourARGB,ColourRGBA
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninta()static intadd(int c1, int c2) For each color component in c1 and c2, adds them together clamping to 0 - 255.floataF()aF(float a) aF(int a) intargb()intb()floatbF()bF(float b) bF(int b) abstract Colourcopy()booleanbooleanstatic intflipABGR(int colour) Flips a color between ABGR and RGBA.intg()float[]getARGB()float[]getRGBA()floatgF()gF(float g) gF(int g) inthashCode()interpolate(Colour colour2, double d) invert()static intmid(int c1, int c2) For each color component in c1 and c2, calculates the midpoint.multiplyC(double d) abstract intpack()static intpack(int[] data) static intpack(int c, int i) static intpackARGB(byte r, byte g, byte b, byte a) static intpackARGB(double r, double g, double b, double a) static intpackARGB(float[] data) static intpackARGB(int r, int g, int b, int a) abstract float[]static intpackRGBA(byte r, byte g, byte b, byte a) static intpackRGBA(double r, double g, double b, double a) static intpackRGBA(float[] data) static intpackRGBA(int r, int g, int b, int a) intr()static intreplace(int c, int i, float v) static intreplace(int c, int i, int v) Replace the packed 8-bit color component at the specified index.floatrF()rF(float r) rF(int r) intrgb()intrgba()scale(double d) set(double[] doubles) set(double r, double g, double b, double a) set(float[] floats) set(float r, float g, float b, float a) abstract Colourset(int colour) set(int r, int g, int b, int a) static intsub(int c1, int c2) For each color component in c1 and c2, subtracts them clamping to 0 - 255.toString()static int[]unpack(int colour) static intunpack(int c, int i)
-
Field Details
-
r
public byte r -
g
public byte g -
b
public byte b -
a
public byte a
-
-
Constructor Details
-
Colour
public Colour(int r, int g, int b, int a) -
Colour
-
-
Method Details
-
pack
public abstract int pack() -
packArray
public abstract float[] packArray() -
add
-
sub
-
invert
-
multiply
-
scale
-
interpolate
-
multiplyC
-
copy
-
rgb
public int rgb() -
argb
public int argb() -
rgba
public int rgba() -
set
-
set
-
set
-
set
-
set
-
set
-
set
-
rF
-
gF
-
bF
-
aF
-
rF
-
gF
-
bF
-
aF
-
rF
public float rF() -
gF
public float gF() -
bF
public float bF() -
aF
public float aF() -
r
public int r() -
g
public int g() -
b
public int b() -
a
public int a() -
flipABGR
public static int flipABGR(int colour) Flips a color between ABGR and RGBA.- Parameters:
colour- The input either ABGR or RGBA.- Returns:
- The flipped color.
-
unpack
public static int[] unpack(int colour) -
pack
public static int pack(int[] data) -
getRGBA
public float[] getRGBA() -
getARGB
public float[] getARGB() -
packRGBA
public static int packRGBA(byte r, byte g, byte b, byte a) -
packARGB
public static int packARGB(byte r, byte g, byte b, byte a) -
packRGBA
public static int packRGBA(int r, int g, int b, int a) -
packARGB
public static int packARGB(int r, int g, int b, int a) -
packRGBA
public static int packRGBA(double r, double g, double b, double a) -
packARGB
public static int packARGB(double r, double g, double b, double a) -
packRGBA
public static int packRGBA(float[] data) -
packARGB
public static int packARGB(float[] data) -
replace
public static int replace(int c, int i, float v) -
replace
public static int replace(int c, int i, int v) Replace the packed 8-bit color component at the specified index.- Parameters:
c- The packed color.i- The index to replace.v- The value to replace with.- Returns:
- The new packed color.
-
unpack
public static int unpack(int c, int i) -
pack
public static int pack(int c, int i) -
add
public static int add(int c1, int c2) For each color component in c1 and c2, adds them together clamping to 0 - 255.Agnostic of color packing order.
-
sub
public static int sub(int c1, int c2) For each color component in c1 and c2, subtracts them clamping to 0 - 255.Agnostic of color packing order.
-
mid
public static int mid(int c1, int c2) For each color component in c1 and c2, calculates the midpoint.Agnostic of color packing order.
-
equals
-
equals
-
hashCode
public int hashCode() -
toString
-