2

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.

andyczerwonka
  • 4,230
  • 5
  • 34
  • 57

3 Answers3

5

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.

Ted Johnson
  • 4,315
  • 3
  • 29
  • 31
2

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.

mateuscb
  • 10,150
  • 3
  • 52
  • 76
derBiggi
  • 341
  • 1
  • 4
2

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

gc.setAdvanced(true)
nanda
  • 24,458
  • 13
  • 71
  • 90