Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » how to fillGradient in shapes other than rectangle
how to fillGradient in shapes other than rectangle [message #157204] Mon, 08 November 2004 10:59 Go to next message
Kate HI Lin is currently offline Kate HI LinFriend
Messages: 3
Registered: July 2009
Junior Member
How can I fillGradient in shapes, such as Ellipse?

I've tried
Ellipse circle = new Ellipse(){
public void paintFigure(Graphics g){

};
Re: how to fillGradient in shapes other than rectangle [message #157213 is a reply to message #157204] Mon, 08 November 2004 11:05 Go to previous messageGo to next message
Kate HI Lin is currently offline Kate HI LinFriend
Messages: 3
Registered: July 2009
Junior Member
How can I fillGradient in shapes, such as Ellipse, Polygon?

I've tried
Ellipse circle = new Ellipse(){
public void paintFigure(Graphics g){
g.fillGradient(0,0,100,100, true);
};

but it turns out a rectangle figure filled gradient and the ellipse is
gone.

Is there any way I can fill a shape other than rectangle with gradient
color?

thanks in advance

Kate
Re: how to fillGradient in shapes other than rectangle [message #157230 is a reply to message #157204] Mon, 08 November 2004 12:50 Go to previous messageGo to next message
Alex Selkov is currently offline Alex SelkovFriend
Messages: 73
Registered: July 2009
Member
AFAIK only GC#fillGradientRectangle supported by SWT. Seems that if you want
advanced features then you need to implement more advanced GC first. You may
also look at http://www.holongate.org/ - seems that such pulg-in may help.

Regards,

as

"Kate" <katelin@tw.ibm.com> ???????/???????? ? ???????? ?????????:
news:cmnji2$f3h$1@eclipse.org...
> How can I fillGradient in shapes, such as Ellipse?
> I've tried
> Ellipse circle = new Ellipse(){
> public void paintFigure(Graphics g){
>
> };
>
>
Re: how to fillGradient in shapes other than rectangle [message #157353 is a reply to message #157213] Tue, 09 November 2004 05:28 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Hmm, that's a good question. You might want to try the platform newsgroup
and find out if there's a way to do that with GC. Our Graphics object
delegates to GC, so if you can do it with GC's public methods, you should be
able to do the same with Graphics. However, it doesn't seem like you can do
that.

BTW, with a Shape (such as Ellipse), you shouldn't override paintFigure().
Instead override fillShape() and outlineShape() as needed.

"Kate" <katelin@tw.ibm.com> wrote in message
news:cmnjtf$ihm$1@eclipse.org...
> How can I fillGradient in shapes, such as Ellipse, Polygon?
>
> I've tried
> Ellipse circle = new Ellipse(){
> public void paintFigure(Graphics g){
> g.fillGradient(0,0,100,100, true);
> };
>
> but it turns out a rectangle figure filled gradient and the ellipse is
> gone.
>
> Is there any way I can fill a shape other than rectangle with gradient
> color?
>
> thanks in advance
>
> Kate
>
Re: how to fillGradient in shapes other than rectangle [message #157375 is a reply to message #157353] Tue, 09 November 2004 07:30 Go to previous message
David Sciamma is currently offline David SciammaFriend
Messages: 78
Registered: July 2009
Member
Hi,

Perhaps, you could use clipping before painting the bounding rectangle...

David

Pratik Shah wrote:
> Hmm, that's a good question. You might want to try the platform newsgroup
> and find out if there's a way to do that with GC. Our Graphics object
> delegates to GC, so if you can do it with GC's public methods, you should be
> able to do the same with Graphics. However, it doesn't seem like you can do
> that.
>
> BTW, with a Shape (such as Ellipse), you shouldn't override paintFigure().
> Instead override fillShape() and outlineShape() as needed.
>
> "Kate" <katelin@tw.ibm.com> wrote in message
> news:cmnjtf$ihm$1@eclipse.org...
>
>>How can I fillGradient in shapes, such as Ellipse, Polygon?
>>
>>I've tried
>> Ellipse circle = new Ellipse(){
>> public void paintFigure(Graphics g){
>> g.fillGradient(0,0,100,100, true);
>> };
>>
>>but it turns out a rectangle figure filled gradient and the ellipse is
>>gone.
>>
>>Is there any way I can fill a shape other than rectangle with gradient
>>color?
>>
>>thanks in advance
>>
>>Kate
>>
>
>
>
Previous Topic:Rounding errors in figure drawing
Next Topic:Creating connections - help
Goto Forum:
  


Current Time: Sat Apr 27 00:36:54 GMT 2024

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

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

Back to the top