New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SvgImage: allow 9-slice SVG rendering #23

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

Comments

Projects
None yet
2 participants
@patridge

patridge commented Feb 28, 2016

[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

This comment has been minimized.

Show comment
Hide comment
@chrfalch

chrfalch Feb 28, 2016

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.

Owner

chrfalch commented Feb 28, 2016

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

This comment has been minimized.

Show comment
Hide comment
@chrfalch

chrfalch Feb 28, 2016

Owner

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

Owner

chrfalch commented Feb 28, 2016

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