当前位置: 首页>>代码示例>>C#>>正文


C# Gdk.Pixbuf.RenderPixmapAndMask方法代码示例

本文整理汇总了C#中Gdk.Pixbuf.RenderPixmapAndMask方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Pixbuf.RenderPixmapAndMask方法的具体用法?C# Gdk.Pixbuf.RenderPixmapAndMask怎么用?C# Gdk.Pixbuf.RenderPixmapAndMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdk.Pixbuf的用法示例。


在下文中一共展示了Gdk.Pixbuf.RenderPixmapAndMask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ModifyWindowShape

 /// <summary>
 /// this function modifies a window shape
 /// </summary>
 /// <param name="bmp">
 /// the bitmap that has the shape of the window. <see cref="System.Drawing.Bitmap"/>
 /// </param>
 /// <param name="window">
 /// the window to apply the shape change <see cref="Gtk.Window"/>
 /// </param>
 /// <returns>
 /// true if it succeded, either return false <see cref="System.Boolean"/>
 /// </returns>
 public static bool ModifyWindowShape( System.Drawing.Bitmap bmp, Gtk.Window window )
 {
     bool ret = false;
     try
     {
         //save bitmap to stream
         System.IO.MemoryStream stream = new System.IO.MemoryStream();
         bmp.Save( stream, System.Drawing.Imaging.ImageFormat.Png );
         //verry important: put stream on position 0
         stream.Position     = 0;
         //get the pixmap mask
         Gdk.Pixbuf buf      = new Gdk.Pixbuf( stream, bmp.Width, bmp.Height );
         Gdk.Pixmap map1, map2;
         buf.RenderPixmapAndMask( out map1, out map2, 255 );
         //shape combine window
         window.ShapeCombineMask( map2, 0, 0 );
         //dispose
         buf.Dispose();
         map1.Dispose();
         map2.Dispose();
         bmp.Dispose();
         //if evrything is ok return true;
         ret = true;
     }
     catch(Exception ex)
     {
         Console.WriteLine( ex.Message + "\r\n" + ex.StackTrace );
     }
     return ret;
 }
开发者ID:tizianomanni,项目名称:holly-gtk-widgets,代码行数:42,代码来源:WinUtil.cs

示例2: SparkleAbout

        public SparkleAbout()
            : base("")
        {
            DeleteEvent += delegate (object o, DeleteEventArgs args) {
                HideAll ();
                args.RetVal = true;
            };

            DefaultSize    = new Gdk.Size (600, 260);
            Resizable      = false;
            BorderWidth    = 0;
            IconName       = "folder-sparkleshare";
            WindowPosition = WindowPosition.Center;
            Title          = _("About SparkleShare");
            AppPaintable   = true;

            string image_path = new string [] {SparkleUI.AssetsPath,
                 "pixmaps", "about.png"}.Combine ();

            Realize ();
            Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
            Gdk.Pixmap map, map2;
            buf.RenderPixmapAndMask (out map, out map2, 255);
            GdkWindow.SetBackPixmap (map, false);

            Controller = new SparkleAboutController ();

            Controller.NewVersionEvent += delegate (string new_version) {
                Application.Invoke (delegate {
                    this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#f57900'>{0}</span>",
                        String.Format (_("A newer version ({0}) is available!"), new_version));

                    this.updates.ShowAll ();
                });
            };

            Controller.VersionUpToDateEvent += delegate {
                Application.Invoke (delegate {
                    this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#4e9a06'>{0}</span>",
                        _("You are running the latest version."));

                    this.updates.ShowAll ();
                });
            };

            Controller.CheckingForNewVersionEvent += delegate {
                Application.Invoke (delegate {
                    this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#4e9a06'>{0}</span>",
                        _("Checking for updates..."));

                    this.updates.ShowAll ();
                });
            };

            this.CreateAbout ();
        }
开发者ID:rpalaniappan,项目名称:SparkleShare,代码行数:56,代码来源:SparkleAbout.cs

示例3: PryanetAbout

        public PryanetAbout()
            : base("")
        {
            DefaultSize    = new Gdk.Size (600, 260);
            Resizable      = false;
            BorderWidth    = 0;
            IconName       = "folder-pryanetshare";
            WindowPosition = WindowPosition.Center;
            Title          = "About PryanetShare";
            AppPaintable   = true;

            string image_path = new string [] { PryanetUI.AssetsPath, "pixmaps", "about.png" }.Combine ();

            Realize ();
            Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
            Gdk.Pixmap map, map2;
            buf.RenderPixmapAndMask (out map, out map2, 255);
            GdkWindow.SetBackPixmap (map, false);

            CreateAbout ();

            DeleteEvent += delegate (object o, DeleteEventArgs args) {
                Controller.WindowClosed ();
                args.RetVal = true;
            };

            KeyPressEvent += delegate (object o, KeyPressEventArgs args) {
                if (args.Event.Key == Gdk.Key.Escape ||
                    (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) {

                    Controller.WindowClosed ();
                }
            };

            Controller.HideWindowEvent += delegate {
                Application.Invoke (delegate {
                    HideAll ();
                });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke (delegate {
                    ShowAll ();
                    Present ();
                });
            };

            Controller.UpdateLabelEvent += delegate (string text) {
                Application.Invoke (delegate {
                    this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#8cc4ff'>{0}</span>", text);
                    this.updates.ShowAll ();
                });
            };
        }
开发者ID:pryanet,项目名称:PryanetShare,代码行数:54,代码来源:PryanetAbout.cs

示例4: About

        public About() : base(string.Empty) {
            this.DeleteEvent += delegate(object o, DeleteEventArgs args) {
                this.Controller.WindowClosed();
                args.RetVal = true;
            };

            this.DefaultSize    = new Gdk.Size(600, 260);
            this.Resizable      = false;
            this.BorderWidth    = 0;
            this.IconName       = "dataspacesyc-folder";
            this.WindowPosition = WindowPosition.Center;
            this.Title          = string.Format(Properties_Resources.About, Properties_Resources.ApplicationName);
            this.AppPaintable   = true;

            string image_path = UIHelpers.GetImagePath("about.png");

            this.Realize();
            Gdk.Pixbuf buf = new Gdk.Pixbuf(image_path);
            Gdk.Pixmap map, map2;
            buf.RenderPixmapAndMask(out map, out map2, 255);
            GdkWindow.SetBackPixmap(map, false);

            this.CreateAbout();

            this.Controller.HideWindowEvent += delegate {
                Application.Invoke(delegate {
                    this.HideAll();
                });
            };

            this.Controller.ShowWindowEvent += delegate {
                Application.Invoke(delegate {
                    this.ShowAll();
                    this.Present();
                });
            };
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:37,代码来源:About.cs

示例5: About

        public About () : base ("")
        {
            DeleteEvent += delegate (object o, DeleteEventArgs args) {
                Controller.WindowClosed ();
                args.RetVal = true;
            };

            DefaultSize    = new Gdk.Size (600, 260);
            Resizable      = false;
            BorderWidth    = 0;
            IconName       = "folder-cmissync";
            WindowPosition = WindowPosition.Center;
            Title          = Properties_Resources.About;
            AppPaintable   = true;

            string image_path = System.IO.Path.Combine(GUI.AssetsPath, "pixmaps", "about.png");

            Realize ();
            Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
            Gdk.Pixmap map, map2;
            buf.RenderPixmapAndMask (out map, out map2, 255);
            GdkWindow.SetBackPixmap (map, false);

            CreateAbout ();

            Controller.HideWindowEvent += delegate {
                Application.Invoke (delegate {
                        HideAll ();
                        });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke (delegate {
                        ShowAll ();
                        Present ();
                        });
            };

            Controller.NewVersionEvent += delegate (string new_version) {
                Application.Invoke (delegate {
                        this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                            string.Format (Properties_Resources.NewVersionAvailable, new_version));

                        this.updates.ShowAll ();
                        });
            };

            Controller.VersionUpToDateEvent += delegate {
                Application.Invoke (delegate {
                        this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                            Properties_Resources.RunningLatestVersion);

                        this.updates.ShowAll ();
                        });
            };

            Controller.CheckingForNewVersionEvent += delegate {
                Application.Invoke (delegate {
                        // this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                        //    "Checking for updates...");

                        this.updates.ShowAll ();
                        });
            };
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:65,代码来源:About.cs


注:本文中的Gdk.Pixbuf.RenderPixmapAndMask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。