You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by bu...@apache.org on 2008/12/05 12:59:41 UTC

DO NOT REPLY [Bug 46353] New: setOpaque(false) not honoured

https://issues.apache.org/bugzilla/show_bug.cgi?id=46353

           Summary: setOpaque(false) not honoured
           Product: Batik
           Version: 1.7
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: GVT
        AssignedTo: batik-dev@xmlgraphics.apache.org
        ReportedBy: java@dialsolutions.co.uk


JSVGCanvas and JSVGComponent ignore setOpaque() and always draw a background

I think it's becuase
AbstractJGVTComponent.paintComponent
always does this...

g2d.setComposite(AlphaComposite.SrcOver);
g2d.setPaint(getBackground());
g2d.fillRect(visRect.x,     visRect.y,
             visRect.width, visRect.height);

but perhaps this should be wrapped in a isOpaque check?

if{isOpqaue())
{
g2d.setComposite(AlphaComposite.SrcOver);
g2d.setPaint(getBackground());
g2d.fillRect(visRect.x,     visRect.y,
             visRect.width, visRect.height);
}

current workaround (which maybe processor heavy) is to set the component
background to a color with a alpha channel set to 0 (e.g. setBackground(new
Color(0,0,0,0));


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 46353] setOpaque(false) not honoured

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46353


James D <ja...@dialsolutions.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |java@dialsolutions.co.uk




--- Comment #2 from James D <ja...@dialsolutions.co.uk>  2008-12-09 02:13:50 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > JSVGCanvas and JSVGComponent ignore setOpaque() and always draw a background
> 
>   Correct it always draws the background color you tell it to.
> There is no reason that setOpaque should disable this, the
> background color may be semi-transparent.
> 
What should setOpaqaue(false) do then on a JSVGCanvas or JSVGComponent?

I've been digging around the javaswing to find the equivalent and
JComponent.paintComponent invokes the update method in
ComponentUi.java which does this...
    public void update(Graphics g, JComponent c) {
        if (c.isOpaque()) {
            g.setColor(c.getBackground());
            g.fillRect(0, 0, c.getWidth(),c.getHeight());
        }
        paint(g, c);
    }


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 46353] setOpaque(false) not honoured

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46353


Thomas Deweese <de...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Thomas Deweese <de...@apache.org>  2008-12-05 18:01:35 PST ---
(In reply to comment #0)
> JSVGCanvas and JSVGComponent ignore setOpaque() and always draw a background

  Correct it always draws the background color you tell it to.
There is no reason that setOpaque should disable this, the
background color may be semi-transparent.

> but perhaps this should be wrapped in a isOpaque check?

  No.

> current workaround (which maybe processor heavy) is to set the component
> background to a color with a alpha channel set to 0 (e.g. setBackground(new
> Color(0,0,0,0));

   This is the correct solution.  I'd be suprised if it was processor 
intensive as the Graphics2D engine almost certainly will skip actually
drawing the rect if the color has an opacity of zero.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 46353] setOpaque(false) not honoured

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46353





--- Comment #3 from James D <ja...@dialsolutions.co.uk>  2008-12-09 02:26:52 PST ---
this may also be of interest, I think it's saying the background color should
only be used if the component is opaque.

http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#setBackground(java.awt.Color)

cheers
-- 
James D


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org