Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
tim_a_lacey
Level 7

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.
0 Kudos
2 Replies
TheEndless
Level 7

Re: 9-slice scaling

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.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
tim_a_lacey
Level 7

Re: 9-slice 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.
0 Kudos