Esempio n. 1
0
        public static bool SetRgbaColormap(Widget w)
        {
            Gdk.Colormap cmap = GetRgbaColormap(w.Screen);

            if (cmap != null)
            {
                w.Colormap = cmap;
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public static Colormap GetRgbaColormap (Screen screen)
        {
            try {
                IntPtr raw_ret = gdk_screen_get_rgba_colormap (screen.Handle);
                Gdk.Colormap ret = GLib.Object.GetObject(raw_ret) as Gdk.Colormap;
                return ret;
            } catch {
                Gdk.Visual visual = Gdk.Visual.GetBestWithDepth (32);
                if (visual != null) {
                    Gdk.Colormap cmap = new Gdk.Colormap (visual, false);
                    return cmap;
                }
            }

            return null;
        }
Esempio n. 3
0
 public static Colormap GetRgbaColormap(Screen screen)
 {
     try {
         IntPtr       raw_ret = gdk_screen_get_rgba_colormap(screen.Handle);
         Gdk.Colormap ret     = GLib.Object.GetObject(raw_ret) as Gdk.Colormap;
         return(ret);
     } catch {
         Gdk.Visual visual = Gdk.Visual.GetBestWithDepth(32);
         if (visual != null)
         {
             Gdk.Colormap cmap = new Gdk.Colormap(visual, false);
             System.Console.WriteLine("fallback");
             return(cmap);
         }
     }
     return(null);
 }
Esempio n. 4
0
 public static Colormap GetRgbaColormap(Screen screen)
 {
     try {
         var raw_ret = gdk_screen_get_rgba_colormap(screen.Handle);
         var ret     = GLib.Object.GetObject(raw_ret) as Gdk.Colormap;
         return(ret);
     } catch {
         Gdk.Visual visual = Gdk.Visual.GetBestWithDepth(32);
         if (visual != null)
         {
             var cmap = new Gdk.Colormap(visual, false);
             Log.Debug("fallback");
             return(cmap);
         }
     }
     return(null);
 }
Esempio n. 5
0
        private void CheckScratchBuffers()
        {
            if (!this._ScratchBufferAllocated)
            {
                //Allocate a pixmap to be used for draw operations
                this._ScratchRenderBuffer    = new Gdk.Pixmap(null, this._Width, this._Height, Gdk.Visual.BestDepth);
                this._ScratchDisplayBuffer   = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, this._Width, this._Height);
                this._ScratchBufferAllocated = true;

                this._ScratchPenContext = new Gdk.GC(this._ScratchRenderBuffer);

                //Todo: This should be a property
                this._SelectionColor = new Gdk.Color(0xff, 0, 0);

                this._ScratchColorMap = Gdk.Colormap.System;

                this._ScratchColorMap.AllocColor(ref this._SelectionColor, true, true);

                this._ScratchPenContext.Foreground = this._SelectionColor;
            }
        }