Forum Discussion

tim_a_lacey's avatar
11 years ago

9-slice scaling

Are there any support libraries for 9-slice scaling of images?

Reference: http://radleymarx.com/blog/simple-guide-to-9-patch/
Context: using bitmaps in the 2D API

My current alternative is to split my image file into 9 separate files and scale the non-corner pieces accordingly. I'm putting the feelers out as 9-slice scaling would be simpler.


Any help is appreciated.

2 Replies

  • I wrote my own 9-patch library, but I'm not at liberty to share it. The key is to use ifBitmap.GetByteArray() to get the scaling and padding pixels, then split the image up with roRegions based on those pixel calculations for scaling.
  • "TheEndless" wrote:
    I wrote my own 9-patch library, but I'm not at liberty to share it. The key is to use ifBitmap.GetByteArray() to get the scaling and padding pixels, then split the image up with roRegions based on those pixel calculations for scaling.


    Thanks for your input TheEndless. Given more time, I'd give that a try.
    For the sake of simplicity I have resorted to manually splitting my image file into separate files and scaling accordingly with DrawScaledObject() and the Draw2D API.


    Thanks.