Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Android development I found nine patch images very useful to draw images that have a fixed border. When the image is scaled the inner part scales, but the border stays at a fixed size.

I was looking for something similar in DirectX. Does anyone have information/pointers to nine patch images in DirectX?

share|improve this question

Well, to do 9-Patch drawing, you would find the coordinates of the individual regions and then convert those to UV coords (percentage of image size). You would then draw those to quads.

The corners quads would be the size of the region of the image and the middle sections would be whatever dimensions you want (where the edges only manipulate the edge direction).

You would also set your projection matrix to an orthographic view if you wanted to draw in 2D to get accurate pixel representation.

share|improve this answer
thanks, for your answer, are you aware of any existing implementations? I am aware that it is not particularly hard, I just thought I can't be the first one needing this :P – thumbmunkeys Jan 6 '13 at 19:31
Typically its used in a GUI so maybe some GUI library would have one, but I don't know of anything personally. It's easy enough to make. – CobaltHex Jan 6 '13 at 19:55
alright, thanks – thumbmunkeys Jan 6 '13 at 21:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.