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


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

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


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

示例1: ExportAsPngImage

        /// <summary>
        /// Exports image in PNG format.
        /// </summary>
        static void ExportAsPngImage (ImageInfo image, string path)
        {
            int width = image.ImageObject.Elements.GetInteger (PdfImage.Keys.Width);
            int height = image.ImageObject.Elements.GetInteger (PdfImage.Keys.Height);

            try {
                byte [] data = image.ImageObject.Stream.UnfilteredValue;
                using (var pixbuf = new Gdk.Pixbuf (data, Gdk.Colorspace.Rgb, false, 8, width, height, width*3)) {
                    pixbuf.Save (path, "png");
                }
            } catch (Exception e) {
                Hyena.Log.Exception ("Unable to load PNG from embedded PDF object", e);
            }
        }
开发者ID:GNOME,项目名称:pdfmod,代码行数:17,代码来源:ExportImagesAction.cs

示例2: AlbumArtExists

        private bool AlbumArtExists(TrackInfo currentTrack)
        {
            image = artwork_manager_service.LookupPixbuf(current_track.ArtworkId);

            if (image == null || !image.Save(albumWallpaper, "png"))
                return false;
            else
                return true;
        }
开发者ID:jrmuizel,项目名称:banshee-unofficial-plugins,代码行数:9,代码来源:CoverWallpaperService.cs

示例3: Save

			public void Save ()
			{
				Gdk.Pixbuf test = new Gdk.Pixbuf (null, "f-spot-32.png");
				string path = ImageFile.TempPath ("joe.png");
				test.Save (path, "png");
				PngFile pimg = new PngFile (path);

				string desc = "this is a png test";
				string desc2 = "\000xa9 Novell Inc.";
				pimg.SetDescription (desc);
				using (Stream stream = File.OpenWrite (path)) {
					pimg.Save (stream);
				}
				PngFile mod = new PngFile (path);
				Assert.AreEqual (mod.Orientation, PixbufOrientation.TopLeft);
				Assert.AreEqual (mod.Description, desc);
				pimg.SetDescription (desc2);

				using (Stream stream = File.OpenWrite (path)) {
					pimg.Save (stream);
				}
				mod = new PngFile (path);
				Assert.AreEqual (mod.Description, desc2);
				
				File.Delete (path);
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:26,代码来源:PngFile.cs

示例4: takeSnapShot

        /// <summary>
        /// Take screenshot and save it as PNG image to defined directory
        /// </summary>
        public void takeSnapShot()
        {
            Gdk.Window window = Gdk.Global.DefaultRootWindow;

            if (window != null)
            {
                Gdk.Pixbuf pixBuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, window.Screen.Width, window.Screen.Height);
                pixBuf.GetFromDrawable(window, Gdk.Colormap.System, 0, 0, 0, 0, window.Screen.Width, window.Screen.Height);

                var now = DateTime.Now;

                // 2012-12-28
                var dayPath = String.Format("{0:0000}-{1:00}-{2:00}", now.Year, now.Month, now.Day);

                // 235911,213
                var fileName = String.Format("{0:00}{1:00}{2:00},{3}", now.Hour, now.Minute, now.Second, now.Millisecond);

                var savePath = settings.directory + "\\" + dayPath;

                if(!Directory.Exists(savePath))
                {
                    // Generate directory
                    Directory.CreateDirectory(savePath);
                }

                savePath += "\\" + fileName + ".png";

                // Save screenshot
                pixBuf.Save(savePath, "png");

                lastFileName = savePath;
            }
        }
开发者ID:raspi,项目名称:screenjournal,代码行数:36,代码来源:snapshotter.cs


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