コード例 #1
0
        // ###############################################################################
        // ### C O N S T R U C T I O N   A N D   I N I T I A L I Z A T I O N
        // ###############################################################################

        #region Construction

        /// <summary>Initializing constructor.</summary>
        /// <param name="display">The display pointer, that specifies the connection to the X server.<see cref="System.IntPtr"/></param>
        /// <param name="screenNumber">The appropriate screen number on the host server.<see cref="System.Int32"/></param>
        /// <param name="colormap">The X11 colormap pointer.<see cref="IntPtr"/></param>
        /// <param name="graphicDepth">The depth (number of planes) of the graphic - that holds color pixel information.<see cref="System.Int32"/></para>
        /// <param name="width">The width of the image to create.<see cref="System.Int32"/></param>
        /// <param name="height">The height of the image to create.<see cref="System.Int32"/></param>
        public X11Image(IntPtr display, int screenNumber, IntPtr colormap, int graphicDepth, int width, int height)
        {
            if (display == IntPtr.Zero)
            {
                throw new ArgumentNullException("display");
            }
            if (colormap == IntPtr.Zero)
            {
                throw new ArgumentNullException("colormap");
            }

            IntPtr rootWindow = X11lib.XRootWindow(display, (X11.TInt)screenNumber);
            IntPtr rootVisual = X11lib.XDefaultVisual(display, (X11.TInt)screenNumber);

            if (rootVisual == IntPtr.Zero)
            {
                throw new NullReferenceException("rootVisual");
            }
            IntPtr imageXPixmap = X11lib.XCreatePixmap(display, rootWindow, (X11.TUint)width, (X11.TUint)height, (X11.TUint)graphicDepth);

            if (imageXPixmap == IntPtr.Zero)
            {
                throw new NullReferenceException("imageXPixmap");
            }

            _size.Width   = width;
            _size.Height  = height;
            _imageSurface = new X11Surface(display, screenNumber, imageXPixmap, rootVisual, graphicDepth, colormap);
        }
コード例 #2
0
 /// <summary>The initializing constructor.</summary>
 /// <param name="surface">The surface.<see cref="X11Surface"/></param>
 /// <param name="gc">The graphics context.<see cref="IntPtr"/></param>
 public X11Graphics(X11Surface surface, IntPtr gc)
 {
     _surface = surface;
     _gc      = gc;
 }