Java中从RGB到HSV(Color.RGBtoHSB)返回不同的结果

Java中从RGB到HSV(Color.RGBtoHSB)返回不同的结果,java,javafx,rgb,hsv,hsb,Java,Javafx,Rgb,Hsv,Hsb,我试图在JavaFX中更改一些图像的颜色。例如,如果我插入这些RGB值(185、74、72),我会得到不同的结果。我用油漆检查了RGB结果,结果是(205183183)。你们谁知道为什么 代码如下: VBox icon = new VBox(); HBox cell = new HBox(5); Circle circle = new Circle(12, 12, 18); ImageView iv = new ImageView(ICON_URL);

我试图在JavaFX中更改一些图像的颜色。例如,如果我插入这些RGB值(185、74、72),我会得到不同的结果。我用油漆检查了RGB结果,结果是(205183183)。你们谁知道为什么

代码如下:

    VBox icon = new VBox();

    HBox cell = new HBox(5);

    Circle circle = new Circle(12, 12, 18);
    ImageView iv = new ImageView(ICON_URL);
    ColorAdjust ca = new ColorAdjust();
    float[] hsb = new float[3];
    Color.RGBtoHSB(185, 74, 72, hsb);

    ca.setHue(hsb[0]);
    ca.setSaturation(hsb[1]);
    ca.setBrightness(hsb[2]);

    iv.setClip(circle);
    iv.setEffect(ca);

    icon.getChildren().addAll(iv);
    cell.getChildren().addAll(icon);

我尝试了下面的代码,但是当我将对比度设置为1.0时,代码变为白色而不是蓝色

      //Instantiating the ColorAdjust class 
      ColorAdjust colorAdjust = new ColorAdjust(); 
      // https://stackoverflow.com/questions/37561747/from-rgb-to-hsv-color-rgbtohsb-in-java-returns-a-different-result
      //Setting the contrast value 
      colorAdjust.setContrast(1.0);     

      //Setting the hue value 
      colorAdjust.setHue(color.getHue());     

      //Setting the brightness value 
      colorAdjust.setBrightness(color.getBrightness());  

      //Setting the saturation value 
      colorAdjust.setSaturation(color.getSaturation());   

      //Applying color adjust effect to the ImageView node 
      imageView.setEffect(colorAdjust); 
然后我对中的代码进行了实验,发现png甚至svg都不能正常工作。所以我结束了


我尝试了下面的代码,但当我将对比度设置为1.0时,代码变为白色而不是蓝色

      //Instantiating the ColorAdjust class 
      ColorAdjust colorAdjust = new ColorAdjust(); 
      // https://stackoverflow.com/questions/37561747/from-rgb-to-hsv-color-rgbtohsb-in-java-returns-a-different-result
      //Setting the contrast value 
      colorAdjust.setContrast(1.0);     

      //Setting the hue value 
      colorAdjust.setHue(color.getHue());     

      //Setting the brightness value 
      colorAdjust.setBrightness(color.getBrightness());  

      //Setting the saturation value 
      colorAdjust.setSaturation(color.getSaturation());   

      //Applying color adjust effect to the ImageView node 
      imageView.setEffect(colorAdjust); 
然后我对中的代码进行了实验,发现png甚至svg都不能正常工作。所以我结束了


你得到了什么结果?@MichaelMarkidis图像有不同的颜色(较浅的颜色)。修改后的图像的RGB是(205183183183)。请您也提供使用上述代码片段的代码好吗?@SubOptimal我编辑代码。这并不完全相同,但这只是我所做的一个例子。你得到了什么结果?@MichaelMarkidis图像有不同的颜色(较浅的颜色)。修改后的图像的RGB是(205183183183)。请您也提供使用上述代码片段的代码好吗?@SubOptimal我编辑代码。这不完全一样,但这只是我所做的一个例子。。这不是一个答案,或者是吗?还没有-我必须添加一个链接到我最终得到的东西,嗯。。这不是一个答案,或者是吗?还没有-我必须添加一个链接到我最终得到的东西