# Handy renderer on SVGs?

**URL:** <https://discourse.processing.org/t/handy-renderer-on-svgs/36481>\
**Category:** Libraries\
**Created:** [April 20, 2022, 7:13pm UTC](https://discourse.processing.org/t/handy-renderer-on-svgs/36481 "2022-04-20T19:13:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjjolton](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jjjolton/32/11530_2.png) [@jjjolton](https://discourse.processing.org/u/jjjolton)\
**Post date:** [April 20, 2022, 7:13pm UTC](https://discourse.processing.org/t/handy-renderer-on-svgs/36481/1 "2022-04-20T19:13:44Z")

</div>

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

```auto
import org.gicentre.handy.*;

HandyRenderer h;
PShape heart;

void setup()
{
  size(800,800); 
  h = new HandyRenderer(this);
  heart = loadShape("heart-svgrepo-com.svg");
  noLoop();
  
}
void draw()
{
  background(247,230,197);
  heart.disableStyle();
  h.shape(heart, width/2, height/2);
}

```

Anyone have any thoughts? Thanks!

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [April 20, 2022, 7:48pm UTC](https://discourse.processing.org/t/handy-renderer-on-svgs/36481/2 "2022-04-20T19:48:08Z")

</div>

Hi @jjjolton,

Looks like the library doesn’t have the same API as Processing, when hovering on the `shape` statement it accepts the following arguments:

```auto
The method shape(float[], float[], float[]) in the type HandyRenderer is 
not applicable for the arguments (PShape, int, int)

```

Also [searching `svg` or `shape` in the source code](https://github.com/gicentre/handy/tree/main/Handy/src/org/gicentre/handy) 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! 😉

---

<div class="post-metadata">

**Author:** ![jjjolton](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jjjolton/32/11530_2.png) [@jjjolton](https://discourse.processing.org/u/jjjolton)\
**Post date:** [April 20, 2022, 7:54pm UTC](https://discourse.processing.org/t/handy-renderer-on-svgs/36481/3 "2022-04-20T19:54:14Z")

</div>

Good idea, asking the author. I’ve done that now, and if there’s a solution, I’ll follow up here.

Thanks!

---

<div class="post-metadata">

**Author:** ![micycle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micycle/32/201_2.png) [@micycle](https://discourse.processing.org/u/micycle)\
**Post date:** [April 21, 2022, 1:07pm UTC](https://discourse.processing.org/t/handy-renderer-on-svgs/36481/4 "2022-04-21T13:07:33Z")

</div>

```auto
/** 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)
{
	shape(xCoords,yCoords,true);
}

```

Convert the svg PShape’s coordinates to two float arrays, and call the method above.

---

<div class="post-metadata">

**Author:** ![jjjolton](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jjjolton/32/11530_2.png) [@jjjolton](https://discourse.processing.org/u/jjjolton)\
**Post date:** [April 23, 2022, 3:53pm UTC](https://discourse.processing.org/t/handy-renderer-on-svgs/36481/5 "2022-04-23T15:53:31Z")

</div>

I’ll see if I can make that work. Thanks!
