Skip to content
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
runrevmark:lcb-canvas_svg
Closed

[[ SvgViewWidget ]] Add a simple 'SVG View' widget#3089
runrevmark wants to merge 16 commits intolivecode:developfrom
runrevmark:lcb-canvas_svg

Conversation

@runrevmark
Copy link
Copy Markdown
Contributor

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.

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.
@peter-b
Copy link
Copy Markdown
Contributor

peter-b commented Oct 20, 2015

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

@runrevmark
Copy link
Copy Markdown
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.

@peter-b
Copy link
Copy Markdown
Contributor

peter-b commented Oct 20, 2015

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

@runrevmark
Copy link
Copy Markdown
Contributor Author

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants