PixelFormat {red,green,blue}_max should be 2**n - 1

Rather than store the 2**n - 1 value, we store the n, so that
we can quickly shift right a pixel to encode it for transport.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Support multiple pixel encodings

* we represent bits per pixel as a variant (BPP_8 | BPP_16 | BPP_32)
  to reflect the only values legal in the protocol
* add Pixel.encode to pack an RGB value into a client-readable integer
  according to the requested PixelFormat.t
* add Pixel.write to write an encoded pixel into a buffer

Signed-off-by: David Scott <dave.scott@eu.citrix.com>