Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest] anti-aliasing for edges
[Zest] anti-aliasing for edges [message #697052] Fri, 15 July 2011 08:15 Go to next message
Watabe Kichi is currently offline Watabe Kichi
Messages: 12
Registered: July 2011
Junior Member
Hi,

I'm new to GEF Zest.

Is there any way to use anti-aliasing for edges?

Best regards
Re: [Zest] anti-aliasing for edges [message #714360 is a reply to message #697052] Wed, 10 August 2011 08:04 Go to previous messageGo to next message
Ivar Refsdal is currently offline Ivar Refsdal
Messages: 24
Registered: May 2011
Junior Member
Hi.

I'm also new to Zest. Here is my solution to the problem:

> viewer = new GraphViewer(parent, SWT.NONE);

(normal setup here... content provider etc.)

> Listener[] listeners = viewer.getControl().getListeners(SWT.Paint);
> for (int i=0; i<listeners.length; i++) {
> viewer.getControl().removeListener(SWT.Paint, listeners[i]);
> }
>
> viewer.getControl().addListener(SWT.Paint, new Listener() {
> @Override
> public void handleEvent(Event event) {
> event.gc.setAntialias(SWT.ON);
> event.gc.setTextAntialias(SWT.ON);
> }
> });
>
> for (int i=0; i<listeners.length; i++) {
> viewer.getControl().addListener(SWT.Paint, listeners[i]);
> }

Obviously this is a hack and should be supported in a different way.
One needs to remove the listeners first in order to be the first one in
the listener list, and then add them back later so actual painting is done.
This was the only solution I found not using code duplication / editing
draw2d/zest classes... Anyone has a better way?

Hope this helps,
Best,
Ivar

forums-noreply@eclipse.org wrote, on 07/15/2011 02:15 PM:
> Hi,
>
> I'm new to GEF Zest.
>
> Is there any way to use anti-aliasing for edges?
>
> Best regards
Re: [Zest] anti-aliasing for edges [message #769926 is a reply to message #714360] Thu, 22 December 2011 18:05 Go to previous message
Eclipse User
This is a very good solution. I applied this code to my FigureCanvas
since I am not using Zest. Works very well, but does the API support a
simpler way of setting this?

Mircea

On 10/08/2011 08:04, Ivar Refsdal wrote:
> Hi.
>
> I'm also new to Zest. Here is my solution to the problem:
>
>> viewer = new GraphViewer(parent, SWT.NONE);
>
> (normal setup here... content provider etc.)
>
>> Listener[] listeners =
>> viewer.getControl().getListeners(SWT.Paint);
>> for (int i=0; i<listeners.length; i++) {
>> viewer.getControl().removeListener(SWT.Paint, listeners[i]);
>> }
>>
>> viewer.getControl().addListener(SWT.Paint, new Listener() {
>> @Override
>> public void handleEvent(Event event) {
>> event.gc.setAntialias(SWT.ON);
>> event.gc.setTextAntialias(SWT.ON);
>> }
>> });
>>
>> for (int i=0; i<listeners.length; i++) {
>> viewer.getControl().addListener(SWT.Paint, listeners[i]);
>> }
>
> Obviously this is a hack and should be supported in a different way.
> One needs to remove the listeners first in order to be the first one
> in the listener list, and then add them back later so actual painting
> is done.
> This was the only solution I found not using code duplication / editing
> draw2d/zest classes... Anyone has a better way?
>
> Hope this helps,
> Best,
> Ivar
>
> forums-noreply@eclipse.org wrote, on 07/15/2011 02:15 PM:
>> Hi,
>>
>> I'm new to GEF Zest.
>>
>> Is there any way to use anti-aliasing for edges?
>>
>> Best regards
>
Previous Topic:GEF Help
Next Topic:Scrolling text in ScrollPane vertically
Goto Forum:
  


Current Time: Sat Aug 23 05:44:56 EDT 2014

Powered by FUDForum. Page generated in 0.01781 seconds