Added unit tests for 9-patch images

Also fixed some rendering issues in gtk.
Fixed rendering of 9-patch images in retina resolution