cpp implementation of bmpreader.h