Exemple #1
0
 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);
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 private X11Canvas(
     IntPtr display,
     int screenNum,
     X11ObjectCache objectCache,
     IntPtr visual,
     ulong colormap,
     IntPtr pictFormatPtr,
     ulong drawableId,
     ulong pictureId,
     IntPtr xftDraw
     )
 {
     this.display       = display;
     this.screenNum     = screenNum;
     this.objectCache   = objectCache;
     this.visual        = visual;
     this.colormap      = colormap;
     this.pictFormatPtr = pictFormatPtr;
     this.drawableId    = drawableId;
     this.pictureId     = pictureId;
     this.xftDraw       = xftDraw;
 }