Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions src/main/java/math/Color.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public Color add(Color color) {

/**
* Adds the components of a given color to those of this color storing the
* result in the given result color. Each component is added separately. If the
* provided color c is null, an exception is thrown. If the provided result
* color is null, a new color is created.
* result in the given result color. Each component is added separately. If
* the provided color c is null, an exception is thrown. If the provided
* result color is null, a new color is created.
*
* @param color the color to add to this color
* @param result the color to store the result in
Expand All @@ -190,8 +190,8 @@ public Color add(Color color, Color result) {
}

/**
* Adds the given r,g,b,a components to those of this color creating a new color
* object. Each component is added separately.
* Adds the given r,g,b,a components to those of this color creating a new
* color object. Each component is added separately.
*
* @param r the red component to add
* @param g the green component to add
Expand All @@ -204,8 +204,8 @@ public Color add(float r, float g, float b, float a) {
}

/**
* Adds the color c to this color internally, and returns a handle to this color
* for easy chaining of calls. Each component is added separately.
* Adds the color c to this color internally, and returns a handle to this
* color for easy chaining of calls. Each component is added separately.
*
* @param color the color to add to this color
* @return this
Expand Down Expand Up @@ -238,9 +238,9 @@ public Color addLocal(float r, float g, float b, float a) {
}

/**
* Subtracts the components of a given color from those of this color creating a
* new color object. Each component is subtracted separately. If the provided
* color is null, an exception is thrown.
* Subtracts the components of a given color from those of this color creating
* a new color object. Each component is subtracted separately. If the
* provided color is null, an exception is thrown.
*
* @param color the color to subtract from this color
* @return the resultant color
Expand Down Expand Up @@ -270,8 +270,8 @@ public Color subtract(Color color, Color result) {
}

/**
* * Subtracts the given r,g,b,a components from those of this color creating a
* new color object. Each component is subtracted separately.
* * Subtracts the given r,g,b,a components from those of this color creating
* a new color object. Each component is subtracted separately.
*
* @param r the red component to subtract
* @param g the green component to subtract
Expand Down Expand Up @@ -347,8 +347,8 @@ public Color clampLocal() {
}

/**
* Sets all components of this color to 0.0f internally, and returns a handle to
* this color for easy chaining of calls.
* Sets all components of this color to 0.0f internally, and returns a handle
* to this color for easy chaining of calls.
*
* @return this
*/
Expand All @@ -368,8 +368,8 @@ public float maxComponent() {
}

/**
* Returns a new float array containing the r,g,b,a components of this color in
* that order.
* Returns a new float array containing the r,g,b,a components of this color
* in that order.
*
* @return the components of this color as array
*/
Expand All @@ -378,8 +378,8 @@ public float[] toArray() {
}

/**
* Stores the r,g,b,a components in the given array. If the provided store array
* is null a new array is created to store the components in.
* Stores the r,g,b,a components in the given array. If the provided store
* array is null a new array is created to store the components in.
*
* @param store the array to store the components into
* @return store
Expand Down Expand Up @@ -508,12 +508,14 @@ public int getRGBA() {
int g = getGreenInt();
int b = getBlueInt();
int a = getAlphaInt();
return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) << 0);
return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8)
| ((b & 0xFF) << 0);
}

/**
* Returns a unique hash code for this color object based on it's values. If two
* colors are logically equivalent, they will return the same hash code value.
* Returns a unique hash code for this color object based on it's values. If
* two colors are logically equivalent, they will return the same hash code
* value.
*
* @return the hash code value of this color
*/
Expand Down Expand Up @@ -544,9 +546,9 @@ public boolean equals(Object obj) {
return false;
Color other = (Color) obj;
return Float.floatToIntBits(r) == Float.floatToIntBits(other.r)
&& Float.floatToIntBits(g) == Float.floatToIntBits(other.g)
&& Float.floatToIntBits(b) == Float.floatToIntBits(other.b)
&& Float.floatToIntBits(a) == Float.floatToIntBits(other.a);
&& Float.floatToIntBits(g) == Float.floatToIntBits(other.g)
&& Float.floatToIntBits(b) == Float.floatToIntBits(other.b)
&& Float.floatToIntBits(a) == Float.floatToIntBits(other.a);
}

/**
Expand Down
Loading
Loading