github/twui — pull request #91 by luosheng (2012-09-25 00:20:24+00:00)
Title: Fix nine part image drawing

I have an image named `dark_window_bg.png`:
![](http://f.cl.ly/items/2O1V3A2K3l2X0P2A3R3r/dark_window_bg.png)

And I drew the image using the following code in a TUIView's `drawRect:` method:
```objective-c
NSImage *imageBg = [[NSImage imageNamed:@"dark_window_bg"] tui_resizableImageWithCapInsets:TUIEdgeInsetsMake(32, 17, 32, 17)];
[imageBg tui_drawInRect:self.bounds];
```
I was expecting something like:
![](http://f.cl.ly/items/291k151W4433163T471T/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202012-09-25%20%E4%B8%8A%E5%8D%887.54.32.png)

But what I saw on screen is an upside down image.
![](http://f.cl.ly/items/1B0f280A1D3X1J23463e/%E5%B1%8F%E5%B9%95%E5%BF%AB%E7%85%A7%202012-09-25%20%E4%B8%8A%E5%8D%888.04.49.png)

Clearly it worked when I swapped the 'top' images with the 'bottom' images. Although I'm not sure if it's the right way to fix it.