/// <summary>
		/// Creates an object type derived from EncodedRectangle, based on the value of encoding.
		/// </summary>
		/// <param name="rectangle">A Rectangle object defining the bounds of the rectangle to be created</param>
		/// <param name="encoding">An Integer indicating the encoding type to be used for this rectangle.  Used to determine the type of EncodedRectangle to create.</param>
		/// <returns></returns>
		public EncodedRectangle Build(Rectangle rectangle, int encoding)
		{
			EncodedRectangle e = null;

			switch (encoding) {
				case RfbProtocol.RAW_ENCODING:
					e = new RawRectangle(rfb, framebuffer, rectangle);
					break;
				case RfbProtocol.COPYRECT_ENCODING:
					e = new CopyRectRectangle(rfb, framebuffer, rectangle);
					break;
				case RfbProtocol.RRE_ENCODING:
					e = new RreRectangle(rfb, framebuffer, rectangle);
					break;
				case RfbProtocol.CORRE_ENCODING:
					e = new CoRreRectangle(rfb, framebuffer, rectangle);
					break;
				case RfbProtocol.HEXTILE_ENCODING:
					e = new HextileRectangle(rfb, framebuffer, rectangle);
					break;
				case RfbProtocol.ZRLE_ENCODING:
					e = new ZrleRectangle(rfb, framebuffer, rectangle);				
					break;
				default:
					// Sanity check
					throw new VncProtocolException("Unsupported Encoding Format received: " + encoding.ToString() + ".");
			}
			return e;
		}
        /// <summary>
        /// Creates an object type derived from EncodedRectangle, based on the value of encoding.
        /// </summary>
        /// <param name="rectangle">A Rectangle object defining the bounds of the rectangle to be created</param>
        /// <param name="encoding">An Integer indicating the encoding type to be used for this rectangle.  Used to determine the type of EncodedRectangle to create.</param>
        /// <returns></returns>
        public EncodedRectangle Build(Rectangle rectangle, int encoding)
        {
            EncodedRectangle e = null;

            switch (encoding) {
                case RfbProtocol.RAW_ENCODING:
                    e = new RawRectangle(rfb, framebuffer, rectangle);
                    break;
                case RfbProtocol.COPYRECT_ENCODING:
                    e = new CopyRectRectangle(rfb, framebuffer, rectangle);
                    break;
                case RfbProtocol.RRE_ENCODING:
                    e = new RreRectangle(rfb, framebuffer, rectangle);
                    break;
                case RfbProtocol.CORRE_ENCODING:
                    e = new CoRreRectangle(rfb, framebuffer, rectangle);
                    break;
                case RfbProtocol.HEXTILE_ENCODING:
                    e = new HextileRectangle(rfb, framebuffer, rectangle);
                    break;
                case RfbProtocol.ZRLE_ENCODING:
            // TODO: ZRLE is not written yet, but when it is, this needs to be changed.
            //					e = new ZrleRectangle(rfb, framebuffer, rectangle);
            //					break;
                    throw new NotImplementedException("Need to implement Zrle Encoding!!!");
                default:
                    // Sanity check
                    throw new VncProtocolException("Unsupported Encoding Format received: " + encoding.ToString() + ".");
            }
            return e;
        }