Transparent PCanvas

10 views
Skip to first unread message

Sam Reid

unread,
Sep 17, 2008, 12:36:58 AM9/17/08
to Piccolo2D Developers
I'd like to make it possible to make PCanvas partly transparent, but
that's impossible with current implementation of PCanvas. Line 605
gives:

g2.setColor( getBackground() );
g2.fillRect( 0, 0, getWidth(), getHeight() );

I'd recommend changing this to:

if ( isOpaque() ) {
g2.setColor( getBackground() );
g2.fillRect( 0, 0, getWidth(), getHeight() );
}

This is similar to the swing ui implementation.

I couldn't find a workaround that involved using a Color with a
transparent alpha channel, see discussions here:
http://www.chka.de/swing/components/opacity.html

Any comments, questions or objections to this change?

Sam Reid

woodymac

unread,
Sep 30, 2008, 12:12:04 PM9/30/08
to Piccolo2D Developers
Please make this change, so I can dump my subclass of PCanvas.

Michael Heuer

unread,
Oct 1, 2008, 5:58:32 PM10/1/08
to piccol...@googlegroups.com
Hello Sam,

I say commit it, or create an issue if you would like to allow more comment.

Whether or not there is an issue created, having an example in the
examples project to demonstrate the benefits of this change would be
cool.

michael

Sam Reid

unread,
Oct 1, 2008, 9:09:32 PM10/1/08
to Piccolo2D Developers
I added support for non-opaque canvases in revision 391, please let me
know if you have any questions or comments about this.

Thanks,
Sam Reid

On Oct 1, 3:58 pm, "Michael Heuer" <heue...@gmail.com> wrote:
> Hello Sam,
>
> I say commit it, or create an issue if you would like to allow more comment.
>
> Whether or not there is an issue created, having an example in the
> examples project to demonstrate the benefits of this change would be
> cool.
>
>    michael
>
Reply all
Reply to author
Forward
0 new messages