The TS_BITMAP_CAPABILITYSET structure is used to advertise bitmap-orientated characteristics and is based on the capability set specified in [T128] section 8.2.4. This capability is sent by both client and server.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_6_1_2.xml
        /// <summary>
        /// Create a TS_BITMAP_CAPABILITYSET type Capability, 2.2.7.1.2    
        /// </summary>
        /// <param name="desktopWidth">The width of the desktop in the session.</param>
        /// <param name="desktopHeight">The height of the desktop in the session.</param>
        /// <param name="desktopResizeFlag">Desktop resizing is supported or not</param>
        /// <param name="colorSubsampling">Indicates support for chroma subsampling when compressing 32 bpp bitmaps 
        /// ([MS-RDPEGDI] section 3.1.9.1.3).</param>
        /// <param name="dyColorFidelity">Indicates support for lossy compression of 32 bpp bitmaps by reducing color-fidelity
        /// on a per-pixel basis ([MS-RDPEGDI] section 3.1.9.1.4).</param>
        /// <param name="skipAlpha">Indicates that the client supports the removal of the alpha-channel when compressing 
        /// 32 bpp bitmaps. In this case the alpha is assumed to be 0xFF, meaning the bitmap is opaque.</param>
        /// <returns>TS_BITMAP_CAPABILITYSET type Capability</returns>
        public static TS_BITMAP_CAPABILITYSET CreateBitmapCapSet(ushort desktopWidth, ushort desktopHeight,
            desktopResizeFlag_Values desktopResizeFlag,
            bool colorSubsampling,
            bool dyColorFidelity,
            bool skipAlpha)
        {
            TS_BITMAP_CAPABILITYSET bitmapCapabilitySet = new TS_BITMAP_CAPABILITYSET();
            bitmapCapabilitySet.capabilitySetType = capabilitySetType_Values.CAPSTYPE_BITMAP;
            bitmapCapabilitySet.lengthCapability = (ushort)Marshal.SizeOf(bitmapCapabilitySet);
            //A 16-bit, unsigned integer. The server MUST set this field to the color depth of the session,
            //while the client SHOULD set this field to the color depth requested in the Client Core Data (section 2.2.1.3.2).
            bitmapCapabilitySet.preferredBitsPerPixel = 32;
            //A 16-bit, unsigned integer. Indicates whether the client can receive 1 bpp.
            //This field is ignored and SHOULD be set to TRUE (0x0001).
            bitmapCapabilitySet.receive1BitPerPixel = 1;
            //A 16-bit, unsigned integer. Indicates whether the client can receive 4 bpp.
            //This field is ignored and SHOULD be set to TRUE (0x0001).
            bitmapCapabilitySet.receive4BitsPerPixel = 1;
            //A 16-bit, unsigned integer. Indicates whether the client can receive 8 bpp.
            //This field is ignored and SHOULD be set to TRUE (0x0001).
            bitmapCapabilitySet.receive8BitsPerPixel = 1;
            bitmapCapabilitySet.desktopWidth = desktopWidth;
            bitmapCapabilitySet.desktopHeight = desktopHeight;
            bitmapCapabilitySet.pad2octets = 0;
            bitmapCapabilitySet.desktopResizeFlag = desktopResizeFlag;
            //A 16-bit, unsigned integer. Indicates whether bitmap compression is supported.
            //This field MUST be set to TRUE (0x0001) because support for compressed bitmaps is required for a connection to proceed.
            bitmapCapabilitySet.bitmapCompressionFlag = 1;
            //An 8-bit, unsigned integer. Client support for 16 bpp color modes.
            //This field is ignored and SHOULD be set to 0.
            bitmapCapabilitySet.highColorFlags = 0;
            if (colorSubsampling)
                bitmapCapabilitySet.drawingFlags |= drawingFlags_Values.DRAW_ALLOW_COLOR_SUBSAMPLING;
            if (dyColorFidelity)
                bitmapCapabilitySet.drawingFlags |= drawingFlags_Values.DRAW_ALLOW_DYNAMIC_COLOR_FIDELITY;
            if (skipAlpha)
                bitmapCapabilitySet.drawingFlags |= drawingFlags_Values.DRAW_ALLOW_SKIP_ALPHA;

            bitmapCapabilitySet.drawingFlags |= (drawingFlags_Values)0x10;
            //A 16-bit, unsigned integer. Indicates whether the use of multiple bitmap rectangles is supported in the Bitmap Update (section 2.2.9.1.1.3.1.2).
            //This field MUST be set to TRUE (0x0001) because multiple rectangle support is required for a connection to proceed.
            bitmapCapabilitySet.multipleRectangleSupport = 1;
            bitmapCapabilitySet.pad2octetsB = 0;
            return bitmapCapabilitySet;
        }
 /// <summary>
 /// 2.2.7.1.2
 /// </summary>
 /// <param name="bitmap"></param>
 public void VerifyStructure(TS_BITMAP_CAPABILITYSET bitmap)
 {
     site.CaptureRequirementIfAreEqual<capabilitySetType_Values>(capabilitySetType_Values.CAPSTYPE_BITMAP, bitmap.capabilitySetType, 1096,
         @"In TS_BITMAP_CAPABILITYSET structure, the capabilitySetType field MUST be set to CAPSTYPE_BITMAP (2).");
     site.CaptureRequirementIfAreEqual<ushort>(1, bitmap.receive1BitPerPixel,1104,
         @"In TS_BITMAP_CAPABILITYSET structure, the receive1BitPerPixel field indicates whether the client "
         + @"can receive 1 bit-per-pixel. This field is ignored and SHOULD be set to TRUE (0x0001).");
     site.CaptureRequirementIfAreEqual<ushort>(1, bitmap.receive4BitsPerPixel, 1106,
         @"In TS_BITMAP_CAPABILITYSET structure, the receive4BitsPerPixel field indicates whether the client"
         + @" can receive 4 bit-per-pixel. This field is ignored and SHOULD be set to TRUE (0x0001).");
     site.CaptureRequirementIfAreEqual<ushort>(1, bitmap.receive8BitsPerPixel, 1110,
         @"In TS_BITMAP_CAPABILITYSET structure, the receive8BitsPerPixel field indicates whether the client"
         + @" can receive 8 bit-per-pixel. This field is ignored during capability negotiation and MUST be set to "
         + @"TRUE (0x0001).");
     site.CaptureRequirementIfAreEqual<ushort>(1, bitmap.bitmapCompressionFlag, 1120,
         @"In TS_BITMAP_CAPABILITYSET structure, bitmapCompressionFlag Indicates whether the client supports "
         + @"bitmap compression.This field MUST be set to TRUE (0x0001) because support for compressed bitmaps"
         + @" is required for a connection to proceed.");
     site.CaptureRequirementIfAreEqual<byte>(0, bitmap.highColorFlags, 1123,
         @"In TS_BITMAP_CAPABILITYSET structure, highColorFlags field is ignored during capability negotiation "
         + @"and MUST be set to 0.");
     site.CaptureRequirementIfAreEqual<ushort>(1, bitmap.multipleRectangleSupport, 1131,
         @"In TS_BITMAP_CAPABILITYSET structure, multipleRectangleSupport Indicates whether the client supports"
         + @" the use of multiple bitmap rectangles. This field MUST be set to TRUE (0x0001) because multiple "
         + @"rectangle support is required for a connection to proceed.");
 }