Live data from Hacker News

SVG can do that?

slides.com

171–180 of 202 posts

Re: SVG can do that?

#171

Earlier quoted context omitted.

Wow, this is cool. It looks like an API capable of things that Vector Magic[1] can do, but FOSS. Vector Magic has been excellent for some occasions where you have a rasterized clipart, but need it as a vector. [1] https://vectormagic.com/

Inkscape does have such a feature too. While importing a bitmap image, you can specifically "convert" it to vector graphic. Works fairly well.

> Inkscape does have such a feature too.

Inkscape calls Potrace, but you can you use Potrace directly from the command line, too.

https://en.wikipedia.org/wiki/Potrace

Re: SVG can do that?

#172
post #76

This showcases what's wrong with SVG: It does way too much! To be useful as a vector image format, there should be strict rules (and less cruft). Why is there no libsvg like libjpeg or libpng? Why have interaction as part of an image format? SVG lives in an uncanny valley between jpeg and flash/js. I think there is still a big need for a real vector interchange and display format. Right now people pick a "good" subse…

> Why is there no libsvg like libjpeg or libpng? nanosvg is pretty good: https://github.com/memononen/nanosvg

Here is a Go library for SVG generation:

https://github.com/ajstarks/svgo https://speakerdeck.com/ajstarks/svgo-code-plus-picture-exam...

Re: SVG can do that?

#173

SVG works so fantastically well with React -- it's just part of the DOM, after all. Unless there are performance concerns, that reason alone would make me choose it over Canvas every time. Shameless plug, one of my first experiments with SVG+react (+cljs): https://polymeris.github.io/carlos/ Done in one day, without knowing the tech.

> Unless there are performance concerns, that reason alone would make me choose it over Canvas every time.

I agree, but ironically am one of the few here with a use-case that seems to be in the canvas-is-always-better category, and performance reasons aren't even the only motivation (although that matters too).

I'm working on a data browser of huge data sets, and the plotted data needs to maximise the use of the limited available pixels to convey as much information as possible (see [0] for an example). At that point canvas is the more convenient option.

[0] http://linnarssonlab.org/flamemaps/

Re: SVG can do that?

#174

I use svg all the time to make tiny web interfaces for embedded systems. When the entire web app has to fit in 350k, you don't have space for gif's or jpg's.

If your embedded system only has 350 kB of space for your app how on earth do you fit a browser in there? Or do you only use the 'static' features of SVG?

Usually this is done in a 'Bring Your Own Device' scenario, where the user has a standard mobile/tablet that the UI is shown on. Using a webapp served by the embedded device allows a zero-install workflow, and zero-config (assuming network connectivity is taken care of).

Re: SVG can do that?

#175

We attempted to do a complex animation in SVG and the primary complaint was that it killed the browser in terms of CPU and memory usage. Are we doing something wrong?

I had the same experience using SVG to render music notation. We hit a performance issue - high CPU usage, skips/stutters - with several hundred to a thousand nodes, some animated. Switching to canvas increased that limit, in that we were able to keep smooth rendering with larger documents.

Did you render a whole document as one SVG, or do tricks like one SVG per line or sheet?

Re: SVG can do that?

#176
post #156
post #73

Earlier quoted context omitted.

I'm guessing Program Manager, which is new-corporate speak for Project Manager.

Project Manager - Writes specs and documentation for individual features. Product Manager - Figures out what new features or changes the product needs to better fit or find a new audience. Usually responsible for doing market research and analysis. Business Product Owner - Similar to product manager, they own all changes associated with a company product. Position should only exist if product is so large, multiple pr…

Just to note, these definitions are no where near universal across organizations.

Re: SVG can do that?

#177

Earlier quoted context omitted.

In my experience, canvas 2D also has a number-of-elements performance ceiling if you're drawing things rather than using images, which feels like it defeats the purpose. For example, try drawing hundreds of coloured rectangles per frame. Easy, right? If you're using WebGL, or any sensible graphics API, yes. If you're using canvas, the web-browser will parse and re-parse your colour expression CSS n times per frame. E…

That’s not exactly surprising - you’re describing a problem with basically every graphics engine. Rasterizing expensive operations before drawing to screen is usually job one of a rendering pipeline

Real graphics APIs can handle dynamic geometry efficiently, have a batching mechanism, and don't force you to express colours through CSS strings.

Rasterising ahead-of-time is all well and good, but it's not something you should have to employ just to draw simple polygons.

Re: SVG can do that?

#178

Earlier quoted context omitted.

In my experience, canvas 2D also has a number-of-elements performance ceiling if you're drawing things rather than using images, which feels like it defeats the purpose. For example, try drawing hundreds of coloured rectangles per frame. Easy, right? If you're using WebGL, or any sensible graphics API, yes. If you're using canvas, the web-browser will parse and re-parse your colour expression CSS n times per frame. E…

> has a number-of-elements performance ceiling if you're drawing things rather than using images, which feels like it defeats the purpose. Well you can generate your imagery programmatically and then render it to canvas as a raster image. Canvas is not purely for implementing a web based drawing app.

Software rasterisation is slow and power-inefficient, and does not scale particularly well with screen size.

Re: SVG can do that?

#179
post #38

Make SVG great again!

Ugh can we not. This phrase is forever polluted, just like the Chaplin mustache or the pledge of allegiance salute before it.

>the pledge of allegiance salute

It's called the [Bellamy salute](https://en.wikipedia.org/wiki/Bellamy_salute), which is based on the [Roman salute](https://en.wikipedia.org/wiki/Roman_salute). For those that want to know more :)

Re: SVG can do that?

#180
post #14

So, how crazy to use SVG for a cross-platform UI?

I did that. It works ok. Some gotchas: 1. SVG has all these seemingly useful features that have non-obvious gotchas. Example: you can give rendering hints for svg or any child shape nodes, like "crispEdges" so that straight lines are aligned to the pixel grid (plus it might turn off anti-aliasing, but that's another matter). Great-- I've got boxes with 1-pixel borders that should always be pixel aligned to look sharp…

Exist a SVG rendered that is not web browser? ie: truly independent? maybe portable?
Post reply on HN