Beispiel #1
0
        public Form1()
            : base("Snap N Viewer", 20, 20, 640, 480)
        {
            fAutoScale = true;

            // Create the backing buffer to retain the image
            fBackingBuffer = new GDIDIBSection(1600, 1200);

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

            Title = "Snap N Viewer - " + ipep.ToString();

            fCommChannel = new CommChannel(ipep, false, true);

            // 3. Setup the chunk decoder so we can receive new images
            // when they come in
            fChunkDecoder = new GraphPortChunkDecoder(fBackingBuffer, fCommChannel);
            fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24;
            fChunkDecoder.PixBltLumbHandler += this.PixBltLum24;
        }
Beispiel #2
0
        public ReceivingTexture(GraphicsInterface gi, int width, int height)
        {
            // Create the backing buffer to retain the image
            backingBuffer = new GDIDIBSection(width, height);
            backingBuffer.DeviceContext.ClearToBlack();

            fDynamicTexture = new DynamicTexture(gi, width, height, 3);

            // 3. Setup the chunk decoder so we can receive new images
            // when they come in
            //fChunkDecoder = new GraphPortChunkDecoder(backingBuffer);
            fChunkDecoder = new GraphPortChunkDecoder(backingBuffer, null);
            fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24;
            fChunkDecoder.PixBltLumbHandler += this.PixBltLum24;
        }