public static X11Canvas CreateForDrawable( IntPtr display, int screenNum, X11ObjectCache objectCache, IntPtr visual, ulong colormap, IntPtr pictFormatPtr, ulong drawableId ) { const XRenderPictureAttributeMask attrMask = XRenderPictureAttributeMask.CPPolyEdge | XRenderPictureAttributeMask.CPPolyMode; XRenderPictureAttributes attr = new XRenderPictureAttributes { poly_edge = XRenderPolyEdge.Smooth, poly_mode = XRenderPolyMode.Imprecise }; ulong pictureId = LibXRender.XRenderCreatePicture ( display, drawableId, pictFormatPtr, attrMask, ref attr ); IntPtr xftDraw = IntPtr.Zero; X11Canvas canvas = null; try { xftDraw = LibXft.XftDrawCreate(display, drawableId, visual, colormap); canvas = new X11Canvas(display, screenNum, objectCache, visual, colormap, pictFormatPtr, drawableId, pictureId, xftDraw); xftDraw = IntPtr.Zero; } finally { if (canvas == null) { if (xftDraw != IntPtr.Zero) { LibXft.XftDrawDestroy(xftDraw); } LibXRender.XRenderFreePicture(display, pictureId); } } return(canvas); }
public void Dispose() { LibXft.XftDrawDestroy(xftDraw); LibXRender.XRenderFreePicture(display, pictureId); }