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

SVG opacity is ignored

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3
    • tbd
    • jfx18
    • javafx
    • web

    Description

      The following bug report was taken from the openjfx mailing list -- the reporter was having trouble accessing bugreport.java.com:

      ========================================================

      This is a bug report that should go through https://bugreport.java.com/ , however the bug report site only gives me 'Access Denied ...

      So since openjx 18 using opacity="<value>" will just behave like opacity was set to 1. -> In the Example: two black circles instead of one black and one teal circle. Version 17.0.2 works fine

      Example svg was taken from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/opacity

      Best regards,

      Thorsten Goetzke



      package com.example.demo;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;


      public class HelloApplication extends Application {
          @Override
          public void start(Stage stage) {
              final WebView webView = new WebView();
              final String svg = "<svg viewBox=\"0 0 200 100\" xmlns=\"http://www.w3.org/2000/svg\">\n" + " <defs>\n" + " <linearGradient id=\"gradient\" x1=\"0%\" y1=\"0%\" x2=\"0\" y2=\"100%\">\n" + " <stop offset=\"0%\" style=\"stop-color:skyblue;\" />\n" + " <stop offset=\"100%\" style=\"stop-color:seagreen;\" />\n" + " </linearGradient>\n" + " </defs>\n" + " <rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"url(#gradient)\" />\n" + " <circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"black\" />\n" + " <circle id=\"circle\" cx=\"150\" cy=\"50\" r=\"40\" fill=\"black\" opacity=\"0.3\" />\n" + "</svg>\n";
              webView.getEngine().loadContent(svg);
              stage.setScene(new Scene(webView));
              stage.show();
          }


          public static void main(String[] args) {
              launch();
          }
      }

      Attachments

        Activity

          People

            jbhaskar Jay Bhaskar
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: