src/share/classes/javax/swing/plaf/nimbus/DerivedColor.java

Print this page
rev 10048 : 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
Reviewed-by:


  89             argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24);
  90         } else {
  91             float[] tmp = new float[3];
  92             tmp[0] = clamp(hOffset);
  93             tmp[1] = clamp(sOffset);
  94             tmp[2] = clamp(bOffset);
  95             int alpha = clamp(aOffset);
  96             argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24);
  97         }
  98     }
  99 
 100     /**
 101      * Returns the RGB value representing the color in the default sRGB {@link java.awt.image.ColorModel}. (Bits 24-31
 102      * are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).
 103      *
 104      * @return the RGB value of the color in the default sRGB <code>ColorModel</code>.
 105      * @see java.awt.image.ColorModel#getRGBdefault
 106      * @see #getRed
 107      * @see #getGreen
 108      * @see #getBlue
 109      * @since JDK1.0
 110      */
 111     @Override public int getRGB() {
 112         return argbValue;
 113     }
 114 
 115     @Override
 116     public boolean equals(Object o) {
 117         if (this == o) return true;
 118         if (!(o instanceof DerivedColor)) return false;
 119         DerivedColor that = (DerivedColor) o;
 120         if (aOffset != that.aOffset) return false;
 121         if (Float.compare(that.bOffset, bOffset) != 0) return false;
 122         if (Float.compare(that.hOffset, hOffset) != 0) return false;
 123         if (Float.compare(that.sOffset, sOffset) != 0) return false;
 124         if (!uiDefaultParentName.equals(that.uiDefaultParentName)) return false;
 125         return true;
 126     }
 127 
 128     @Override
 129     public int hashCode() {




  89             argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24);
  90         } else {
  91             float[] tmp = new float[3];
  92             tmp[0] = clamp(hOffset);
  93             tmp[1] = clamp(sOffset);
  94             tmp[2] = clamp(bOffset);
  95             int alpha = clamp(aOffset);
  96             argbValue = (Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24);
  97         }
  98     }
  99 
 100     /**
 101      * Returns the RGB value representing the color in the default sRGB {@link java.awt.image.ColorModel}. (Bits 24-31
 102      * are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).
 103      *
 104      * @return the RGB value of the color in the default sRGB <code>ColorModel</code>.
 105      * @see java.awt.image.ColorModel#getRGBdefault
 106      * @see #getRed
 107      * @see #getGreen
 108      * @see #getBlue
 109      * @since 1.0
 110      */
 111     @Override public int getRGB() {
 112         return argbValue;
 113     }
 114 
 115     @Override
 116     public boolean equals(Object o) {
 117         if (this == o) return true;
 118         if (!(o instanceof DerivedColor)) return false;
 119         DerivedColor that = (DerivedColor) o;
 120         if (aOffset != that.aOffset) return false;
 121         if (Float.compare(that.bOffset, bOffset) != 0) return false;
 122         if (Float.compare(that.hOffset, hOffset) != 0) return false;
 123         if (Float.compare(that.sOffset, sOffset) != 0) return false;
 124         if (!uiDefaultParentName.equals(that.uiDefaultParentName)) return false;
 125         return true;
 126     }
 127 
 128     @Override
 129     public int hashCode() {