Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tim_a_lacey
Visitor

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 2
TheEndless
Channel Surfer

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
Visitor

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.