示例#1
0
 public static void setBackgroundImage(Gtk.Window win, Gdk.Pixbuf image)
 {
     Gdk.Pixmap pixmap, pixmap_mask;
     image.RenderPixmapAndMask( out pixmap, out pixmap_mask, 255 );
     var style = win.Style;
     style.SetBgPixmap (StateType.Normal, pixmap);
     win.Style = style;
 }
示例#2
0
 public static void SetWindowShapeFromPixbuf(Gtk.Window w, Gdk.Pixbuf pixbuf)
 {
     Pixmap pixmap, pixmask;
     pixbuf.RenderPixmapAndMask (out pixmap, out pixmask, 1);
     w.ShapeCombineMask (pixmask, 0, 0);
 }
        // ============================================
        // PRIVATE Methods
        // ============================================
        private void InitializeWindow(Gdk.Pixbuf pixbuf)
        {
            // Realize Window
            this.Realize();

            // Set Window Options
            this.Decorated = false;
            this.Resizable = false;
            this.AppPaintable = true;
            this.SetSizeRequest(pixbuf.Width, pixbuf.Height);
            this.SetDefaultSize(pixbuf.Width, pixbuf.Height);

            // Initialize GUI Shape
            Gdk.Pixmap maskBitmapWindow;
            pixbuf.RenderPixmapAndMask (out this.maskPixmapWindow,
                                        out maskBitmapWindow, 128);
            this.Events = Gdk.EventMask.AllEventsMask;
            this.ShapeCombineMask(maskBitmapWindow, 0, 0);

            // Set Back Pixmap
            GdkWindow.SetBackPixmap(this.maskPixmapWindow, false);
            GdkWindow.Clear();

            // Window Expose Event
            this.ExposeEvent += new ExposeEventHandler(OnWindowExpose);
        }