I’m importing some SVGs into a sketch that I’d like to style using HandyRenderer. It looks like there may be some hoops to jump through, as just applying the Handy class to the shape statement doesn’t work
h = new HandyRenderer(this);
heart = loadShape("heart-svgrepo-com.svg");
h.shape(heart, width/2, height/2);
Anyone have any thoughts? Thanks!
Looks like the library doesn’t have the same API as Processing, when hovering on the
shape statement it accepts the following arguments:
The method shape(float, float, float) in the type HandyRenderer is
not applicable for the arguments (PShape, int, int)
shape in the source code didn’t give any results…
You can either ask the author if it’s supported or was planned or fork the repository and make your own version!
Good idea, asking the author. I’ve done that now, and if there’s a solution, I’ll follow up here.
/** Draws a closed 2d polygon based on the given arrays of vertices.
* @param xCoords x coordinates of the shape.
* @param yCoords y coordinates of the shape.
public void shape(float xCoords, float yCoords)
Convert the svg PShape’s coordinates to two float arrays, and call the method above.
I’ll see if I can make that work. Thanks!