Reputation: 15350
Is there a way to work with stretchable images like 9-patch for android or resizableImageWithCapInsets:edgeInsets for IOS on all platforms?
Upvotes: 4
Views: 1561
Reputation: 2210
There is a paid library http://forms9patch.com i have used it myself and it is pretty solid
You can turn any image to 9patch in crossplaform manner:
var image2 = new Forms9Patch.Image () {
Source = ImageSource.FromResource("MyDemoApp.Resources.Images.redribbon.png"),
CapInsets = new Thickness(23, 0, 110, 0),
}
EDIT: Note that a Forms9Patch license is not required to use Forms9Patch.ImageSource. So you can use Forms9Patch.ImageSource using this library for free
Upvotes: 1
Reputation: 3362
In traditional Xamarin development you need to deal with the platform native image capabilities. The platforms don't share any image format and you wouldn't want to handle images platform agnostic anyways as the native classes are optimized for memory and performance. You would lose every benefit of those optimization.
In Xamarin.Forms you would need to look for a 3rd party library like NGraphics or NControl maybe...
See this excellent article about Working with Images in Xamarin.Forms.
Upvotes: 1