Implementing 9-slice scaling with the Canvas API