Beispiel #1
0
 public static extern Picture XRenderCreatePicture(
     DisplayPtr dpy,
     Drawable drawable,
     PictFormatPtr format,
     XRenderPictureAttributeMask valuemask,
     ref XRenderPictureAttributes attributes
     );
Beispiel #2
0
        public void DrawImage(INativeImage image, int x, int y)
        {
            x -= origin.X;
            y -= origin.Y;

            // todo: allow null?
            X11Image x11Image = (X11Image)image;

            XRenderPictureAttributes attr = new XRenderPictureAttributes();
            var tempPictureId             = LibXRender.XRenderCreatePicture(display, x11Image.PixmapId, pictFormatPtr, 0, ref attr);

            try
            {
                LibXRender.XRenderComposite
                (
                    display,
                    PictOp.PictOpOver,
                    tempPictureId,
                    0,
                    pictureId,
                    0, 0,
                    0, 0,
                    x, y,
                    (uint)x11Image.Width, (uint)x11Image.Height
                );
            }
            finally
            {
                LibXRender.XRenderFreePicture(display, tempPictureId);
            }
        }
Beispiel #3
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);
        }