Skip to main content


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 12:15 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 43
Registered: July 2011
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 12:04 Go to previous messageGo to next message
Ivar Refsdal is currently offline Ivar RefsdalFriend
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 23:05 Go to previous message
Eclipse UserFriend
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: Tue Mar 19 03:47:01 GMT 2024

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

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

Back to the top