Beispiel #1
0
    public static Cairo.Surface SetUp(Gdk.Drawable gdk_drawable)
    {
        IntPtr x_drawable = gdk_drawable.Handle;
        IntPtr dpy        = gdk_x11_drawable_get_xdisplay(x_drawable);
        int    scr        = 0;

        IntPtr visual    = gdk_drawable_get_visual(x_drawable);
        IntPtr Xvisual   = gdk_x11_visual_get_xvisual(visual);
        uint   XvisualID = XVisualIDFromVisual(Xvisual);

        Console.WriteLine("XvisID: " + XvisualID);


        IntPtr fmt = GlitzAPI.glitz_glx_find_drawable_format_for_visual(dpy, scr, XvisualID);

        Console.WriteLine("fmt: " + fmt);

        //IntPtr Xdrawable = gdk_x11_drawable_get_xid (x_drawable);
        uint win = gdk_x11_drawable_get_xid(x_drawable);
        uint w = 100, h = 100;

        IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window(dpy, scr, fmt, win, w, h);

        //NDesk.Glitz.Drawable ggd = new NDesk.Glitz.Drawable (glitz_drawable);
        ggd = new NDesk.Glitz.Drawable(glitz_drawable);

        IntPtr glitz_format   = ggd.FindStandardFormat(FormatName.ARGB32);

        ggs = new NDesk.Glitz.Surface(ggd, glitz_format, 100, 100, 0, IntPtr.Zero);
        Console.WriteLine(ggd.Features);
        ggs.Attach(ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor);

        //GlitzAPI.glitz_drawable_destroy (glitz_drawable);

        GlitzSurface gs = new GlitzSurface(ggs.Handle);

        //GlitzSurface gs = null;

        return(gs);
    }
Beispiel #2
0
    public static Cairo.Surface Realize(Widget widget)
    {
        IntPtr dpy = gdk_x11_get_default_xdisplay();
        int    scr = gdk_x11_get_default_screen();

        DrawableFormat template = new DrawableFormat();

        template.Color = new ColorFormat();
        FormatMask mask = FormatMask.None;
        //template.Doublebuffer = doublebuffer;
        //mask |= FormatMask.Doublebuffer;
        IntPtr dformat = GlitzAPI.glitz_glx_find_window_format(dpy, scr, mask, ref template, 0);

        if (dformat == IntPtr.Zero)
        {
            throw new Exception("Could not find a usable GL visual");
        }

        IntPtr vinfo = GlitzAPI.glitz_glx_get_visual_info_from_format(dpy, scr, dformat);

        widget.DoubleBuffered = false;

        Gdk.WindowAttr attributes = new Gdk.WindowAttr();
        attributes.Mask = widget.Events |
                          (Gdk.EventMask.ExposureMask |
                           Gdk.EventMask.KeyPressMask |
                           Gdk.EventMask.KeyReleaseMask |
                           Gdk.EventMask.EnterNotifyMask |
                           Gdk.EventMask.LeaveNotifyMask |
                           Gdk.EventMask.StructureMask);
        //attributes.X = widget.Allocation.X;
        //attributes.Y = widget.Allocation.Y;
        attributes.X          = 0;
        attributes.Y          = 0;
        attributes.Width      = 100;
        attributes.Height     = 100;
        attributes.Wclass     = Gdk.WindowClass.InputOutput;
        attributes.Visual     = new Gdk.Visual(gdkx_visual_get(XVisualIDFromVisual(vinfo)));
        attributes.Colormap   = new Gdk.Colormap(attributes.Visual, true);
        attributes.WindowType = Gdk.WindowType.Child;
        Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap;

        widget.GdkWindow          = new Gdk.Window(widget.ParentWindow, attributes, attributes_mask);
        widget.GdkWindow.UserData = widget.Handle;
        uint xid = gdk_x11_drawable_get_xid(widget.GdkWindow.Handle);

        attributes.Width  = 100;
        attributes.Height = 100;

        IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window(dpy, scr, dformat, xid, (uint)attributes.Width, (uint)attributes.Height);

        ggd = new NDesk.Glitz.Drawable(glitz_drawable);

        IntPtr glitz_format = ggd.FindStandardFormat(FormatName.ARGB32);

        ggs = new NDesk.Glitz.Surface(ggd, glitz_format, (uint)attributes.Width, (uint)attributes.Height, 0, IntPtr.Zero);
        Console.WriteLine(ggd.Features);
        ggs.Attach(ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor);

        //GlitzAPI.glitz_drawable_destroy (glitz_drawable);

        GlitzSurface gs = new GlitzSurface(ggs.Handle);

        return(gs);
    }
		public TextureObject (Surface surface)
		{
			Handle = GlitzAPI.glitz_texture_object_create (surface.Handle);
			GlitzAPI.glitz_texture_object_reference (Handle);
		}
		public static void CopyArea (int op, Surface src, Surface dst, int x_src, int y_src, int width, int height, int x_dst, int y_dst)
		{
			GlitzAPI.glitz_copy_area (src.Handle, dst.Handle, x_src, y_src, width, height, x_dst, y_dst);
		}
		public static void Composite (Operator op, Surface src, Surface mask, Surface dst, int x_src, int y_src, int x_mask, int y_mask, int x_dst, int y_dst, int width, int height)
		{
			GlitzAPI.glitz_composite (op, src.Handle, mask.Handle, dst.Handle, x_src, y_src, x_mask, y_mask, x_dst, y_dst, width, height);
		}
	public static Cairo.Surface SetUp (Gdk.Drawable gdk_drawable)
	{
		IntPtr x_drawable = gdk_drawable.Handle;
		IntPtr dpy = gdk_x11_drawable_get_xdisplay(x_drawable);
		int scr = 0;

		IntPtr visual = gdk_drawable_get_visual(x_drawable);
		IntPtr Xvisual = gdk_x11_visual_get_xvisual(visual);
		uint XvisualID = XVisualIDFromVisual (Xvisual);

		Console.WriteLine ("XvisID: " + XvisualID);


		IntPtr fmt = GlitzAPI.glitz_glx_find_drawable_format_for_visual (dpy, scr, XvisualID);

		Console.WriteLine ("fmt: " + fmt);

		//IntPtr Xdrawable = gdk_x11_drawable_get_xid (x_drawable);
		uint win = gdk_x11_drawable_get_xid (x_drawable);
		uint w = 100, h = 100;

		IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window (dpy, scr, fmt, win, w, h);
		//NDesk.Glitz.Drawable ggd = new NDesk.Glitz.Drawable (glitz_drawable);
		ggd = new NDesk.Glitz.Drawable (glitz_drawable);

		IntPtr glitz_format = ggd.FindStandardFormat (FormatName.ARGB32);

		ggs = new NDesk.Glitz.Surface (ggd, glitz_format, 100, 100, 0, IntPtr.Zero);
		Console.WriteLine (ggd.Features);
		ggs.Attach (ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor);

		//GlitzAPI.glitz_drawable_destroy (glitz_drawable);

		GlitzSurface gs = new GlitzSurface (ggs.Handle);
		//GlitzSurface gs = null;

		return gs;
	}
	public static Cairo.Surface Realize (Widget widget)
	{
		IntPtr dpy = gdk_x11_get_default_xdisplay ();
		int scr = gdk_x11_get_default_screen ();

		DrawableFormat template = new DrawableFormat ();
		template.Color = new ColorFormat ();
		FormatMask mask = FormatMask.None;
		//template.Doublebuffer = doublebuffer;
		//mask |= FormatMask.Doublebuffer;
		IntPtr dformat = GlitzAPI.glitz_glx_find_window_format (dpy, scr, mask, ref template, 0);

		if (dformat == IntPtr.Zero)
			throw new Exception ("Could not find a usable GL visual");

		IntPtr vinfo = GlitzAPI.glitz_glx_get_visual_info_from_format (dpy, scr, dformat);
		widget.DoubleBuffered = false;

		Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
				attributes.Mask = widget.Events  |
			     (Gdk.EventMask.ExposureMask |
			      Gdk.EventMask.KeyPressMask |
			      Gdk.EventMask.KeyReleaseMask |
			      Gdk.EventMask.EnterNotifyMask |
			      Gdk.EventMask.LeaveNotifyMask |
			      Gdk.EventMask.StructureMask);
				//attributes.X = widget.Allocation.X;
				//attributes.Y = widget.Allocation.Y;
				attributes.X = 0;
				attributes.Y = 0;
				attributes.Width = 100;
				attributes.Height = 100;
		attributes.Wclass = Gdk.WindowClass.InputOutput;
		attributes.Visual = new Gdk.Visual (gdkx_visual_get (XVisualIDFromVisual (vinfo)));
		attributes.Colormap = new Gdk.Colormap (attributes.Visual, true);
		attributes.WindowType = Gdk.WindowType.Child;
		Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap;

		widget.GdkWindow = new Gdk.Window (widget.ParentWindow, attributes, attributes_mask);
		widget.GdkWindow.UserData = widget.Handle;
		uint xid = gdk_x11_drawable_get_xid (widget.GdkWindow.Handle);

		attributes.Width = 100;
		attributes.Height = 100;

		IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window (dpy, scr, dformat, xid, (uint)attributes.Width, (uint)attributes.Height);
		ggd = new NDesk.Glitz.Drawable (glitz_drawable);

		IntPtr glitz_format = ggd.FindStandardFormat (FormatName.ARGB32);

		ggs = new NDesk.Glitz.Surface (ggd, glitz_format, (uint)attributes.Width, (uint)attributes.Height, 0, IntPtr.Zero);
		Console.WriteLine (ggd.Features);
		ggs.Attach (ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor);

		//GlitzAPI.glitz_drawable_destroy (glitz_drawable);

		GlitzSurface gs = new GlitzSurface (ggs.Handle);

		return gs;
	}