11011110110011011001100110011001000110011001100111010001011

March 26, 2007

Advance Graphics Mode in SWT.GC

Filed under: Programming

In KEmulator 0.7.7, I add rotation control to the Canvas, but it results in bugs on Infos Show!

1. the XOR Pen is disabled.
2. gc.drawRectangle with negative width/height has no efffect.

finally, i find out the reason — the advanced graphics subsystem of GC.

Normally, we can use GC.setAdvanced(boolean advanced) to switched into advanced mode. but the advanced graphics subsystem is invoked automatically when any one of the alpha, antialias, patterns, interpolation, paths, clipping or transformation operations in the receiver is requested. Refer to follows:

setAlpha setAntialias setBackgroundPattern setClipping(Path) setForegroundPattern setInterpolation setTextAntialias setTransform

So, before the Infos painting(drawRectangle/XOR ), use GC.setAdvanced(false) to return normal graphics subsystem.

 (the XOR rect comes back!)