Skip to content

Commit 49b51f4

Browse files
committed
Add constructor with int-alpha (0-255)
1 parent 3bbf929 commit 49b51f4

File tree

1 file changed

+9
-0
lines changed
  • src/main/java/de/bluecolored/bluemap/api/math

1 file changed

+9
-0
lines changed

src/main/java/de/bluecolored/bluemap/api/math/Color.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ public Color(int i, float alpha) {
7777
this((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF, alpha);
7878
}
7979

80+
/**
81+
* Creates a new color from the given integer in the format 0xRRGGBB.
82+
* @param i the integer to create the color from
83+
* @param alpha the alpha value in range 0-255
84+
*/
85+
public Color(int i, int alpha) {
86+
this((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF, (float) alpha / 255f);
87+
}
88+
8089
/**
8190
* The value can be an integer in String-Format (see {@link #Color(int)}) or a string in hexadecimal format
8291
* prefixed with # <i>(css-style: e.g. <code>#f16</code> becomes <code>#ff1166</code>)</i>.

0 commit comments

Comments
 (0)