本文整理汇总了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");
}
示例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 ()
});
}
示例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;
}
示例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);
}
示例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);
}
示例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");
}
}
}