本文整理汇总了C#中Gdk.Pixbuf.CopyArea方法的典型用法代码示例。如果您正苦于以下问题:C# Gdk.Pixbuf.CopyArea方法的具体用法?C# Gdk.Pixbuf.CopyArea怎么用?C# Gdk.Pixbuf.CopyArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdk.Pixbuf
的用法示例。
在下文中一共展示了Gdk.Pixbuf.CopyArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public override void Execute(SurfaceReceiver receiver)
{
int x, y;
int tx, ty;
int width, height;
Gdk.Pixbuf pixbuf;
Gdk.Rectangle[] rects;
Gdk.Rectangle clippedRect;
if (codecID != CODEC_ID_REMOTEFX)
return;
RfxMessage rfxMsg = receiver.rfx.ParseMessage(bitmapData, bitmapDataLength);
x = y = 0;
width = height = 64;
rects = new Gdk.Rectangle[rfxMsg.RectCount];
int count = 0;
while (rfxMsg.HasNextRect())
{
rfxMsg.GetNextRect(ref x, ref y, ref width, ref height);
tx = x + destLeft;
ty = y + destTop;
rects[count++] = new Gdk.Rectangle(tx, ty, width, height);
}
while (rfxMsg.HasNextTile())
{
rfxMsg.GetNextTile(buffer, ref x, ref y);
tx = x + destLeft;
ty = y + destTop;
Gdk.Rectangle tileRect = new Gdk.Rectangle(tx, ty, 64, 64);
foreach (Gdk.Rectangle rect in rects)
{
rect.Intersect(tileRect, out clippedRect);
if (!clippedRect.IsEmpty)
{
pixbuf = new Gdk.Pixbuf(buffer, Gdk.Colorspace.Rgb, true, 8, 64, 64, 64 * 4);
pixbuf.CopyArea(0, 0, clippedRect.Width, clippedRect.Height,
receiver.surface, clippedRect.X, clippedRect.Y);
receiver.InvalidateRect(clippedRect.X, clippedRect.Y, clippedRect.Width, clippedRect.Height);
}
}
}
}
示例2: ImageTexture
public ImageTexture(Stream input)
{
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(input);
uint width = (uint)pixbuf.Width;
uint height = (uint)pixbuf.Height;
// Round to next power-of-two isn't needed with newer OpenGL versions
if (!GlHelper.HasExtension("GL_ARB_texture_non_power_of_two")) {
width = NextPowerOfTwo((uint)width);
height = NextPowerOfTwo((uint)height);
}
Gdk.Pixbuf target = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, (int)width, (int)height);
pixbuf.CopyArea(0, 0, pixbuf.Width, pixbuf.Height, target, 0, 0);
ImageWidth = (float) pixbuf.Width;
ImageHeight = (float) pixbuf.Height;
this.width = (uint)target.Width;
this.height = (uint)target.Height;
this.pixbuf = target;
}