示例#1
0
        /// <summary>
        /// Method to create TS_RFX_REGION.
        /// </summary>
        /// <param name="rects">Array of rects, if this parameter is null, will send a 64*64 rect </param>
        /// <param name="numRectsZero">A boolean variable to indicate whether the numRectsZero field of the TS_RFX_REGION is zero </param>
        public TS_RFX_REGION CreateTsRfxRegion(Rectangle[] rects = null, bool numRectsZero = false)
        {
            TS_RFX_REGION rfxRegion = new TS_RFX_REGION();

            rfxRegion.CodecChannelT           = new TS_RFX_CODEC_CHANNELT();
            rfxRegion.CodecChannelT.blockType = blockType_Value.WBT_REGION;
            rfxRegion.CodecChannelT.codecId   = 0x01;
            rfxRegion.CodecChannelT.channelId = 0x00;
            rfxRegion.regionFlags             = 0x01;

            if (numRectsZero)
            {
                rfxRegion.numRects = 0;
                rfxRegion.CodecChannelT.blockLen = 15;
                rfxRegion.rects       = new TS_RFX_RECT[0];
                rfxRegion.regionType  = 0xCAC1;
                rfxRegion.numTilesets = 0x0001;

                return(rfxRegion);
            }

            if (rects == null || rects.Length == 0)
            {
                rfxRegion.numRects = 1;
                rfxRegion.CodecChannelT.blockLen = (uint)(15 + 1 * 8);
                rfxRegion.rects           = new TS_RFX_RECT[1];
                rfxRegion.rects[0].x      = 0;
                rfxRegion.rects[0].y      = 0;
                rfxRegion.rects[0].width  = RdprfxServer.TileSize;
                rfxRegion.rects[0].height = RdprfxServer.TileSize;
            }
            else
            {
                rfxRegion.numRects = (ushort)rects.Length;
                rfxRegion.CodecChannelT.blockLen = (uint)(15 + rfxRegion.numRects * 8);
                rfxRegion.rects = new TS_RFX_RECT[rects.Length];
                for (int i = 0; i < rects.Length; i++)
                {
                    rfxRegion.rects[i].x      = (ushort)rects[i].Left;
                    rfxRegion.rects[i].y      = (ushort)rects[i].Top;
                    rfxRegion.rects[i].width  = (ushort)rects[i].Width;
                    rfxRegion.rects[i].height = (ushort)rects[i].Height;
                }
            }
            rfxRegion.regionType  = 0xCAC1;
            rfxRegion.numTilesets = 0x0001;

            return(rfxRegion);
        }
 /// <summary>
 /// Set TS_RFX_REGION for RemoteFX codec image
 /// </summary>
 /// <param name="rfxRegion"></param>
 public void SetRemoteFXRegion(TS_RFX_REGION rfxRegion)
 {
     remoteFXContext.Region = rfxRegion;
 }
        /// <summary>
        /// Method to create TS_RFX_REGION.
        /// </summary>
        /// <param name="rects">Array of rects, if this parameter is null, will send a 64*64 rect </param>
        /// <param name="numRectsZero">A boolean variable to indicate whether the numRectsZero field of the TS_RFX_REGION is zero </param>
        public TS_RFX_REGION CreateTsRfxRegion(Rectangle[] rects = null, bool numRectsZero = false)
        {
            TS_RFX_REGION rfxRegion = new TS_RFX_REGION();
            rfxRegion.CodecChannelT = new TS_RFX_CODEC_CHANNELT();
            rfxRegion.CodecChannelT.blockType = blockType_Value.WBT_REGION;
            rfxRegion.CodecChannelT.codecId = 0x01;
            rfxRegion.CodecChannelT.channelId = 0x00;
            rfxRegion.regionFlags = 0x01;

            if (numRectsZero)
            {
                rfxRegion.numRects = 0;
                rfxRegion.CodecChannelT.blockLen = 15;
                rfxRegion.rects = new TS_RFX_RECT[0];
                rfxRegion.regionType = 0xCAC1;
                rfxRegion.numTilesets = 0x0001;

                return rfxRegion;
            }

            if (rects == null || rects.Length == 0)
            {
                rfxRegion.numRects = 1;
                rfxRegion.CodecChannelT.blockLen = (uint)(15 + 1 * 8);
                rfxRegion.rects = new TS_RFX_RECT[1];
                rfxRegion.rects[0].x = 0;
                rfxRegion.rects[0].y = 0;
                rfxRegion.rects[0].width = RdprfxServer.TileSize;
                rfxRegion.rects[0].height = RdprfxServer.TileSize;
            }
            else
            {
                rfxRegion.numRects = (ushort) rects.Length;
                rfxRegion.CodecChannelT.blockLen = (uint)(15 + rfxRegion.numRects * 8);
                rfxRegion.rects = new TS_RFX_RECT[rects.Length];
                for (int i = 0; i < rects.Length; i++)
                {
                    rfxRegion.rects[i].x = (ushort) rects[i].Left;
                    rfxRegion.rects[i].y = (ushort) rects[i].Top;
                    rfxRegion.rects[i].width = (ushort) rects[i].Width;
                    rfxRegion.rects[i].height = (ushort) rects[i].Height;
                }

            }
            rfxRegion.regionType = 0xCAC1;
            rfxRegion.numTilesets = 0x0001;

            return rfxRegion;
        }