-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
8
-
linux
FULL PRODUCT VERSION :
JDK8 113 (has not worked with any of jdk8 that I recall, going back probably several dozen EA releases).
ADDITIONAL OS VERSION INFORMATION :
GNU/Linux Kernel 3.11.0 (Kubuntu) 64bit
EXTRA RELEVANT SYSTEM CONFIGURATION :
nvidia-304 (package); gfx card: NVIDIA Corporation GK104 [GeForce GTX 660 Ti] (rev a1)
A DESCRIPTION OF THE PROBLEM :
It seems that the 'fractions' parameter of RadialGradientPaint (numbers from 0.0 through 1.0) is handled improperly under Linux: Only the very last value (to be painted at the outermost edge, at 1.0) is rendered for the entire gradient.
In the example code, I use colors {white,white,yellow,TRANSPARENT red} in fractions [0.0, 0.25, 0.35, 1.0]: The first 25% of the circle (from center outward) will spread from white to white; the next 10% (0.25 to 0.35) spread from white to yellow; the remaining 65% (0.35 to 1.0) spread from yellow to increasingly transparent red. This works perfectly with JDK7 (Linux and Windows), but works ONLY on Windows with JDK8, NOT on Linux.
Instead, JDK8 on Linux appears to ignore all but the very last color (in the example, transparent red) and fills the entire oval (circle) with that color, producing no spread whatsoever:
Try this: Modify the 'colors' array, set the colors to {white,white,yellow,BLUE}. The ENTIRE circle is now filled with ONLY blue (jdk8 on Linux), and no gradient is produced, and none of the other colors (white and yellow) are shows in the painted gradient at all.
REGRESSION. Last worked in version 7u25
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b113)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b55, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile given source code (produces the following three classes in default package); execute "java RadialGradientPaintDemo" to launch; try under both JDK7 and JDK8:
RadialGradientPaintDemo
RadialGradientPaintDemo$Display
RadialGradientPaintDemo$Painting
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Black background, bright glowing yellow/red star enclosed with white circle. This is what will render under jdk7.
ACTUAL -
Black background, white circle. No sign whatsoever of the yellow/red glowing star. Only the last color in the gradient spread is used to fill the entire gradient area.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.HeadlessException;
import java.awt.RadialGradientPaint;
import java.awt.Rectangle;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
/**
* <p>
* Opens a 480x320 window (slightly offset from top-left corner) and paints on a
* black background a glowing astronomical star image (white core, with yellow
* glow fading into red, and eventually red transparency). A white circle is
* drawn around the whole thing.
* </p>
*
* <p>
* Under JDK7 this paints perfectly.
* </p>
*
* <p>
* Under JDK8 only the white circle is drawn on black background. The whole big,
* brightly glowing star is not rendered.
* </p>
*
* <p>
* The value of the "java.version" property is displayed in the title bar.
* </p>
*
* @author K Udo Schuermann
*/
public class RadialGradientPaintDemo
{
public static void main( String[] args )
{
try
{
// Launch the display on the EDT.
SwingUtilities.invokeLater( new Display() );
}
catch( final HeadlessException noGUI )
{
System.err.println( "Sorry, but no graphical environment is available: " + noGUI.getMessage() );
}
catch( final InternalError badGUI )
{
System.err.println( "Sorry, but the graphical environment appears inaccessible: " + badGUI.getMessage() );
}
}
/**
* Creates the display (to be launched on the Event Dispatch Thread).
*
* @author K Udo Schuermann (udo@ringlord.com)
*/
private static class Display
implements Runnable
{
public void run()
{
frame = new JFrame( "RadialGradientPaint (" +
System.getProperty( "os.name" ) +
" " +
System.getProperty( "os.version" ) +
", Java " +
System.getProperty( "java.version" ) +
")" );
frame.setContentPane( new Painting() );
frame.setBounds( new Rectangle( 64,
64,
480,
320 ) );
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
frame.setVisible( true );
}
private JFrame frame;
}
/**
* The painting of the glowing (celestial) star image.
*
* @author K Udo Schuermann (udo@ringlord.com)
*/
private static class Painting
extends JPanel
{
@Override
public void paint( final Graphics g )
{
final Graphics2D g2 = (Graphics2D)g;
final Rectangle clip = g.getClipBounds();
g2.setColor( Color.BLACK );
g2.fillRect( clip.x,
clip.y,
clip.width,
clip.height );
final int x = clip.width / 2;
final int y = clip.height / 2;
final int radius = Math.min( clip.width,
clip.height ) / 3;
final int diameter = radius * 2;
g2.setPaint( new RadialGradientPaint( x,
y,
radius,
radialSpread,
colors ) );
g2.fillOval( x - radius,
y - radius,
diameter,
diameter );
g2.setColor( Color.WHITE );
g.drawOval( x - radius,
y - radius,
diameter + 4,
diameter + 4 );
}
private static final Color[] colors = {Color.WHITE,
Color.WHITE,
Color.YELLOW,
new Color( 255,
0,
0,
0 )};
private static final float[] radialSpread = {0.0f,
0.25f,
0.35f,
1.0f};
private static final long serialVersionUID = 5430227912885530360L;
}
}
---------- END SOURCE ----------
JDK8 113 (has not worked with any of jdk8 that I recall, going back probably several dozen EA releases).
ADDITIONAL OS VERSION INFORMATION :
GNU/Linux Kernel 3.11.0 (Kubuntu) 64bit
EXTRA RELEVANT SYSTEM CONFIGURATION :
nvidia-304 (package); gfx card: NVIDIA Corporation GK104 [GeForce GTX 660 Ti] (rev a1)
A DESCRIPTION OF THE PROBLEM :
It seems that the 'fractions' parameter of RadialGradientPaint (numbers from 0.0 through 1.0) is handled improperly under Linux: Only the very last value (to be painted at the outermost edge, at 1.0) is rendered for the entire gradient.
In the example code, I use colors {white,white,yellow,TRANSPARENT red} in fractions [0.0, 0.25, 0.35, 1.0]: The first 25% of the circle (from center outward) will spread from white to white; the next 10% (0.25 to 0.35) spread from white to yellow; the remaining 65% (0.35 to 1.0) spread from yellow to increasingly transparent red. This works perfectly with JDK7 (Linux and Windows), but works ONLY on Windows with JDK8, NOT on Linux.
Instead, JDK8 on Linux appears to ignore all but the very last color (in the example, transparent red) and fills the entire oval (circle) with that color, producing no spread whatsoever:
Try this: Modify the 'colors' array, set the colors to {white,white,yellow,BLUE}. The ENTIRE circle is now filled with ONLY blue (jdk8 on Linux), and no gradient is produced, and none of the other colors (white and yellow) are shows in the painted gradient at all.
REGRESSION. Last worked in version 7u25
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b113)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b55, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile given source code (produces the following three classes in default package); execute "java RadialGradientPaintDemo" to launch; try under both JDK7 and JDK8:
RadialGradientPaintDemo
RadialGradientPaintDemo$Display
RadialGradientPaintDemo$Painting
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Black background, bright glowing yellow/red star enclosed with white circle. This is what will render under jdk7.
ACTUAL -
Black background, white circle. No sign whatsoever of the yellow/red glowing star. Only the last color in the gradient spread is used to fill the entire gradient area.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.HeadlessException;
import java.awt.RadialGradientPaint;
import java.awt.Rectangle;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
/**
* <p>
* Opens a 480x320 window (slightly offset from top-left corner) and paints on a
* black background a glowing astronomical star image (white core, with yellow
* glow fading into red, and eventually red transparency). A white circle is
* drawn around the whole thing.
* </p>
*
* <p>
* Under JDK7 this paints perfectly.
* </p>
*
* <p>
* Under JDK8 only the white circle is drawn on black background. The whole big,
* brightly glowing star is not rendered.
* </p>
*
* <p>
* The value of the "java.version" property is displayed in the title bar.
* </p>
*
* @author K Udo Schuermann
*/
public class RadialGradientPaintDemo
{
public static void main( String[] args )
{
try
{
// Launch the display on the EDT.
SwingUtilities.invokeLater( new Display() );
}
catch( final HeadlessException noGUI )
{
System.err.println( "Sorry, but no graphical environment is available: " + noGUI.getMessage() );
}
catch( final InternalError badGUI )
{
System.err.println( "Sorry, but the graphical environment appears inaccessible: " + badGUI.getMessage() );
}
}
/**
* Creates the display (to be launched on the Event Dispatch Thread).
*
* @author K Udo Schuermann (udo@ringlord.com)
*/
private static class Display
implements Runnable
{
public void run()
{
frame = new JFrame( "RadialGradientPaint (" +
System.getProperty( "os.name" ) +
" " +
System.getProperty( "os.version" ) +
", Java " +
System.getProperty( "java.version" ) +
")" );
frame.setContentPane( new Painting() );
frame.setBounds( new Rectangle( 64,
64,
480,
320 ) );
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
frame.setVisible( true );
}
private JFrame frame;
}
/**
* The painting of the glowing (celestial) star image.
*
* @author K Udo Schuermann (udo@ringlord.com)
*/
private static class Painting
extends JPanel
{
@Override
public void paint( final Graphics g )
{
final Graphics2D g2 = (Graphics2D)g;
final Rectangle clip = g.getClipBounds();
g2.setColor( Color.BLACK );
g2.fillRect( clip.x,
clip.y,
clip.width,
clip.height );
final int x = clip.width / 2;
final int y = clip.height / 2;
final int radius = Math.min( clip.width,
clip.height ) / 3;
final int diameter = radius * 2;
g2.setPaint( new RadialGradientPaint( x,
y,
radius,
radialSpread,
colors ) );
g2.fillOval( x - radius,
y - radius,
diameter,
diameter );
g2.setColor( Color.WHITE );
g.drawOval( x - radius,
y - radius,
diameter + 4,
diameter + 4 );
}
private static final Color[] colors = {Color.WHITE,
Color.WHITE,
Color.YELLOW,
new Color( 255,
0,
0,
0 )};
private static final float[] radialSpread = {0.0f,
0.25f,
0.35f,
1.0f};
private static final long serialVersionUID = 5430227912885530360L;
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8023483 sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java failed with jdk8 on linux platforms
- Resolved