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


C# BufferChunk.CopyFrom方法代码示例

本文整理汇总了C#中NewTOAPIA.BufferChunk.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# BufferChunk.CopyFrom方法的具体用法?C# BufferChunk.CopyFrom怎么用?C# BufferChunk.CopyFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NewTOAPIA.BufferChunk的用法示例。


在下文中一共展示了BufferChunk.CopyFrom方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BitBlt

        public override void BitBlt(int x, int y, PixelBuffer pixBuff)
        {
            // Create a buffer
            // It has to be big enough for the bitmap data, as well as the x,y, and command
            int dataSize = pixBuff.Pixels.Stride * pixBuff.Pixels.Height;
            BufferChunk chunk = new BufferChunk(dataSize + 128);

            // now put the basic command and simple components in
            chunk += SpaceControlChannel.SC_BitBlt;
            CodecUtils.Pack(chunk, x, y);
            CodecUtils.Pack(chunk, pixBuff.Pixels.Width, pixBuff.Pixels.Height);
            chunk += dataSize;

            // Finally, copy in the data
            chunk.CopyFrom(pixBuff.Pixels.Data, dataSize);

            PackCommand(chunk);
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:18,代码来源:SpaceCommandEncoder.cs

示例2: CopyPixels

        public virtual void CopyPixels(int x, int y, int width, int height, PixelBuffer24 pixBuff)
        {
            // Create a buffer
            // It has to be big enough for the bitmap data, as well as the x,y, and command
            int dataSize = (width) * (height) * pixBuff.Pixels.BytesPerPixel;
            BufferChunk chunk = new BufferChunk(dataSize + 128);

            // now put the basic command and simple components in
            chunk += SpaceControlChannel.SC_CopyPixels;
            CodecUtils.Pack(chunk, x, y, width, height);
            chunk += dataSize;

            // Finally, copy in the data
            int numBytesPerRow = pixBuff.Pixels.BytesPerPixel * width;
            IntPtr rowPtr = pixBuff.Pixels.Data;
            int offset = 0;
            int row = 0;
            for (row = y; row < (y + height); row++)
            {
                offset = pixBuff.Pixels.Data.ToInt32() + row * pixBuff.Pixels.Stride + x * pixBuff.Pixels.BytesPerPixel;
                rowPtr = (IntPtr)offset;
                chunk.CopyFrom(rowPtr, numBytesPerRow);
            }

            PackCommand(chunk);
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:26,代码来源:SpaceCommandEncoder.cs

示例3: AlphaBlend

        //public override void BitBlt(int x, int y, PixelBuffer pixBuff)
        //{
        //    // Create a buffer
        //    // It has to be big enough for the bitmap data, as well as the x,y, and command
        //    int dataSize = pixBuff.Pixels.Stride * pixBuff.Pixels.Height;
        //    BufferChunk chunk = new BufferChunk(dataSize + 128);

        //    // now put the basic command and simple components in
        //    chunk += SpaceControlChannel.SC_BitBlt;
        //    CodecUtils.Pack(chunk, x, y);
        //    CodecUtils.Pack(chunk, pixBuff.Pixels.Width, pixBuff.Pixels.Height);
        //    chunk += dataSize;

        //    // Finally, copy in the data
        //    chunk.CopyFrom(pixBuff.Pixels.Data, dataSize);

        //    PackCommand(chunk);
        //}

        public virtual void AlphaBlend(int x, int y, int width, int height,
                PixelBuffer24 pixBuff, int srcX, int srcY, int srcWidth, int srcHeight,
                byte alpha)
        {
            // Create a buffer
            // It has to be big enough for the bitmap data, as well as the x,y, and command
            int dataSize = pixBuff.Pixels.BytesPerPixel * srcWidth * srcHeight;
            BufferChunk chunk = new BufferChunk(dataSize + 128);

            // now put the basic command and simple components in
            chunk += SpaceControlChannel.SC_AlphaBlend;
            CodecUtils.Pack(chunk, x, y, width, height);
            CodecUtils.Pack(chunk, srcX, srcY, srcWidth, srcHeight);
            chunk += alpha;

            CodecUtils.Pack(chunk, srcWidth, srcHeight);
            chunk += dataSize;

            // Finally, copy in the data
            // One row at a time
            int numBytesPerRow = pixBuff.Pixels.BytesPerPixel * srcWidth;
            IntPtr rowPtr = pixBuff.Pixels.Data;
            int offset = rowPtr.ToInt32() + srcY * pixBuff.Pixels.Stride + srcX * pixBuff.Pixels.BytesPerPixel;
            for (int row = srcY; row < (srcY + srcHeight); row++)
            {
                rowPtr = (IntPtr)offset;
                chunk.CopyFrom(rowPtr, numBytesPerRow);
                offset = rowPtr.ToInt32() + row * pixBuff.Pixels.Stride + srcX * pixBuff.Pixels.BytesPerPixel;
            }

            PackCommand(chunk);

        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:52,代码来源:SpaceCommandEncoder.cs

示例4: PixBlt

        // Generalized bit block transfer
        public override void PixBlt(PixelArray pixBuff, int x, int y)
        {
            // Create a buffer
            // It has to be big enough for the bitmap data, as well as the x,y, and command
            int dataSize = pixBuff.BytesPerRow * pixBuff.Height;
            BufferChunk chunk = new BufferChunk(dataSize + 128);

            // now put the basic command and simple components in
            chunk += GDI32.EMR_BITBLT;
            ChunkUtils.Pack(chunk, x, y);
            ChunkUtils.Pack(chunk, pixBuff.Width, pixBuff.Height);
            chunk += dataSize;

            // Finally, copy in the data
            chunk.CopyFrom(pixBuff.PixelData, dataSize);

            SendCommand(chunk);
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:19,代码来源:GraphPortChunkEncoder.cs

示例5: AlphaBlend

    public override void AlphaBlend(int x, int y, int width, int height,
            PixelBuffer pixBuff, int srcX, int srcY, int srcWidth, int srcHeight,
            byte alpha)
    {
        // Create a buffer
        // It has to be big enough for the bitmap data, as well as the x,y, and command
        int dataSize = pixBuff.Pixels.Stride * pixBuff.Pixels.Height;
        BufferChunk chunk = new BufferChunk(dataSize + 128);

        // now put the basic command and simple components in
        chunk += GDI32.EMR_ALPHABLEND;
        Pack(chunk, x, y, width, height);
        Pack(chunk, srcX, srcY, srcWidth, srcHeight);
        chunk += alpha;
        
        Pack(chunk, pixBuff.Pixels.Width, pixBuff.Pixels.Height);
        chunk += dataSize;

        // Finally, copy in the data
        chunk.CopyFrom(pixBuff.Pixels.Data, dataSize);

        PackCommand(chunk);

    }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:24,代码来源:GraphPortChunkEncoder.cs


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