/// <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;

            case RfbProtocol.CURSOR_PSEUDO_ENCODING:
                e = new CursorRectangle(rfb, framebuffer, rectangle);
                break;

            default:
                // Sanity check
                throw new Exception("Unsupported Encoding Format received: " + encoding.ToString() + ".");
            }
            return(e);
        }
Exemplo n.º 2
0
 public static bool IsHovering(Rectangle target)
 {
     return(CursorRectangle.Intersects(target));
 }