当前位置: 首页>>代码示例>>C#>>正文


C# Gdk.Pixbuf.CopyArea方法代码示例

本文整理汇总了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);
                    }
                }
            }
        }
开发者ID:marwansamaha,项目名称:Screenary,代码行数:54,代码来源:SurfaceBitsCommand.cs

示例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;
        }
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:24,代码来源:ImageTexture.cs


注:本文中的Gdk.Pixbuf.CopyArea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。