[ https://issues.apache.org/jira/browse/BATIK-985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285645#comment-16285645 ]
Patrick Valsecchi commented on BATIK-985: ----------------------------------------- Hummm, I had a quick look, and I'm afraid Graphics2D doesn't allow that. There is Graphics2D.setComposite(), but it doesn't quite does the job. If I have a group with opacity 0.5 that contains a big opaque red square with a small opaque white square within, I don't want the white square to appear pink, since the element within the group should be drawn fully opaque and the white square . Graphics2D.setComposite() would just draw a semi transparent white square on top of the semi-transparent red square, making it an incorrect light-pink. A solution could be to create an image with the content of the group and then draw this image semi-transparent, but this is not going to play well with my use-case. I use IText's Graphics2D implementation. So this trick would pixelize the vectors I'm rendering. OK, maybe there is no solution to that :-( > allow "opacity" attribute on group of paths > ------------------------------------------- > > Key: BATIK-985 > URL: https://issues.apache.org/jira/browse/BATIK-985 > Project: Batik > Issue Type: Bug > Components: SVG DOM > Affects Versions: 1.7 > Environment: Operating System: All > Platform: All > Reporter: couk > Assignee: Batik Developer's Mailing list > > I have a bit of code that uses batik at a low level, and sending SVG with the > following elements seems to result in the GraphicsNode not painting anything. > <g opacity="0.1"> > <path > d="M101.5,325.5c0-37.396,19.75-70.263,49.364-88.731h-5.481C117.096,256.154,98.5,288.693,98.5,325.5 > > c0,36.062,17.85,68.032,45.178,87.543h5.324C120.425,394.373,101.5,362.107,101.5,325.5z"/> > <path > d="M310.5,325.5c0,36.607-18.925,68.873-47.501,87.543h5.324c27.327-19.511,45.177-51.48,45.177-87.543 > > c0-36.807-18.596-69.346-46.883-88.731h-5.481C290.75,255.237,310.5,288.104,310.5,325.5z"/> > </g> > changing "opacity" to "fill-opacity" results in the desired behavior when > painting. But according to the SVG spec, opacity should be allowed on groups? > Here's now the GraphicsNode is created. > // Parse the SVG document. > SVGDocument doc = new > SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName()).createSVGDocument(null, > data.inputStream()); > UserAgent userAgent = new UserAgentAdapter(); > BridgeContext ctx = new BridgeContext(userAgent, new > DocumentLoader(userAgent)); > ctx.setDynamicState(BridgeContext.STATIC); > GraphicsNode node = new GVTBuilder().build(ctx, doc); > Sorry this isn't more detailed - let me know if this isn't enough information. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: batik-dev-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-dev-h...@xmlgraphics.apache.org