Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC
Accepted Solution

Creating a border using nine-slice image

Hi! I'm trying to create a border using nine-slice image.

 

selectedControlBorder.png is 12x12 px png where middle 4 pixels are transparent:

 

 

selectedControlBorder.amd:

 

#RimCascadesAssetMetaData version=1.0
source: "selectedControlBorder.png"
sliceMargins: 4 4 4 4

Loading it with this code:

	Container *container = Container::create()
			.layout(new StackLayout)
[...]			.add(ImageView::create("asset:///images/other/selectedControlBorder.amd")
				  .preferredSize(500, 500))

 

When it's rendered it seems like some sort of antialiasing is applied. Does anybody know why this happens and how to avoid this? Thanks!

 

 

 


Andrey Fidrya, @zmeyc on twitter
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Creating a border using nine-slice image

Seems margins are off by 1 px. :smileysad:
"sliceMargins: 5 5 5 5" works.

Andrey Fidrya, @zmeyc on twitter
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Creating a border using nine-slice image

Yes, I'd noticed this as well when trying to get a one-pixel border to work. You actually *can't* do it with only a 3x3 image, because of this bug, as far as I could tell.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!