本文整理汇总了C#中Gdk.Pixbuf.ApplyEmbeddedOrientation方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Pixbuf.ApplyEmbeddedOrientation方法的具体用法?C# Gdk.Pixbuf.ApplyEmbeddedOrientation怎么用?C# Gdk.Pixbuf.ApplyEmbeddedOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Pixbuf
的用法示例。
在下文中一共展示了Gdk.Pixbuf.ApplyEmbeddedOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnButtonPictureClicked
protected void OnButtonPictureClicked(object sender, EventArgs e)
{
Gtk.FileChooserDialog dlg =
new Gtk.FileChooserDialog (Catalog.GetString ("Select Image"), ParentWin, Gtk.FileChooserAction.Open,
Catalog.GetString ("Cancel"), Gtk.ResponseType.Cancel,
Catalog.GetString ("Open"), Gtk.ResponseType.Accept);
dlg.Modal = true;
dlg.TransientFor = ParentWin;
int res;
do {
if (pictureFolder != null)
dlg.SetCurrentFolder (pictureFolder);
res = dlg.Run ();
if (res == (int) Gtk.ResponseType.Cancel)
break;
pictureFolder = dlg.CurrentFolder;
filename = dlg.Filename;
try {
Gdk.Pixbuf load = new Gdk.Pixbuf (dlg.Filename);
Gdk.Pixbuf orig = load.ApplyEmbeddedOrientation ();
Gdk.Pixbuf big;
int w = orig.Width;
int h = orig.Height;
if (w == h) {
big = orig;
} else if (w > h) {
big = new Gdk.Pixbuf (orig, (w - h) / 2, 0, h, h);
} else {
big = new Gdk.Pixbuf (orig, 0, (h - w) / 2, w, w);
}
imagePicture.Pixbuf = big.ScaleSimple (PICTURE_WIDTH, PICTURE_HEIGHT, Gdk.InterpType.Hyper);
pixbufOrig = orig;
photoChanged = true;
} catch (GLib.GException) {
Gtk.MessageDialog msg =
new Gtk.MessageDialog (ParentWin, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
Catalog.GetString ("Error opening image"));
msg.Title = "Error";
msg.Run ();
msg.Destroy ();
imagePicture.Pixbuf = Gdk.Pixbuf.LoadFromResource ("IMRpatient.img.image_unknown.png");
photoChanged = false;
continue;
}
} while (res != (int) Gtk.ResponseType.Accept);
dlg.Destroy ();
}