re-ordered functions as in cairo online doc