/// <summary> /// Using RDPRFX to send image whose resolution is Width x Height /// </summary> /// <param name="imagefile">Image to send</param> /// <param name="width">Width of image to send</param> /// <param name="height">Height of image to send</param> public bool RdprfxSendImage(Image image, ushort width, ushort height) { uint frameId = 0; //The index of the sending frame. OperationalMode opMode = OperationalMode.ImageMode; EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1; ushort destLeft = 0; //the left bound of the frame. ushort destTop = 0; //the top bound of the frame. // Crop Image Bitmap bitmap = new Bitmap(width, height); Graphics graphics = Graphics.FromImage(bitmap); Rectangle section = new Rectangle(0, 0, width, height); graphics.DrawImage(image, 0, 0, section, GraphicsUnit.Pixel); //Check if the above setting is supported by the client. if (!this.rdprfxAdapter.CheckIfClientSupports(opMode, enAlgorithm)) { return(false); } rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId); rdprfxAdapter.SendImageToClient(bitmap, opMode, enAlgorithm, destLeft, destTop); rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId); rdprfxAdapter.ExpectTsFrameAcknowledgePdu(frameId, waitTime); return(true); }
/// <summary> /// Method to send an image to the client. /// </summary> /// <param name="image">The image to be sent.</param> /// <param name="destLeft">The left bound of the frame.</param> /// <param name="destTop">The top bound of the frame.</param> /// <param name="frameId">The index of the sending frame.</param> public static void SendImageToClient(Image image, ushort destLeft, ushort destTop, uint frameId) { OperationalMode opMode = OperationalMode.ImageMode; EntropyAlgorithm enAlgorithm = EntropyAlgorithm.CLW_ENTROPY_RLGR1; Site.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (Begin) with frameID: {0}.", frameId); rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_BEGIN, frameId); Site.Log.Add(LogEntryKind.Comment, "Sending encoded bitmap data to client. Operational Mode = {0}, Entropy Algorithm = {1}, destLeft = {2}, destTop = {3}.", opMode, enAlgorithm, destLeft, destTop); rdprfxAdapter.SendImageToClient(image, opMode, enAlgorithm, destLeft, destTop); Site.Log.Add(LogEntryKind.Comment, "Sending Frame Marker Command (End) with frameID: {0}.", frameId); rdpbcgrAdapter.SendFrameMarkerCommand(frameAction_Values.SURFACECMD_FRAMEACTION_END, frameId); }