Draw2D Transparency [message #233493] |
Wed, 25 April 2007 21:53 |
Eclipse User |
|
|
|
Originally posted by: asanh.ll.mit.edu
Hello,
I am implementing an RCP application. In an implementation of the RCP
ViewPart, I create a Canvas. I then draw an image on the Canvas (JPEG
loaded from an external file.). I would like to use a Draw2D Ellipse to
highlight a part of the image. So I tried to do the following after the
image is drawn in createPartControl():
LightweightSystem lws = new LightweightSystem(imageCanvas);
IFigure panel = new Figure();
lws.setContents(panel);
Shape ellipse = new Ellipse();
ellipse.setSize(20, 40);
panel.add(ellipse);
panel.setOpaque(false);
When I test the code, I get an area of grey with an ellipse, but I cannot
see my image. When I scroll the window, however, I can see my image
flickering beneath the area of grey with the ellipse. So the pieces are
all there. The Draw2D piece is just not transparent so that the image can
also be seen.
As I am new to RCP and SWT, I would appreciate some guidance as to what I
am doing incorrectly and what I should be doing instead.
Many thanks for your help.
Ai-Hoa Sanh
|
|
|
|
Re: Draw2D Transparency [message #233726 is a reply to message #233511] |
Tue, 01 May 2007 14:54 |
Eclipse User |
|
|
|
Originally posted by: asanh.ll.mit.edu.
Sorry. I should provide more details.
I created the imageCanvas with SWT.NOBACKGROUND. I then rendered an image
on the canvas using GC.drawImage().
I now would like to overlay an ellipse on the image on the same canvas.
The behaviour I see is as if another canvas is created with my ellipse and
laid on top of the canvas with my image. I see my ellipse on a background
of gray. The image is not showing through. Only when I use the scroll bar
do I see the image repainting underneath the gray background. But when I
stop scrolling, the gray remains, and my image is no longer seen.
Thanks.
Ai-Hoa
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04769 seconds