Sliced Images

385
Vote up!

Have you ever wondered how to create 9-sliced images using Corona? Corona only provides a few possibilities to do it, but it requires 9 previously sliced images to mount it at runtime, but now you can do it using just one image!

- How can I use it?
1. Call display.registerSlicedImage() to register the image you want to slice, passing as parameters the margins in pixels
2. Call display.newSlicedImage() to create as many images as you want!

- How does it work?
Source code is attached, but roughly speaking, it treats the image as an imageSheet with 9 frames created in runtime by the specified margins passed when registering the image

- What can I do?
This add-on features getter and setter functions related to the size. You can also scale it as it's a GroupObject

- What I can't do?
By now, changing color or size transitions aren't available, but I'll keep working on it

And that's it! If you've any request, please let me know!

Category: 
Contributor: 
PhoerLevine