Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » opaque figure/shape
opaque figure/shape [message #103412] Tue, 04 November 2003 13:44 Go to next message
Eclipse UserFriend
Originally posted by: nospam.gmx.net

This is a multi-part message in MIME format.

------=_NextPart_000_0084_01C3A2E2.1FE5FA60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello Group!

i have some problems with the "opaque"-ness of a figure.

As a figure for my editpart, i wrote a class extending rectangleFigure =
(which itselfs extends shape) and i override the method fillShape() with =
something like graphics.fillRectangle(....)
This works pretty fine, the rectangle appears in the background, =
although, it is not opaque but half-transparent.

The method isOpaque() of the class shape is implemented with "return =
false".
Overriding it with the code of the superclass Figure has no effect.

Anybody an idea of how to getting this figure opaque?

Thanx, Ingo
------=_NextPart_000_0084_01C3A2E2.1FE5FA60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4933.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello Group!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>i have some problems with the =
"opaque"-ness of a=20
figure.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>As a figure for my editpart,&nbsp;i =
wrote a class=20
</FONT><FONT face=3DArial size=3D2>extending=20
<U><STRONG>rectangleFigure</STRONG></U>&nbsp;(which itselfs extends=20
<STRONG>shape</STRONG>) and i override the </FONT><FONT face=3DArial =
size=3D2>method=20
<FONT size=3D2>fillShape() with something like&nbsp; g<FONT=20
size=3D2>raphics.fillRectangle(....)</FONT></FONT></FONT ></DIV>
<DIV><FONT face=3DArial size=3D2>This works pretty fine, the rectangle =
appears in=20
the background, although, it is not opaque but =
half-transparent.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The method isOpaque() of the&nbsp;class =

<STRONG>shape</STRONG>&nbsp;is implemented with&nbsp;"return=20
false".</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Overriding it with the code of the =
superclass=20
<STRONG>Figure</STRONG>&nbsp;has no effect.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Anybody an idea of&nbsp;how to getting =
this figure=20
opaque?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanx, Ingo</FONT></DIV></BODY></HTML>

------=_NextPart_000_0084_01C3A2E2.1FE5FA60--
Re: opaque figure/shape [message #103503 is a reply to message #103412] Wed, 05 November 2003 01:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

have you tried overriding it and returning true?


CL
Re: opaque figure/shape [message #103517 is a reply to message #103412] Wed, 05 November 2003 01:09 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
> As a figure for my editpart, i wrote a class extending rectangleFigure
(which itselfs extends shape)
> and i override the method fillShape() with something like
graphics.fillRectangle(....)

What exactly are you trying to do? How is your Figure similar to a Shape,
but different from a RectangleFigure? Can you tell us what exactly you are
doing in the overridden fillShape() method? I am sure you know that
fillShape() in RectangleFigure already does a
graphics.fillRectangle(getBounds()).

> This works pretty fine, the rectangle appears in the background, although,
it is not opaque but half-transparent.
> The method isOpaque() of the class shape is implemented with "return
false".
> Overriding it with the code of the superclass Figure has no effect.

You need to call setOpaque(true) to make the Figure opaque. This, however,
doesn't apply to Shapes, and I don't think it's the problem here. What
Color are you using as the background? And how do you set it? Do you
override any other methods, like paintFigure()? Can you provide a
screenshot to show what exactly you mean when you say half-transparent? You
don't have the XORs on by any chance, do you?

Pratik Shah
Re: opaque figure/shape [message #103572 is a reply to message #103517] Wed, 05 November 2003 07:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nospam.gmx.net

Hello,

q: have you tried overriding it and returning true?
a. i did, with no effect

q: What exactly are you trying to do? How is your Figure similar to a
Shape,
but different from a RectangleFigure? Can you tell us what exactly you
are
doing in the overridden fillShape() method? I am sure you know that
fillShape() in RectangleFigure already does a
graphics.fillRectangle(getBounds()).

a: yes i do know. the fillShape method does only this:
graphics.setBackgroundColor(bgColor);
graphics.setForegroundColor(bgColor);
graphics.fillRectangle(getBounds().getExpanded(-10,-10));

q:You need to call setOpaque(true) to make the Figure opaque. This,
however,
doesn't apply to Shapes,
a: As i mentioned, setOpaque has no effect... even when i override
isOpaque().
Why doesn
  • Attachment: opaque.jpg
    (Size: 7.71KB, Downloaded 109 times)
Re: opaque figure/shape [message #103586 is a reply to message #103572] Wed, 05 November 2003 07:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nospam.gmx.net

Ok, solved the problem.
The canvasfigure has caused the trouble!

Anyway, thanx for the replies!




<nospam@gmx.net> wrote in message news:boa8ai$a5c$1@eclipse.org...
> Hello,
>
> q: have you tried overriding it and returning true?
> a. i did, with no effect
>
> q: What exactly are you trying to do? How is your Figure similar to a
> Shape,
> but different from a RectangleFigure? Can you tell us what exactly
you
> are
> doing in the overridden fillShape() method? I am sure you know that
> fillShape() in RectangleFigure already does a
> graphics.fillRectangle(getBounds()).
>
> a: yes i do know. the fillShape method does only this:
> graphics.setBackgroundColor(bgColor);
> graphics.setForegroundColor(bgColor);
> graphics.fillRectangle(getBounds().getExpanded(-10,-10));
>
> q:You need to call setOpaque(true) to make the Figure opaque. This,
> however,
> doesn't apply to Shapes,
> a: As i mentioned, setOpaque has no effect... even when i override
> isOpaque().
> Why doesn
Re: opaque figure/shape [message #103761 is a reply to message #103586] Wed, 05 November 2003 22:17 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Can you post what the problem was and how you solved it? That way, anybody
else having a similar problem will know of something to lookout for.

Just as a suggestion, I don't think you need to override RectangleFigure to
do what you are doing (as far as I can tell from what you have posted so
far). You might want to try something like this instead:

IFigure rect = new RectangleFigure();
rect.setBorder(new MarginBorder(10));
rect.setBackgroundColor(ColorConstants.blue);
rect.setForegroundColor(ColorConstants.blue);

Pratik Shah

<nospam@gmx.net> wrote in message news:boa9b1$b03$1@eclipse.org...
> Ok, solved the problem.
> The canvasfigure has caused the trouble!
>
> Anyway, thanx for the replies!
>
>
>
>
> <nospam@gmx.net> wrote in message news:boa8ai$a5c$1@eclipse.org...
> > Hello,
> >
> > q: have you tried overriding it and returning true?
> > a. i did, with no effect
> >
> > q: What exactly are you trying to do? How is your Figure similar to a
> > Shape,
> > but different from a RectangleFigure? Can you tell us what exactly
> you
> > are
> > doing in the overridden fillShape() method? I am sure you know that
> > fillShape() in RectangleFigure already does a
> > graphics.fillRectangle(getBounds()).
> >
> > a: yes i do know. the fillShape method does only this:
> > graphics.setBackgroundColor(bgColor);
> > graphics.setForegroundColor(bgColor);
> > graphics.fillRectangle(getBounds().getExpanded(-10,-10));
> >
> > q:You need to call setOpaque(true) to make the Figure opaque. This,
> > however,
> > doesn't apply to Shapes,
> > a: As i mentioned, setOpaque has no effect... even when i override
> > isOpaque().
> > Why doesn
Previous Topic:ANN: GEF 2.1.2 Released
Next Topic:Copying, one way or another.
Goto Forum:
  


Current Time: Sat Oct 19 14:47:39 GMT 2024

Powered by FUDForum. Page generated in 0.04257 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top