generalized blitting function