예제 #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
     );