FromPixelFormat() public static method

Given the dimensions and 16-byte PIXEL_FORMAT record from the VNC Host, deserialize this into a Framebuffer object.
public static FromPixelFormat ( byte b, int width, int height ) : Framebuffer
b byte The 16-byte PIXEL_FORMAT record.
width int The width in pixels of the remote desktop.
height int The height in pixles of the remote desktop.
return Framebuffer
示例#1
0
        /// <summary>
        /// Reads the server's Initialization message, specifically the remote Framebuffer's properties. See RFB Doc v. 3.8 section 6.1.5.
        /// </summary>
        /// <returns>Returns a Framebuffer object representing the geometry and properties of the remote host.</returns>
        public Framebuffer ReadServerInit()
        {
            int         w      = (int)reader.ReadUInt16();
            int         h      = (int)reader.ReadUInt16();
            Framebuffer buffer = Framebuffer.FromPixelFormat(reader.ReadBytes(16), w, h);
            int         length = (int)reader.ReadUInt32();

            buffer.DesktopName = GetString(reader.ReadBytes(length));

            return(buffer);
        }
示例#2
0
        /// <summary>
        /// Reads the server's Initialization message, specifically the remote Framebuffer's properties. See RFB Doc v. 3.8 section 6.1.5.
        /// </summary>
        /// <returns>Returns a Framebuffer object representing the geometry and properties of the remote host.</returns>
        public Framebuffer ReadServerInit()
        {
            int w     = 0;
            int h     = 0;
            int retry = 0;

            while (w <= 0 && h <= 0 && retry < SkipBytesLimit)
            {
                w = (int)reader.ReadUInt16();
                h = (int)reader.ReadUInt16();
                retry++;
            }
            Framebuffer buffer = Framebuffer.FromPixelFormat(reader.ReadBytes(16), w, h);
            int         length = (int)reader.ReadUInt32();

            buffer.DesktopName = GetString(reader.ReadBytes(length));

            return(buffer);
        }