rl-client: add ColorUtil/OverlayUtil

This commit is contained in:
TheRealNull
2020-12-26 21:25:52 -05:00
parent 6211605432
commit 072c585177
2 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package com.openosrs.client.util;
import java.awt.Color;
public class ColorUtil extends net.runelite.client.util.ColorUtil
{
/**
* Modifies the alpha component on a Color
*
* @param color The color to set the alpha value on
* @param alpha The alpha value to set on the color
* @return color
*/
public static int setAlphaComponent(Color color, int alpha)
{
return setAlphaComponent(color.getRGB(), alpha);
}
/**
* Modifies the alpha component on a Color
*
* @param color The color to set the alpha value on
* @param alpha The alpha value to set on the color
* @return color
*/
public static int setAlphaComponent(int color, int alpha)
{
if (alpha < 0 || alpha > 255)
{
throw new IllegalArgumentException("alpha must be between 0 and 255.");
}
return (color & 0x00ffffff) | (alpha << 24);
}
}