VncSharpWpf.Framebuffer.ToPixelFormat C# (CSharp) Méthode

ToPixelFormat() public méthode

When communicating with the VNC Server, bytes are used to represent many of the values above. However, internally it is easier to use Integers. This method provides a translation between the two worlds.
public ToPixelFormat ( ) : byte[]
Résultat byte[]
		public byte[] ToPixelFormat()
		{
			byte[] b = new byte[16];
			
			b[0]  = (byte) bpp;
			b[1]  = (byte) depth;
			b[2]  = (byte) (bigEndian ? 1 : 0);
			b[3]  = (byte) (trueColour ? 1 : 0);
			b[4]  = (byte) ((redMax >> 8) & 0xff);
			b[5]  = (byte) (redMax & 0xff);
			b[6]  = (byte) ((greenMax >> 8) & 0xff);
			b[7]  = (byte) (greenMax & 0xff);
			b[8]  = (byte) ((blueMax >> 8) & 0xff);
			b[9]  = (byte) (blueMax & 0xff);
			b[10] = (byte) redShift;
			b[11] = (byte) greenShift;
			b[12] = (byte) blueShift;
			// plus 3 bytes padding = 16 bytes
			
			return b;
		}
		

Usage Example

Exemple #1
0
 /// <summary>
 /// Sends the format to be used by the server when sending Framebuffer Updates. See RFB Doc v. 3.8 section 6.3.1.
 /// </summary>
 /// <param name="buffer">A Framebuffer telling the server how to encode pixel data. Typically this will be the same one sent by the server during initialization.</param>
 public void WriteSetPixelFormat(Framebuffer buffer)
 {
     lock (lockObj)
     {
         writer.Write(SET_PIXEL_FORMAT);
         WritePadding(3);
         writer.Write(buffer.ToPixelFormat());           // 16-byte Pixel Format
         writer.Flush();
     }
 }
All Usage Examples Of VncSharpWpf.Framebuffer::ToPixelFormat