Skip to content
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

[[ SvgViewWidget ]] Add a simple 'SVG View' widget #3089

Closed
wants to merge 16 commits into from

Conversation

Projects
None yet
2 participants
@runrevmark
Copy link
Contributor

commented Oct 20, 2015

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.

runrevmark added some commits Oct 13, 2015

[[ Graphics ]] MCGSvg Object
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.
[[ Canvas ]] Added Canvas Svg Object.
Added a CanvasSvg object wrapping the MCGSvgRef abstraction along with
syntax to fetch bounding and view boxes, and to render to a canvas.
[[ Graphics ]] Ensure SVG object is valid after create.
The SvgRef object needs to mark itself as valid if it successfully
loads its SVG.
@peter-b

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2015

As mentioned in private discussion, ideally nanosvg.h should live somewhere in livecode-thirdparty. 😉

@runrevmark

This comment has been minimized.

Copy link
Contributor Author

commented Oct 20, 2015

@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.

@peter-b

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2015

@runrevmark: Well, I don't think that would be entirely necessary but hey, it's your feature. 😀

@runrevmark

This comment has been minimized.

Copy link
Contributor Author

commented Oct 20, 2015

svg widget screenshot

@peter-b peter-b added this to the 8.0.0-rc-1 milestone Nov 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.