|
|
|
Re: how to fillGradient in shapes other than rectangle [message #157353 is a reply to message #157213] |
Tue, 09 November 2004 05:28 |
Pratik Shah 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 |
David Sciamma 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
>>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04184 seconds