public static Colormap DefaultColormapOfScreen(Screen *screen) { return(screen->cmap); }
public static int DefaultDepthOfScreen(Screen *s) => s->root_depth;
public static Visual *DefaultVisualOfScreen(Screen *s) => s->root_visual;
public static Window RootWindowOfScreen(Screen *s) => s->root;
public static nuint WhitePixelOfScreen(Screen *s) => s->white_pixel;
public static int DoesSaveUnders(Screen *s) => s->save_unders;
public static IntPtr EventMaskOfScreen(Screen *s) => s->root_input_mask;
XRRScreenConfiguration *XRRConfig(Screen *screen);
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
public static extern int XWidthMMOfScreen( [In] Screen *screen );
public static GC DefaultGCOfScreen(Screen *screen) { return(screen->default_gc); }
public static extern UIntPtr XWhitePixelOfScreen( [In] Screen *screen );
public static extern Window XRootWindowOfScreen( [In] Screen *screen );
public static extern int XPlanesOfScreen( [In] Screen *screen );
public static int MinCmapsOfScreen(Screen *s) => s->min_maps;
// 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); }
public static int MaxCmapsOfScreen(Screen *s) => s->max_maps;
public static unsafe int DefaultDepthOfScreen(Screen *screen) { return(screen->root_depth); }
public static int DoesBackingStore(Screen *s) => s->backing_store;
public static int HeightOfScreen(Screen *s) => s->height;
public static Display *DisplayOfScreen(Screen *s) => s->display;
public static int WidthMMOfScreen(Screen *s) => s->mwidth;
public static nuint BlackPixelOfScreen(Screen *s) => s->black_pixel;
public static int HeightMMOfScreen(Screen *s) => s->mheight;
public static Colormap DefaultColormapOfScreen(Screen *s) => s->cmap;
public static int PlanesOfScreen(Screen *s) => s->root_depth;
public static GC DefaultGCOfScreen(Screen *s) => s->default_gc;
public static int CellsOfScreen(Screen *s) => DefaultVisualOfScreen(s)->map_entries;
public static int WidthOfScreen(Screen *s) => s->width;
public static extern int XMinCmapsOfScreen( [In] Screen *screen );