/// <summary> /// Send bitmap data in clearCodec encoding method. /// </summary> /// <param name="sId">This is used to indicate the target surface id.</param> /// <param name="pixFormat">This is used to indicate the pixel format to fill target surface.</param> /// <param name="ccFlag">This is used to indicate the clearcodec stream flags.</param> /// <param name="graphIdx">This is used to indicate the index of graph to be put in client graph cache.</param> /// <param name="bmRect">The rectangle of whole Image, which will be sent in clearcodec, relative to the surface </param> /// <param name="residualImage"> The residual layer image to be sent </param> /// <param name="bands"> The dictionary of band layer image and position </param> /// <param name="subcodecs"> The dictionary of subcodec layer image, subcodecID and position </param> /// <returns> Frame Id </returns> public uint SendImageWithClearCodec(ushort sId, PixelFormat pixFormat, byte ccFlag, ushort graphIdx, RDPGFX_RECT16 bmRect, Image residualBmp, Dictionary<RDPGFX_POINT16, Bitmap> bands, Dictionary<RDPGFX_POINT16, BMP_INFO> subcodecs) { uint fid = MakeStartFramePdu(); ClearCodec_BitmapStream ccStream = new ClearCodec_BitmapStream(ccFlag, graphIdx); if ((ushort)currentTestType >= 500 && (ushort)currentTestType <= 599) { // Clearcodec negative test ccStream.SetTestType(currentTestType); } ccStream.LoadResidualBitmap((Bitmap)residualBmp); if(bands != null) { foreach (KeyValuePair<RDPGFX_POINT16, Bitmap> band in bands) { ccStream.LoadBandBitmap(band.Value, band.Key); } } if (subcodecs != null) { foreach (KeyValuePair<RDPGFX_POINT16, BMP_INFO> scBmp in subcodecs) { ccStream.LoadSubcodecBitmap(scBmp.Value.bmp, scBmp.Key, scBmp.Value.scID); } } ccStream.seqNumber = egfxServer.Get_ClearCodecBitmapStream_SeqNum(); MakeWireToSurfacePdu1(sId, CodecType.RDPGFX_CODECID_CLEARCODEC, pixFormat, bmRect, ccStream.Encode()); MakeEndFramePdu(fid); PackAndSendServerPdu(); if (this.bcgrAdapter.SimulatedScreen != null) { this.bcgrAdapter.SimulatedScreen.RenderClearCodecImage(sId, pixFormat, ccFlag, graphIdx, bmRect, residualBmp, bands, subcodecs); } return fid; }
/// <summary> /// Send clearcodec encoded glyph in batch (make sure glyphnum + startGlyphRect.right is not bigger than surf.width) /// </summary> /// <param name="surf">This is used to indicate the target surface id.</param> /// <param name="startGlyphIdx">This is used to indicate the start index of graph batch to be put in client graph cache.</param> /// <param name="startGlyphPos">The start position of glyph batch, which will be sent in clearcodec, relative to the surface. </param> /// <param name="glyphNum"> The glyph number in batch. </param> /// <param name="glyph"> The residual layer image to be sent. </param> /// <returns> Frame Id </returns> public uint SendClearCodecGlyphInBatch(Surface surf, ushort startGlyphIdx, RDPGFX_POINT16 startGlyphPos, ushort glyphNum, Image glyph) { uint fid = MakeStartFramePdu(); ushort glyphIdx = startGlyphIdx; RDPGFX_RECT16 glyphRect = new RDPGFX_RECT16(startGlyphPos.x, startGlyphPos.y, (ushort)(startGlyphPos.x + glyph.Width), (ushort)(startGlyphPos.y + glyph.Height)); // Pack multiple w2s_1 PDU into a frame. for (ushort i = 0; i < glyphNum; i++) { ClearCodec_BitmapStream ccStream = new ClearCodec_BitmapStream(ClearCodec_BitmapStream.CLEARCODEC_FLAG_GLYPH_INDEX, glyphIdx); ccStream.LoadResidualBitmap((Bitmap)glyph); ccStream.seqNumber = egfxServer.Get_ClearCodecBitmapStream_SeqNum(); MakeWireToSurfacePdu1(surf.Id, CodecType.RDPGFX_CODECID_CLEARCODEC, PixelFormat.PIXEL_FORMAT_XRGB_8888, glyphRect, ccStream.Encode()); glyphIdx++; glyphRect.left++; glyphRect.right++; } MakeEndFramePdu(fid); PackAndSendServerPdu(); if (this.bcgrAdapter.SimulatedScreen != null) { this.bcgrAdapter.SimulatedScreen.RenderClearCodecBatch(surf.Id, startGlyphIdx, startGlyphPos, glyphNum, glyph); } return fid; }