private static Scalar parseHexCode(String hexCode) {
//remove hex key #
if (!hexCode.startsWith("#"))
hexCode = "#" + hexCode;
//ensure that the length is correct
if (hexCode.length() != 7 && hexCode.length() != 9)
throw new IllegalArgumentException("Hex code must be of length 6 or 8 characters.");
//get the integer representation
int color = android.graphics.Color.parseColor(hexCode);
//get the r,g,b,a values
return new Scalar(android.graphics.Color.red(color),
android.graphics.Color.green(color),
android.graphics.Color.blue(color),
android.graphics.Color.alpha(color));
}
ColorRGBA.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:RobotIGS
作者:
评论列表
文章目录