Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8223298

SVG patterns are drawn wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx15
    • jfx11, 8
    • javafx
    • web
    • generic

        ADDITIONAL SYSTEM INFORMATION :
        The bug is reproduced only if the retina display is in use. So if you close the retina display and you use an external monitor, the pattern is correctly drawn.

        A DESCRIPTION OF THE PROBLEM :
        SVG patterns are drawn with half the expected size and with a gap between each repetition, if we are using a MacBook with a retina display and the retina display is active.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Draw an SVG object with the fill attribute assigned to a pattern, in a Mac computer with Retina display (any MacBook Pro after 2013).
        The retina display must be active.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The object is drawn with a repetitive pattern with no gaps between the pattern.

        Example, if we have "O" as a pattern:
        OOOO
        OOOO
        OOOO

        I can send for better explanation a file with a correct and a wrong plot.
        ACTUAL -
        The object is drawn with a repetitive pattern with half the expected size, and a gap between each pattern.

        Example, if we have "O" as a patter:
        o o o o
        o o o o
        o o o o

        I can send for better explanation a file with a correct and a wrong plot.

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.layout.Region;
        import javafx.scene.web.WebEngine;
        import javafx.scene.web.WebView;
        import javafx.stage.Stage;


        public class PatternSVGTest extends Application {
            private Scene scene;
            @Override public void start(Stage stage) {
                scene = new Scene(new PatternWebSVG());
                stage.setScene(scene);
                stage.show();
            }
         
            public static void main(String[] args){
                launch(args);
            }
            
            private class PatternWebSVG extends Region {
            
                final WebView browser = new WebView();
                final WebEngine webEngine = browser.getEngine();
                 
                public PatternWebSVG() {
                    webEngine.loadContent(
                     "<!DOCTYPE html> " +
                     "<html> " +
                     "<body> " +
                     "<svg height='150' width='400'> " +
                            " " +
                     " <rect width='100%' height='476' x='0' y='2' fill='url(#pattern_id)'></rect> " +
                     " <pattern id='pattern_id' x='0' y='0' width='30' height='30' patternUnits='userSpaceOnUse'> " +
                     " <rect width='30' height='30' fill='green'></rect> " +
                     " <circle cx='15' cy='15' r='15' stroke='black' stroke-width='1' fill='red' /> " +
                     " </pattern> " +
                     "</svg> " +
                     "</body> " +
                     "</html> "
                     );
                    getChildren().add(browser);
                }
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Use an external monitor instead the retina display.

        FREQUENCY : always


              ajoseph Arun Joseph (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: