-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
7
-
generic
-
generic
quoting originally filed 6784594:
----------------------------------------------------------------------------
http://download.oracle.com/javase/6/docs/api/java/awt/Color.html#brighter()
http://download.oracle.com/javase/6/docs/api/java/awt/Color.html#darker()
Java SE specification states for java.awt.Color.brighter()/darker() methods:
For instance "darker"
"This method applies an arbitrary scale factor to each of the three RGB
components of this Color to create a darker version of this Color."
This means that alpha component must remain unchanged, however it is not
the case for many Java implementations: 1.4.2, 5.0, 6.0, 7.
----------------------------------------------------------------------------
The following code illustrates that alpha is being reset to 255.
import java.awt.*;
public class ColorBrighterDarker {
public static void main(String[] args) {
System.out.println(new Color(123, 123, 123, 123).brighter().getAlpha());
System.out.println(new Color(123, 123, 123, 123).darker().getAlpha());
}
}
----------------------------------------------------------------
The output will be
255
255
----------------------------------------------------------------------------
http://download.oracle.com/javase/6/docs/api/java/awt/Color.html#brighter()
http://download.oracle.com/javase/6/docs/api/java/awt/Color.html#darker()
Java SE specification states for java.awt.Color.brighter()/darker() methods:
For instance "darker"
"This method applies an arbitrary scale factor to each of the three RGB
components of this Color to create a darker version of this Color."
This means that alpha component must remain unchanged, however it is not
the case for many Java implementations: 1.4.2, 5.0, 6.0, 7.
----------------------------------------------------------------------------
The following code illustrates that alpha is being reset to 255.
import java.awt.*;
public class ColorBrighterDarker {
public static void main(String[] args) {
System.out.println(new Color(123, 123, 123, 123).brighter().getAlpha());
System.out.println(new Color(123, 123, 123, 123).darker().getAlpha());
}
}
----------------------------------------------------------------
The output will be
255
255
- duplicates
-
JDK-6783910 java.awt.Color.brighter()/darker() methods make color opaque
-
- Closed
-