IntPtr GetReversibleScreenGC (Color backColor)
{
XGCValues gc_values;
IntPtr gc;
uint pixel;
XColor xcolor = new XColor();
xcolor.red = (ushort)(backColor.R * 257);
xcolor.green = (ushort)(backColor.G * 257);
xcolor.blue = (ushort)(backColor.B * 257);
XAllocColor(DisplayHandle, DefaultColormap, ref xcolor);
pixel = (uint)xcolor.pixel.ToInt32();
gc_values = new XGCValues();
gc_values.subwindow_mode = GCSubwindowMode.IncludeInferiors;
gc_values.foreground = (IntPtr)pixel;
gc = XCreateGC(DisplayHandle, RootWindow, new IntPtr ((int) (GCFunction.GCSubwindowMode | GCFunction.GCForeground)), ref gc_values);
XSetForeground(DisplayHandle, gc, (UIntPtr)pixel);
XSetFunction(DisplayHandle, gc, GXFunction.GXxor);
return gc;
}