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


C# Pixbuf.SaveToBuffer方法代码示例

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


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

示例1: getScreenShot

        public byte[] getScreenShot()
        {
            int width, height;
            this.GetSize(out width, out height);
            Gdk.Pixbuf screenShot=new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, width, height);
            screenShot=screenShot.CreateFromDrawable (this.GdkWindow, this.GdkWindow.Colormap, 0, 0, 0, 0, width, height);
            screenShot.ScaleSimple(100,80,Gdk.InterpType.Bilinear);

            return screenShot.SaveToBuffer("png");
        }
开发者ID:mauroguardarini,项目名称:sugar-sharp,代码行数:10,代码来源:Window.cs

示例2: CreateThumbnail

		public static byte[] CreateThumbnail (SafeUri uri, ulong mTime)
		{
			var pixbuf = new Pixbuf (Colorspace.Rgb, false, 8, 1, 1);
			return pixbuf.SaveToBuffer ("png", new [] {
				ThumbnailService.ThumbUriOpt,
				ThumbnailService.ThumbMTimeOpt,
				null
			}, new [] {
				uri,
				mTime.ToString ()
			});
		}
开发者ID:mono,项目名称:f-spot,代码行数:12,代码来源:PixbufMock.cs

示例3: PixbufToBitmap

        public static Bitmap PixbufToBitmap(Pixbuf image)
        {
            MemoryStream  stream = new MemoryStream(image.SaveToBuffer("png"));
            stream.Position = 0;

            Bitmap sysimage = new Bitmap(stream);
            stream.Close();

            return sysimage;
        }
开发者ID:QualitySolution,项目名称:earchive,代码行数:10,代码来源:RecognizeHelper.cs

示例4: PixbufToPix

        public static Pix PixbufToPix(Pixbuf image)
        {
            MemoryStream  stream = new MemoryStream(image.SaveToBuffer("png"));
            stream.Position = 0;

            Bitmap sysimage = new Bitmap(stream);
            stream.Close();

            return PixConverter.ToPix(sysimage);
        }
开发者ID:QualitySolution,项目名称:earchive,代码行数:10,代码来源:RecognizeHelper.cs

示例5: ReadImageData

		string ReadImageData (Image.File file)
		{
			if (!IsSupportedImageFile (file))
				Assert.Fail("Unsupported type for data reading: "+file);

			file.Mode = File.AccessMode.Read;
			ByteVector v = file.ReadBlock ((int) file.Length);
			byte [] result = null;
			using (Pixbuf buf = new Pixbuf(v.Data))
				result = buf.SaveToBuffer("png");
			file.Mode = File.AccessMode.Closed;
			return Utils.Md5Encode (result);
		}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:13,代码来源:ImageTest.cs

示例6: ChoosePicture

        private void ChoosePicture(object sender, EventArgs args)
        {
            bool ok = false;
            string title = "Escoja la fotografía";
            string file_name = null;
            string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            if(!string.IsNullOrEmpty(this.LastDir))
                folder = new System.IO.FileInfo(this.LastDir).DirectoryName;

            if(AppHelper.Windows)
            {
                System.Windows.Forms.Application.EnableVisualStyles();
                System.Windows.Forms.OpenFileDialog dialog;
                dialog = new System.Windows.Forms.OpenFileDialog();
                dialog.Title = title;
                dialog.ShowReadOnly = true;
                dialog.Multiselect = false;
                dialog.Filter = "Archivos de imagen|*.jpg; *.jpeg; *.png";
                dialog.InitialDirectory = folder;
                System.Windows.Forms.DialogResult dr = dialog.ShowDialog();

                if(dr == System.Windows.Forms.DialogResult.OK)
                {
                    ok = true;
                    file_name = dialog.FileName;
                }
            }

            else
            {
                FileChooserDialog dialog = new FileChooserDialog
                (
                    title,
                    this,
                    FileChooserAction.Open,
                    "Cancelar", ResponseType.Cancel,
                    "Abrir", ResponseType.Accept
                );

                FileFilter filter = new FileFilter();
                filter.Name = "Archivos de imagen";
                filter.AddPattern("*.jpg");
                filter.AddPattern("*.jpeg");
                filter.AddPattern("*.png");

                dialog.SelectMultiple = false;
                dialog.AddFilter(filter);
                dialog.SetCurrentFolder(folder);
                ResponseType dr = (ResponseType) dialog.Run();
                if(dr == ResponseType.Accept)
                {
                    ok = true;
                    file_name = dialog.Filename;
                }

                dialog.Destroy();
            }

            if(ok)
            {
                this.LastDir = file_name;
                try
                {
                    Pixbuf pixbuf = new Pixbuf(file_name, 300, 250, true);
                    this.TargetMember.BinImage = pixbuf.SaveToBuffer("png");
                    this.LoadImage();
                }

                catch(GLib.GException)
                {
                    GuiHelper.ShowMessage("Esta versión de Gtk# no soporta este tipo de archivos, puede añadir la imagen más tarde si desea");
                }
            }
        }
开发者ID:omarkhd,项目名称:gymk,代码行数:74,代码来源:MemberWizard.cs


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