In Blackberry 10 Cascades (C++, QT, QML) is there a way to change the shape of an image or imageButton in Blackberry 10 Cascades using an image mask or alpha channel or a masking colour (such as magic pink) - so that images and imageButtons don't have to be in the shape of a rectangle?
2 Answers
As far as I know there's no such limitations in the SDK. The ImageButton
class provides methods for setting and resetting its images so it will be looking like the actual images you supply for it.
There's a good example of this right in the official ImageButton documentation.

- 1,503
- 9
- 21
You can use 9-slice images to make custom shaped buttons. Basically create an image with rounded corners or custom shape and then using 9-slice it will scale correctly.
This blog post by Blackberry should help you get started: http://devblog.blackberry.com/2012/08/cascades-framework-9-slicing/
For a basic example, create your image (myImage.png) and then create a new text file with same name but ending in .amd. (myImage.amd)
Then paste the following into the .amd file (adjust values as needed):
#RimCascadesAssetMetaData version=1.0
sliceMargins: 15 15 15 15
source: "myImage.png"

- 2,251
- 2
- 17
- 28