Hacker News new | past | comments | ask | show | jobs | submit login

Maybe I'm missing something but why not use SVG for some of this? Would be perfect for the lozenge pictures.



You can't use an SVG as an image in a notification. A real shame as it would have solved all the device pixel ratio problems, but the SVG spec is absolutely huge (and includes stuff like animation) so I'm not overly surprised that Android doesn't support it.


Hmm, I'm wondering if there's a way now to render an SVG (not the full spec) within a service worker e.g. using PngPong with https://github.com/canvg/canvg


Huh! That's a really fascinating library. My gut instinct is still that it would be a heavy lift, though. Without the Canvas API in the middle you'd need to reimplement pixel by pixel drawing of different shape/curves (PngPong literally only draws squares and copies sections of other images) anti-aliasing, etc. etc.

It would be a fascinating thing to work on, but the OffscreenCanvas API is coming to Chrome[1], so I suspect it would end up being a lot of work that would be obselete after not all that much time.

[1] https://www.chromestatus.com/feature/5424182347169792


This might work for you. pure JS impl of canvas

https://github.com/joshmarinacci/node-pureimage


Interesting, I'll have to take a look. Thanks!


Android doesn’t support SVG, and only added support for VectorDrawables later on.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: