VncSharpWpf.Framebuffer.FromPixelFormat C# (CSharp) 메소드

FromPixelFormat() 공개 정적인 메소드

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.
리턴 Framebuffer
		public static Framebuffer FromPixelFormat(byte[] b, int width, int height)
		{
			if (b.Length != 16)
				throw new ArgumentException("Length of b must be 16 bytes.");
			
			Framebuffer buffer = new Framebuffer(width, height);
			
			buffer.BitsPerPixel	= (int) b[0];
			buffer.Depth		= (int) b[1];
			buffer.BigEndian	= (b[2] != 0);
			buffer.TrueColour	= (b[3] != 0);
			buffer.RedMax		= (int) (b[5] | b[4] << 8);
			buffer.GreenMax		= (int) (b[7] | b[6] << 8);
			buffer.BlueMax		= (int) (b[9] | b[8] << 8);
			buffer.RedShift		= (int) b[10];
			buffer.GreenShift	= (int) b[11];
			buffer.BlueShift	= (int) b[12];
			// Last 3 bytes are padding, ignore									

			return buffer;
		}
	}

Usage Example

예제 #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);
        }
All Usage Examples Of VncSharpWpf.Framebuffer::FromPixelFormat