Add basic format and query function

The idea behind this PR is to replace the current format and bbp functions in the buffer by a new pointer datatype which represents a format and allows easier conversion.
Blocks #602.
Note that this is still WIP as there are a few problems which are not solved yet.
Didn't you mean using XRGB at this point?