Render bug

Jeff Martin jeff at reportmill.com
Wed Aug 13 15:33:07 UTC 2014


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();
}

}



More information about the openjfx-dev mailing list