public static X11Graphics Create(IntPtr display) { int defaultScreen = LibX11.XDefaultScreen(display); ulong defaultRootWindow = LibX11.XDefaultRootWindow(display); //todo: is is safe to keep pictFormatPtr after reading it into XRenderPictFormat IntPtr pictFormatPtr = LibXRender.XRenderFindStandardFormat(display, StandardPictFormat.PictStandardARGB32); if (pictFormatPtr == IntPtr.Zero) { throw new InvalidOperationException("Display does not support 32-bit ARGB."); } XRenderPictFormat pictFormat = Marshal.PtrToStructure <XRenderPictFormat>(pictFormatPtr); int status = LibX11.XMatchVisualInfo ( display, defaultScreen, pictFormat.depth, VisualClass.TrueColor, out XVisualInfo visualInfo ); if (status == 0) { throw new InvalidOperationException($"TrueColor visual with depth {pictFormat.depth} does not exist."); } ulong colorMap = LibX11.XCreateColormap(display, defaultRootWindow, visualInfo.visual, CreateColormapOption.AllocNone); return(new X11Graphics(display, defaultScreen, defaultRootWindow, visualInfo.visual, colorMap, pictFormat, pictFormatPtr)); }
public static extern void XRenderCompositeTrapezoids( DisplayPtr dpy, PictOp op, Picture src, Picture dst, [In] ref XRenderPictFormat maskFormat, int xSrc, int ySrc, [In] XTrapezoid[] traps, int ntrap );
private X11Graphics(IntPtr display, int screen, ulong rootWindow, IntPtr visual, ulong colorMap, XRenderPictFormat pictFormat, IntPtr pictFormatPtr) { this.display = display; this.screen = screen; this.rootWindow = rootWindow; this.visual = visual; this.colorMap = colorMap; this.pictFormat = pictFormat; this.pictFormatPtr = pictFormatPtr; this.objectCache = new X11ObjectCache(display, screen); }