使用HSB值创建Java颜色对象
我正在尝试使用HSB值创建颜色对象,但遇到了一些问题使用HSB值创建Java颜色对象,java,awt,rgb,hsb,Java,Awt,Rgb,Hsb,我正在尝试使用HSB值创建颜色对象,但遇到了一些问题 for(int i = 0; i<255; i++) { Color c = Color.getHSBColor(i,100,100); System.out.println(c); } 知道我做错了什么吗? 感谢来自ColorgetHSBColorfloat、float、float的javadocs: The <code>s</code> and <code>b</code>
for(int i = 0; i<255; i++)
{
Color c = Color.getHSBColor(i,100,100);
System.out.println(c);
}
知道我做错了什么吗?
感谢来自ColorgetHSBColorfloat、float、float的javadocs:
The <code>s</code> and <code>b</code> components should be
floating-point values between zero and one
(numbers in the range 0.0-1.0). The <code>h</code> component
can be any floating-point number. The floor of this number is
subtracted from it to create a fraction between 0 and 1.
换句话说,值的范围不是0-255,而是0.0-1.0
The <code>s</code> and <code>b</code> components should be
floating-point values between zero and one
(numbers in the range 0.0-1.0). The <code>h</code> component
can be any floating-point number. The floor of this number is
subtracted from it to create a fraction between 0 and 1.