示例#1
0
 public static Colormap DefaultColormapOfScreen(Screen *screen)
 {
     return(screen->cmap);
 }
示例#2
0
 public static int DefaultDepthOfScreen(Screen *s) => s->root_depth;
示例#3
0
 public static Visual *DefaultVisualOfScreen(Screen *s) => s->root_visual;
示例#4
0
 public static Window RootWindowOfScreen(Screen *s) => s->root;
示例#5
0
 public static nuint WhitePixelOfScreen(Screen *s) => s->white_pixel;
示例#6
0
 public static int DoesSaveUnders(Screen *s) => s->save_unders;
示例#7
0
 public static IntPtr EventMaskOfScreen(Screen *s) => s->root_input_mask;
示例#8
0
文件: Xrandr.cs 项目: bostich83/axiom
 XRRScreenConfiguration *XRRConfig(Screen *screen);
示例#9
0
        private static unsafe byte[] UnsafeX11ScreenshotWithCursor(bool withCursor)
        {
            byte[] result = null;


            int AllPlanes = ~0;

            System.UIntPtr AllPlanes2 = new System.UIntPtr((uint)AllPlanes);


            System.IntPtr display = LibX11Functions.XOpenDisplay(System.IntPtr.Zero);

            int defaultScreen = LibX11Functions.XDefaultScreen(display);

            System.UIntPtr    window = LibX11Functions.XRootWindow(display, defaultScreen);
            XWindowAttributes xa     = new XWindowAttributes();

            LibX11Functions.XGetWindowAttributes(display, window, ref xa);
            Screen *screen = xa.screen; // struct screen

            XShmSegmentInfo shminfo = new XShmSegmentInfo();


            XImage *ximg = LibXExt.XShmCreateImage(display, LibXExt.DefaultVisualOfScreen(screen)
                                                   , (uint)LibXExt.DefaultDepthOfScreen(screen), LinScreen.ZPixmap
                                                   , System.IntPtr.Zero, ref shminfo, (uint)xa.width, (uint)xa.height);

            shminfo.shmid   = LibC.shmget(LibC.IPC_PRIVATE, new System.IntPtr(ximg->bytes_per_line * ximg->height), LibC.IPC_CREAT | 0777);
            ximg->data      = (sbyte *)LibC.shmat(shminfo.shmid, System.IntPtr.Zero, 0);
            shminfo.shmaddr = (System.IntPtr)ximg->data;

            shminfo.readOnly = 0;

            if (shminfo.shmid < 0)
            {
                System.Console.WriteLine("Fatal shminfo error!");
            }

            int s1 = LibXExt.XShmAttach(display, ref shminfo);
            // System.Console.WriteLine("XShmAttach() {0}\n", s1 != 0 ? "success!" : "failure!");

            int res = LibXExt.XShmGetImage(display, window, ximg, 0, 0, AllPlanes2);

            // const char *filename = "/tmp/test.bmp";
            // WriteBitmapToFile(filename, (int) ximg->bits_per_pixel, (int)window_attributes.width, (int)window_attributes.height, (const void*) ximg->data);
            int bytesPerPixel = (ximg->bits_per_pixel + 7) / 8;
            int stride        = 4 * ((ximg->width * bytesPerPixel + 3) / 4);

            // long size = ximg->height * stride;
            // byte[] managedArray = new byte[size];
            // Marshal.Copy((IntPtr)(ximg->data), managedArray, 0, (int)size);
            // System.Console.WriteLine(managedArray);

            if (withCursor)
            {
                PaintMousePointer(display, ximg);
            } // End if (withCursor)


            using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ximg->width, ximg->height, stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, (System.IntPtr)ximg->data))
            {
                // bmp.Save("/tmp/shtest.bmp");
#if false
                // ZERO compression at all !

                // using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
                // {
                //     bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                //     result = ms.ToArray();
                // } // End Using ms
#else
                result = CompressImage(bmp, 25);
#endif
            } // End Using bmp

            LibX11Functions.XDestroyImage2(ximg);
            LibXExt.XShmDetach(display, ref shminfo);
            LibC.shmdt(shminfo.shmaddr);

            LibX11Functions.XCloseDisplay(display);

            return(result);
        } // End Function UnsafeX11ScreenshotWithCursor
示例#10
0
 public static extern int XWidthMMOfScreen(
     [In] Screen *screen
     );
示例#11
0
 public static GC DefaultGCOfScreen(Screen *screen)
 {
     return(screen->default_gc);
 }
示例#12
0
 public static extern UIntPtr XWhitePixelOfScreen(
     [In] Screen *screen
     );
示例#13
0
 public static extern Window XRootWindowOfScreen(
     [In] Screen *screen
     );
示例#14
0
 public static extern int XPlanesOfScreen(
     [In] Screen *screen
     );
示例#15
0
 public static int MinCmapsOfScreen(Screen *s) => s->min_maps;
示例#16
0
        // XImage* ximg = XShmCreateImage(display, DefaultVisualOfScreen(screen), DefaultDepthOfScreen(screen)
        // , ZPixmap, NULL, &shminfo, window_attributes.width, window_attributes.height);
        // XImage *XShmCreateImage(Display* /* dpy */, Visual* /* visual */, unsigned int /* depth */,
        // int /* format */,char* /* data */, XShmSegmentInfo*	/* shminfo */, unsigned int	/* width */, unsigned int	/* height */ );



        public static unsafe Visual *DefaultVisualOfScreen(Screen *screen)
        {
            return(screen->root_visual);
        }
示例#17
0
 public static int MaxCmapsOfScreen(Screen *s) => s->max_maps;
示例#18
0
 public static unsafe int DefaultDepthOfScreen(Screen *screen)
 {
     return(screen->root_depth);
 }
示例#19
0
 public static int DoesBackingStore(Screen *s) => s->backing_store;
示例#20
0
 public static int HeightOfScreen(Screen *s) => s->height;
示例#21
0
 public static Display *DisplayOfScreen(Screen *s) => s->display;
示例#22
0
 public static int WidthMMOfScreen(Screen *s) => s->mwidth;
示例#23
0
 public static nuint BlackPixelOfScreen(Screen *s) => s->black_pixel;
示例#24
0
 public static int HeightMMOfScreen(Screen *s) => s->mheight;
示例#25
0
 public static Colormap DefaultColormapOfScreen(Screen *s) => s->cmap;
示例#26
0
 public static int PlanesOfScreen(Screen *s) => s->root_depth;
示例#27
0
 public static GC DefaultGCOfScreen(Screen *s) => s->default_gc;
示例#28
0
 public static int CellsOfScreen(Screen *s) => DefaultVisualOfScreen(s)->map_entries;
示例#29
0
 public static int WidthOfScreen(Screen *s) => s->width;
示例#30
0
 public static extern int XMinCmapsOfScreen(
     [In] Screen *screen
     );