|
Re: [Zest] anti-aliasing for edges [message #714360 is a reply to message #697052] |
Wed, 10 August 2011 12:04 |
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 23:05 |
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.02186 seconds