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

SVG support? #21

Closed
EnCey opened this issue Feb 24, 2016 · 6 comments
Closed

SVG support? #21

EnCey opened this issue Feb 24, 2016 · 6 comments

Comments

@EnCey
Copy link

EnCey commented Feb 24, 2016

Are you working on or planning to support SVG?

Being able to load a SVG document and then rasterize it to export as e.g. PNG would be immensely valuable.

@bholmes
Copy link
Contributor

bholmes commented Feb 24, 2016

To my knowledge Skia does not support SVG loading. If and when that is added to the native library we will surface that API to C#.

@EnCey
Copy link
Author

EnCey commented Feb 24, 2016

I only read the wikipedia article where it says

Skia also has front-ends that allow it to convert popular vector graphics formats such as SVG, PostScript, PDF, SWF, and Adobe Illustrator files into its own API calls

But on skia.org I also only found the experimental SkSVG canvas, which appears to be a back-end (?) component.

Personally I'd only be interested in the front-end anyway, as that appears to be the component that reads SVG.

But I take it that the SVG front-end won't be a part of SkiaSharp?
Or would this be something that is implemented in a separate project?

@Naburimannu
Copy link

In listing front-ends, that wikipedia article is citing an inaccurate third-party post from 2011.

Skia has both a SVG parser (in include/svg/parser) and backend (in include/svg); SkSVGCanvas is part of the backend. As far as I know only the backend is currently maintained.

@EnCey
Copy link
Author

EnCey commented Feb 24, 2016

In that case, I assume it is safe to say that SkiaSharp probably won't have built-in SVG support for the foreseeable future.
Chrome and Firefox supposedly have their own SVG parsers if skia itself does not maintain its own, and so there's little incentive for the skia devs to work on their SVG front- or backend.

Be that as it may, thank you both for taking the time to answer my questions!

@migueldeicaza
Copy link
Contributor

Loading SVGs is a separate task from SkiaSharp, for far too many reasons.

The best course of action to having a cross-platform SVG loader is probably to look at the Chrome source code and write an importer based on that, leaving behind the DOM loading, hooks and dependencies on the larger parts of the browser like CSS and animations.

Then we can use the test suite built by the librsvg team (librsvg would be ideal: it is a general purpose SVG loader where you can "hook" renderes to, except the license is not iOS friendly).

I will be closing this issue, since this is not something we will treat as a bug in SkiaSharp, it is something to be prototyped elsewhere and then, if successful, we can bring here.

@Emasoft
Copy link

Emasoft commented Mar 15, 2016

If SkyaSharp doesn't support SVG is useless at the moment. Not supporting SVG for a vector library is like not supporting PNG for a bitmap library. I use SVG assets in my Xamarin apps thanks to the NGraphics library, and I have many advantages:

  • SMALLER APP FOOTPRINTS : SVG files are so small you can have your entire app graphics in less than 10k!
  • FAST DEVELOPMENT - No need to code for creating the views. All the UI controls that once needed DAYS or even WEEKS to code, now are made in a couple of minutes in Inkscape. Productivity boost never seen before!
  • EASY TO MODIFY FOR ARTISTS : my graphic artist works with Inkscape and it can edit the SVG files directly, no need to ask me to modify the code to make them work. He can update on the git the svg assets every day and test the changes by himself. And this even at the last moment! It's an amazing workflow!
  • PORTABLE AND INDEPENDENT : No more graphic assets to use just once and then thrashed. The SVG assets you make for iOS you can reuse on Android, Windows, Linux versions of your app and on the web app too, with no changes. Also you do not depend on a single graphician or artist anymore. I can hire any pro to make my assets, and they can deliver them in SVG or change the existing one if they replaced another artist in the same project. Inkscape is also multiplatform, you can edit SVG assets on every computer you have!

This is why I really hope that Xamarin goes the way of NGraphics and add support for SVG assets to SkyaSharp. PLEASE.

Some of my SVG assets (I made them in Inkscape):

ios_app_buttons

You can download the original svg file from my google drive (click on the download button):
http://goo.gl/m7TbmM

Feel free to use them!

For an easier debug, here it is a splitted version of the two main buttons svg files, you can download the zip from here:
https://drive.google.com/file/d/0BxexooDWEb8ublZlcm5yRWpXTzQ/view?usp=sharing

@mattleibow mattleibow added this to To Be Classified in Previous Releases Jul 26, 2018
mattleibow pushed a commit that referenced this issue Jun 11, 2020
@mono mono locked as resolved and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Previous Releases
To Be Classified
Development

No branches or pull requests

5 participants