本文整理汇总了C#中ImageInfo.SetInBufferInfo方法的典型用法代码示例。如果您正苦于以下问题:C# ImageInfo.SetInBufferInfo方法的具体用法?C# ImageInfo.SetInBufferInfo怎么用?C# ImageInfo.SetInBufferInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageInfo
的用法示例。
在下文中一共展示了ImageInfo.SetInBufferInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertImage
public void InsertImage(TextIter iter, ImageInfo imageInfo, bool supportUndo)
{
Gdk.Pixbuf pixbuf = null;
try {
pixbuf = new Gdk.Pixbuf (imageInfo.FileContent);
}
catch {
pixbuf = null;
}
if (pixbuf == null) {
// TODO: Report the open image error.
return;
}
if (imageInfo.DisplayWidth == 0) {
imageInfo.DisplayWidth = pixbuf.Width;
imageInfo.DisplayHeight = pixbuf.Height;
}
var imageWidget = new ImageWidget (pixbuf);
imageWidget.ResizeImage (imageInfo.DisplayWidth, imageInfo.DisplayHeight);
imageWidget.ShowAll ();
InitImageWidgetContextMenu (imageWidget, imageInfo);
imageWidget.Resized += imageWidget_Resized;
if (supportUndo)
Buffer.Undoer.FreezeUndo ();
var anchorStart = iter;
var anchor = Buffer.CreateChildAnchor (ref iter);
var tag = new NoteTag ("dummy");
tag.CanUndo = false;
Buffer.ApplyTag (tag, anchorStart, iter);
Window.Editor.AddChildAtAnchor (imageWidget, anchor);
imageInfo.SetInBufferInfo (Buffer, anchor, imageWidget);
//imageWidget.Destroyed += (o, e) =>
//{
// if (!imageWidget.InsertUndone) {
// imageInfoList.Remove (imageInfo);
// }
//};
if (supportUndo) {
Buffer.Undoer.ThawUndo ();
var action = new InsertImageAction (this, imageInfo, imageInfoList);
Buffer.Undoer.AddUndoAction (action);
}
imageInfoList.Add (imageInfo);
}