本文整理汇总了C#中Gdk.Pixbuf.RenderToDrawable方法的典型用法代码示例。如果您正苦于以下问题:C# Pixbuf.RenderToDrawable方法的具体用法?C# Pixbuf.RenderToDrawable怎么用?C# Pixbuf.RenderToDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Pixbuf
的用法示例。
在下文中一共展示了Pixbuf.RenderToDrawable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleExposeEvent
void HandleExposeEvent(object o, ExposeEventArgs args)
{
Pixbuf frame;
int width, height, allocWidth, allocHeight, logoX, logoY;
float ratio;
if (Background == null)
return;
width = Background.Width;
height = Background.Height;
allocWidth = Allocation.Width;
allocHeight = Allocation.Height;
frame = new Pixbuf (Colorspace.Rgb, false, 8, this.Allocation.Width,
this.Allocation.Height);
ratio = Math.Min ((float)allocWidth / (float)width,
(float)allocHeight / (float)height);
logoX = (int)((allocWidth / 2) - (width * ratio / 2));
logoY = (int)((allocHeight / 2) - (height * ratio / 2));
/* Scaling to available space */
Background.Composite (frame, 0, 0, allocWidth, allocHeight,
logoX, logoY, ratio, ratio,
InterpType.Bilinear, 255);
/* Drawing our frame */
frame.RenderToDrawable (drawingarea.GdkWindow, Style.BlackGC, 0, 0,
args.Event.Area.X, args.Event.Area.Y,
args.Event.Area.Width, args.Event.Area.Height,
RgbDither.Normal, args.Event.Area.X, args.Event.Area.Y);
frame.Dispose ();
return;
}