Question

I've called gc.setAntialias(SWT.ON); and it does nothing. According to that method, it should work.

The Javadoc states:

Sets the receiver's anti-aliasing value to the parameter, which must be one of SWT.DEFAULT, SWT.OFF or SWT.ON.

It's not working for me, and I'm painting on a simple Canvas.

Was it helpful?

Solution

The following worked for me in an app I built and my guesses at when/how you have to do this.

So I created a new GC, set the Antialias as you did and then drew what I needed to with that gc object. The key is attaching it to the shell you will draw in.

GC gc = new GC(shell);
gc.setAntialias(SWT.ON); 
//then I attach to LightweightSystem for testing.
LightweightSystem lws = new LightweightSystem(shell);

Other than that make sure you do this before you draw anything. If you have to call it afterwards maybe try calling a repaint or redraw of the entire space.

Sorry without more information I am not sure exactly what is wrong.

OTHER TIPS

Following derBiggi's answer, you ca also force the advanced option to true.

gc.setAdvanced(true)

Also, if you're drawing labels, make sure you use gc.setTextAntialias( SWT.ON );

You can also check if gc.getAdvanced() returns true, it should after setAntialias() or setTextAntialias was set.

Besides from that it's pretty straight forward.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top