CopyFrom() public méthode

public CopyFrom ( IntPtr source, Int32 alength ) : void
source System.IntPtr
alength System.Int32
Résultat void
        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 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);
        }
        //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);

        }
        // 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);
        }
    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);

    }