本文整理汇总了C#中Gdk.Pixbuf.GetFromDrawable方法的典型用法代码示例。如果您正苦于以下问题:C# Pixbuf.GetFromDrawable方法的具体用法?C# Pixbuf.GetFromDrawable怎么用?C# Pixbuf.GetFromDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Pixbuf
的用法示例。
在下文中一共展示了Pixbuf.GetFromDrawable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CaptureImage
public static Gdk.Pixbuf CaptureImage(Gdk.Rectangle rectSelection)
{
Window winRoot = Gdk.Screen.Default.RootWindow;
Gdk.Pixbuf pix = new Gdk.Pixbuf(Colorspace.Rgb, true, 8, rectSelection.Width, rectSelection.Height);
pix.GetFromDrawable(winRoot, winRoot.Colormap, rectSelection.X, rectSelection.Y, 0, 0, rectSelection.Width, rectSelection.Height);
Console.WriteLine("capture: image captured");
return pix;
}
示例2: CaptureScreen
public static Gdk.Pixbuf CaptureScreen()
{
int width = 0;
int height = 0;
Window winRoot = Gdk.Screen.Default.RootWindow;
winRoot.GetSize(out width, out height);
Gdk.Pixbuf pix = new Gdk.Pixbuf(Colorspace.Rgb, true, 8, width, height);
pix.GetFromDrawable(winRoot, winRoot.Colormap, 0, 0, 0, 0, width, height);
Console.WriteLine("capture: screen captured");
return pix;
}
示例3: MakeShot
static bool MakeShot()
{
Console.WriteLine(wc.Location);
Gdk.Window win = wc.GdkWindow;
int iwidth = wc.Allocation.Width;
int iheight = wc.Allocation.Height;
Gdk.Pixbuf p = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, iwidth, iheight);
Gdk.Pixbuf scaled;
p.GetFromDrawable (win, win.Colormap, 0, 0, 0, 0, iwidth, iheight);
if (width == -1){
if (height == -1)
scaled = p;
else
scaled = p.ScaleSimple (height * iwidth / iheight, height, Gdk.InterpType.Hyper);
} else {
if (height == -1)
scaled = p.ScaleSimple (width, width * iheight / iwidth, Gdk.InterpType.Hyper);
else
scaled = p.ScaleSimple (width, height, Gdk.InterpType.Hyper);
}
scaled.Save (output, "png");
Application.Quit ();
return true;
}