simplification: factor out common matrix operations
add mupdfbmp API to mupdf FFI interface
use mupdf FFI API instead of mupdfbmp API