This repository was archived by the owner on Aug 31, 2021. It is now read-only.
[[ SvgViewWidget ]] Add a simple 'SVG View' widget#3089
Closed
runrevmark wants to merge 16 commits intolivecode:developfrom
Closed
[[ SvgViewWidget ]] Add a simple 'SVG View' widget#3089runrevmark wants to merge 16 commits intolivecode:developfrom
runrevmark wants to merge 16 commits intolivecode:developfrom
Conversation
Add a reference counted MCGSvg object to libgraphics. The MCGSvg object represents a parsed, and renderable SVG file. The SVG parser currently used supports a small subset - just entities resolving to paths, with support for solid color, linear gradient and radial gradient fills. The SVG is rendered using libgraphics API calls, gradient transforms currently appear to be being mapped incorrectly. The SVG parser being used is https://github.com/memononen/nanosvg.
Added a CanvasSvg object wrapping the MCGSvgRef abstraction along with syntax to fetch bounding and view boxes, and to render to a canvas.
The SvgRef object needs to mark itself as valid if it successfully loads its SVG.
Contributor
|
As mentioned in private discussion, ideally nanosvg.h should live somewhere in livecode-thirdparty. 😉 |
Contributor
Author
|
@peter-b: Indeed, I also need to separate it into two PRs - one for the SVG abstraction in canvas and below, and one for the widget itself :) I just thought I'd push it in case any interested observers wanted to try it out. |
Contributor
|
@runrevmark: Well, I don't think that would be entirely necessary but hey, it's your feature. 😀 |
Contributor
Author
It is possible for shapes to be present in an SVG file, but marked as invisible. Such shapes will now not be rendered.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds both an 'SVG' abstraction at the Canvas level, and a simple 'SVG View' widget.
The SVG abstraction is based on https://github.com/memononen/nanosvg which is a very small SVG subset parser. The subset it understands includes shapes, paths, transforms, color fills as well as linear and radial gradients.
The SVG View widget wraps an SVG document specified by an 'svgText' property, and scales and fills the widgets bounds with a specified rectangle of the SVG document (visibleBox).
Note: The widget does not yet load / save its state, and gradient transforms are not currently mapping correctly.