Move the TileMode paint function into the class itself