This looks like a bug in JavaFX when applying the lighting effect. I was able to reproduce the dirty rect rendering on my system. The bug went away if I commented out the following line:

       iview.setEffect(lighting);

Can you please file a JIRA so that we will fix it?

Thanks,
- Chien

On 8/13/2014 8:33 AM, Jeff Martin wrote:
I’m getting a rendering bug with a simple rotating path in front of an 
ImageView (with lighting effect) on Mac OS with 8u20:

        http://reportmill.com/examples/Renderbug/Renderbug.jpg

Looks like some sort of dirty rect problem. Am I doing something wrong or 
should I file a bug?

The code is below. If anyone has an idea for a quick work around, let me know.

jeff



import javafx.animation.RotateTransition;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.stage.Stage;
import javafx.util.Duration;
import snap.web.WebURL;

/**
  * A custom class.
  */
public class DrawTurd extends Application {

public void start(Stage aStage)
{
     // Creat background image - file at 
http://reportmill.com/examples/Renderbug/Wood.jpg
     Image image = new Image(getClass().getResourceAsStream("Wood.jpg"));
     ImageView iview = new ImageView(image);
// Create foreground path triangle
     Path path = new Path();
     path.getElements().add(new MoveTo(100,100)); path.getElements().add(new 
LineTo(180,180));
     path.getElements().add(new LineTo(260,100)); path.getElements().add(new 
ClosePath());
     path.setFill(Color.RED); path.setStroke(Color.BLACK);
// Create lighting effect and add to ImageView
     Light.Distant effect = new Light.Distant(); effect.setAzimuth(60); 
effect.setElevation(120);
     Lighting lighting = new Lighting(); lighting.setSpecularConstant(.15);
     lighting.setLight(effect); lighting.setSurfaceScale(10);
     iview.setEffect(lighting);
// Create group, add nodes, set scene root, show stage
     Group group = new Group(iview, path);
     aStage.setScene(new Scene(group));
     aStage.show();
// Add rotation transition animation
     RotateTransition rt = new RotateTransition(Duration.millis(3000), path);
     rt.setByAngle(180); rt.setCycleCount(4); rt.setAutoReverse(true); 
rt.play();
}

}


Reply via email to