Problems with gradients in rounded rectangles [message #224030] |
Wed, 11 October 2006 10:03 |
Eclipse User |
|
|
|
Originally posted by: mateu.yabar.justinmind.com
Hi,
Im trying to draw a figure which is a roundedPanel that its background is a
gradient; there fore I'm reimplementing the paint methods.
I've tried to use the method fillGradient to fill the backround, but this
method can only use a rectangle, so the rounded corners will also be
painted.
Afterwards I have tried to use the method setBackgroundPattern but I'm
having much trubble. I hace tried the following:
But after using this all the drawings go crazy (among others, a lot of
figures are drawn using the gradient).
I've tried the following lines:
Pattern pattern=new Pattern(null, 150,0,300,0,ColorConstants.blue,
ColorConstants.yellow);
((SWTGraphics)graphics).setBackgroundPattern(pattern);
graphics.restoreState();
Which I spected to do nothing (the beckround pattern shold be the original)
but it continues drawing thins in gradient.
I'm using GEF 3.1.1.
Thanks
|
|
|
Re: Problems with gradients in rounded rectangles [message #224426 is a reply to message #224030] |
Mon, 16 October 2006 09:41 |
Xiang Qinxian Messages: 119 Registered: July 2009 |
Senior Member |
|
|
在 2006-10-11三的 12:03 +0200,Mateu Yábar Vallès写道:
> Hi,
>
> Im trying to draw a figure which is a roundedPanel that its background is a
> gradient; there fore I'm reimplementing the paint methods.
> I've tried to use the method fillGradient to fill the backround, but this
> method can only use a rectangle, so the rounded corners will also be
> painted.
> Afterwards I have tried to use the method setBackgroundPattern but I'm
> having much trubble. I hace tried the following:
>
>
> But after using this all the drawings go crazy (among others, a lot of
> figures are drawn using the gradient).
>
> I've tried the following lines:
> Pattern pattern=new Pattern(null, 150,0,300,0,ColorConstants.blue,
> ColorConstants.yellow);
> ((SWTGraphics)graphics).setBackgroundPattern(pattern);
> graphics.restoreState();
>
> Which I spected to do nothing (the beckround pattern shold be the original)
> but it continues drawing thins in gradient.
>
> I'm using GEF 3.1.1.
>
> Thanks
>
>
Hi,
You can refer to ajdt visualizer source code, which has a paint gradient
header way that could satisified your requirements.
Regards,
QinXian.
|
|
|
|
Re: Problems with gradients in rounded rectangles [message #225054 is a reply to message #224030] |
Tue, 24 October 2006 15:59 |
Eclipse User |
|
|
|
Originally posted by: none.ibm.com
If the gradient does not change too much, you can ignore the rounded areas
and only perform the gradient in the middle section.
There is a bug related to patterns in 3.1.x. There is also a workaround. I
think the bug was that we copied and pasted code and we were checking FG
instead of BG. Search bugzilla for the fix and a possible workaround.
However, advanced graphics support is much better in 3.2 version of SWT,
plus you get the GEF fix too.
"Mateu Y
|
|
|
Powered by
FUDForum. Page generated in 0.03302 seconds