[英]Java Swing JColorChooser Color RGB to sRGB
Is there a way to use the JColorChooser
to return a Color that can be converted into their corresponding sRGB float values?有没有办法使用
JColorChooser
返回可以转换为相应 sRGB 浮点值的颜色?
Color backgroundColor = JColorChooser.showDialog(this,"Select a color", default);
float r = backgroundColor.getRed(); //Need these to return float color e.g. 0.9333333f
float g = backgroundColor.getGreen();
float b = backgroundColor.getBlue();
The default JColorChooser
is fine I just need a way to convert the color it returns into 0 to 1 RGB.默认的
JColorChooser
很好,我只需要一种将它返回的颜色转换为 0 到 1 RGB 的方法。
I don't understand how to use the API for Color
to make this happen.我不明白如何使用 API for
Color
来实现这一点。 Could someone please provide a example on how to do this?有人可以提供一个如何做到这一点的例子吗? Is it even possible?
甚至可能吗?
Just divide all values by 255 no conversions required只需将所有值除以 255 无需转换
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.