move common functions into canvas256