Could someone provide me a svg with a gradient that works in processing?
I wan’t to see if I can make processing support svg gradients from svg’s exported from affinity designer, but it would be really helpfull to have a svg that works from another application first.
Can’t upload svg to these forums so I uploaded it to fileDropper.
You’ll need to display this as a PShape as PImage doesn’t support svg.
http://www.filedropper.com/processingfriendlysvg
Edit: Should have said, file created with Illustrator CC 2019
thanks @tribblesontoast, works here with this code
String filebg = "data/processingFriendlySVG.svg";
PShape getsvg;
void setup() {
size(500, 500);
getsvg = loadShape(filebg);
}
void draw() {
shape(getsvg, 0, 0, width,height);
}
and it can be posted here as code too!
file: processingFriendlySVG.svg
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="800px" height="800px" viewBox="0 0 800 800" enable-background="new 0 0 800 800" xml:space="preserve">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.077515e-07" y1="400" x2="800" y2="400">
<stop offset="0" style="stop-color:#9E1F63"/>
<stop offset="1" style="stop-color:#D7DF23"/>
</linearGradient>
<rect x="0" fill="url(#SVGID_1_)" width="800" height="800"/>
</svg>
and looks like:
if no tools like Adobe Illustrator available, try to make the SVG source code here
Both thanks. I’m not gonna need it anymore. The difference between JAVA2D and P2D are big when dealing with SVG. And in general it is really specific what created the SVG. I think in general SVG is a great idea but horribly executed.
One of the main issues is that the SVG spec is massive, and was designed in 1998-2000, and has only very partial support in Processing. Here’s an old interview to give you some of the flavor of that history: https://www.adobe.com/devnet/svg/articles/svg-jon-ferraiolo-interview.html
…and developing support for various advanced SVG features across various browsers has been a two decade project that is ongoing: