简体   繁体   English

RGB整数到Color对象

[英]RGB integer to Color object

I am drawing an integer from a Color using this code: 我正在使用此代码从Color绘制一个整数:

robot.getPixelColor(x, y).getRGB()

Now how do I go from an integer back to an RGB color? 现在如何从整数变回RGB颜色? I've looked about and I havn't seen anything that does this... 我看了一下,却没有看到任何能做到这一点的东西...

Thanks! 谢谢!

Actually getPixelColor(x,y) returns a java.awt.Color . 实际上, getPixelColor(x,y)返回一个java.awt.Color

Color color = robot.getPixelColor(x,y);
int rgb = color.getRGB();
Color color2 = new Color(rgb);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM