Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problems with gradients in rounded rectangles
Problems with gradients in rounded rectangles [message #224030] Wed, 11 October 2006 10:03 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Xiang Qinxian is currently offline Xiang QinxianFriend
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 #224565 is a reply to message #224426] Tue, 17 October 2006 07:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mateu.yabar.justinmind.com

I'll look the source code.

Thanks!

"xiangqinxian" <fyaoxy@gmail.com> escribi
Re: Problems with gradients in rounded rectangles [message #225054 is a reply to message #224030] Tue, 24 October 2006 15:59 Go to previous message
Eclipse UserFriend
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
Previous Topic:To slow scrolling with ScrollPane
Next Topic:Question about connection. How can I do this?
Goto Forum:
  


Current Time: Thu Apr 25 21:09:48 GMT 2024

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

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

Back to the top