public override void PixBltPixelBuffer24(PixelBuffer24 pixMap, int x, int y) { fBackingBuffer = pixMap; if (null != DataChangedEvent) DataChangedEvent(fBackingBuffer); }
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 GLSketchViewer(GraphicsInterface gi, int width, int height) { fDynamicTexture = new SnapNGLView.DynamicTexture(gi, width, height, 3); // Create the backing buffer to retain the image backingBuffer = new PixelBuffer24(width, height); //backingBuffer.DeviceContext.ClearToWhite(); // 1. Show a dialog box to allow the user to type in the // group IP address and port number. HostForm groupForm = new HostForm(); groupForm.ShowDialog(); // 2. Get the address and port from the form, and use // them to setup the MultiSession object string groupIP = groupForm.groupAddressField.Text; int groupPort = int.Parse(groupForm.groupPortField.Text); IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort); // Create the session fSession = new MultiSession(Guid.NewGuid().ToString(), ipep); // Add the channel for graphics commands fSketchChannel = fSession.CreateChannel(PayloadType.Whiteboard); // 3. Setup the chunk decoder so we can receive new images // when they come in fChunkDecoder = new GraphPortChunkDecoder(backingBuffer, fSketchChannel); fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24; fChunkDecoder.PixBltLumbHandler += this.PixBltLum24; //fSketchChannel.FrameReceivedEvent += FrameReceived; }
/// <summary> /// This method is called through an Event dispatch. It is registered with /// the DataChangedEvent of the viewer class. It should be raised whenever /// a new set of drawing commands hits to viewer from the network. /// </summary> void ReceiveImage(int x, int y, PixelBuffer24 aImage) { Rectangle srcRect = new Rectangle(0, 0, aImage.Width, aImage.Height); Rectangle dstRect = new Rectangle(x, y, aImage.Width, aImage.Height); //fDrawingContext.BitBlt(aImage.DeviceContext, new Point(0, 0), new Rectangle(x, y, aImage.Width, aImage.Height), TernaryRasterOps.SRCCOPY); fDrawingContext.AlphaBlend(aImage.DeviceContext, srcRect, fDestinationRect, 255); }
public SketchViewer(PayloadChannel channel, int width, int height) { fSketchChannel = channel; // Create the backing buffer to retain the image fBackingBuffer = new PixelBuffer24(width, height); // Create the decoder and assign ourself to received // decoded methods fChunkDecoder = new GraphPortChunkDecoder(fBackingBuffer, fSketchChannel); fChunkDecoder.AddPort(this); }
public virtual void OnBitBlt(int x, int y, PixelBuffer24 pixBuff) { if (null != OnBitBltEvent) OnBitBltEvent(x, y, pixBuff); }
// Generalized bit block transfer // Can transfer from any device context to this one. public virtual void BitBlt(int x, int y, PixelBuffer24 pixBuff) { if (null != BitBltHandler) BitBltHandler(x, y, pixBuff); }
public virtual void ScaleBitmap(PixelBuffer24 aBitmap, RECT aFrame) { AlphaBlend(aFrame.Left, aFrame.Top, aFrame.Width, aFrame.Height, aBitmap, 0, 0, aBitmap.Width, aBitmap.Height, aBitmap.Alpha); }
//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); }
public virtual void PixBltPixelBuffer24(PixelBuffer24 pixMap, int x, int y) { fDynamicTexture.UpdateImage(new PixelAccessorBGRb(pixMap)); }