SvgImage: allow 9-slice SVG rendering #23

Closed
patridge opened this Issue Feb 28, 2016 · 2 comments

Projects

None yet

2 participants

@patridge

[Spun off from a issue on NGraphics.]

Potential implementation: https://github.com/twintechs/NControl.Controls.SvgImageView

The goal is to allow functionality similar to 9-patch Android image assets and StretchableImage/CreateResizableImage. Someone consuming the control would set inset values that would dictate corner areas that are preserved while stretching content to render in all the remaining areas.

I've created a control that makes this work (originally based on a different NGraphics-derived SvgImage, but now available in the above NControl-based solution. For more details, check out this blog post describing my [9-slice SVG approach](For more details, check out this blog post describing my 9-slice SVG approach.).

Unfortunately, since this naive 9-slice implementation requires drawing a series of canvases into the final desired canvas, it needs access to the ability to create a platform canvas. (That is why I had to create the custom renderers.) I wasn't sure how to make that work within the NControl system. It looks like NGraphics' next release will offer a Platforms.Current to avoid this entirely, but I wanted to put this out there now in case there is a solution available within the current NControl library for generating a platform canvas.

@chrfalch
Owner

Great! I'll see if it possible for NControl to expose this functionality.

Den 28. feb. 2016 kl. 01.34 skrev Adam Patridge notifications@github.com:

[Spun off from a issue on NGraphics.]

Potential implementation: https://github.com/twintechs/NControl.Controls.SvgImageView

The goal is to allow functionality similar to 9-patch Android image assets and StretchableImage/CreateResizableImage. Someone consuming the control would set inset values that would dictate corner areas that are preserved while stretching content to render in all the remaining areas.

I've created a control that makes this work (originally based on a different NGraphics-derived SvgImage, but now available in the above NControl-based solution. For more details, check out this blog post describing my 9-slice SVG approach.

Unfortunately, since this naive 9-slice implementation requires drawing a series of canvases into the final desired canvas, it needs access to the ability to create a platform canvas. (That is why I had to create the custom renderers.) I wasn't sure how to make that work within the NControl system. It looks like NGraphics' next release will offer a Platforms.Current to avoid this entirely, but I wanted to put this out there now in case there is a solution available within the current NControl library for generating a platform canvas.


Reply to this email directly or view it on GitHub.

@chrfalch
Owner

Opened up issue in NControl library to allow access to platform services: chrfalch/NControl#52

@chrfalch chrfalch closed this Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment