Пример #1
0
        } // End Sub PerformanceTest

        public static void TestX11_Simple()
        {
            System.IntPtr display = LibX11Functions.XOpenDisplay(System.IntPtr.Zero);

            int defaultScreen = LibX11Functions.XDefaultScreen(display);

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

            int screen_width  = LibX11Functions.DisplayWidth(display, defaultScreen);
            int screen_height = LibX11Functions.DisplayHeight(display, defaultScreen);

            XWindowAttributes xa = new XWindowAttributes();

            LibX11Functions.XGetWindowAttributes(display, window, ref xa);
            System.Console.WriteLine(xa.width);
            System.Console.WriteLine(xa.height);

            int AllPlanes = ~0;

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

            /*
             * XImage* img = LibX11Functions.XGetImage2(display, window, 0, 0, (uint) xa.width, (uint)xa.height
             *  , AllPlanes2, LinScreen.ZPixmap);
             */


            // System.IntPtr image = LibX11Functions.XGetImage(display, window, 0, 0, (uint) xa.width, (uint)xa.height
            //     , AllPlanes2, LinScreen.ZPixmap);

            SafeX11.SlowScreenshot(display, window, 0, 0, (uint)xa.width, (uint)xa.height
                                   , AllPlanes2, LinScreen.ZPixmap, true);


            // XImage img = System.Runtime.InteropServices.Marshal.PtrToStructure<XImage>(image);


            // System.Console.WriteLine(img.bitmap_bit_order);
            // System.Console.WriteLine(img.bits_per_pixel);
            // System.Console.WriteLine(img.width);
            // System.Console.WriteLine(img.height);
            // System.Console.WriteLine(img.data);

            // // // // // //

            // System.Console.WriteLine(img->bitmap_bit_order);
            // System.Console.WriteLine(img->width);
            // System.Console.WriteLine(img->height);
            // System.Console.WriteLine(img->data);

            // rtaNetworking.Linux.tt.foo();

            // LibX11Functions.XDestroyImage2(img);


            LibX11Functions.XCloseDisplay(display);
        }
Пример #2
0
        public static System.Drawing.Size GetXorgScreenSize()
        {
            int screen_width  = 0;
            int screen_height = 0;

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

            if (display == System.IntPtr.Zero)
            {
                System.Console.WriteLine("Error: Failed on XOpenDisplay.\n");
            }
            else
            {
                int defaultScreen = LibX11Functions.XDefaultScreen(display);

                screen_width  = LibX11Functions.DisplayWidth(display, defaultScreen);
                screen_height = LibX11Functions.DisplayHeight(display, defaultScreen);

                LibX11Functions.XCloseDisplay(display);
                System.Console.WriteLine("Width: " + screen_width.ToString() + " Height: " + screen_height.ToString());
            } // End Else (display == System.IntPtr.Zero)

            return(new System.Drawing.Size(screen_width, screen_height));
        } // End Function GetXorgScreen