CreativeInquiry / PEmbroider

Embroidery Library for Processing
Other
443 stars 28 forks source link

"Outlines" via dilation #73

Closed golanlevin closed 3 years ago

golanlevin commented 4 years ago

Hi @LingDong- , how easy would it be to implement the following feature, "outlines", via dilation, minkowski-sum, etc.:

E.outlineWeight(20); 
E.beginOutline();
E.rect(100,100,100,100); 
E.circle(150,100,80,80); 
E.endOutline();

IMG_8703

LingDong- commented 4 years ago

Hi @golanlevin, couldn't we just use PEmbroiderBooleanShapeGraphics for that? e.g.

  PEmbroiderBooleanShapeGraphics BSG = new PEmbroiderBooleanShapeGraphics(width,height);
  BSG.rect(100,100,100,100);
  BSG.circle(200,100,100);
  BSG.triangle(150,190,280,140,200,260);

  E.strokeMode(E.TANGENT);
  E.strokeWeight(30);
  E.image(BSG,0,0);
Screen Shot 2020-06-29 at 2 07 00 PM
golanlevin commented 4 years ago

Yes. Thanks, I felt certain we had all the ingredients. Outlines are a popular feature, and so I will call this out as an actual demo example.

LingDong- commented 4 years ago

:)

BTW, I just added more wrapping to the BooleanShapeGraphics, by keeping an instance of it within the PEmbroiderGraphics. So now you can do this for the same effect as above:

  E.strokeMode(E.TANGENT);
  E.strokeWeight(30);

  E.beginComposite();
  E.composite.rect(100,100,100,100);
  E.composite.circle(200,100,100);
  E.composite.triangle(150,190,280,140,200,260);
  E.endComposite();

d5f0cedadf9887d0523a5451d593ee5847211fc2

golanlevin commented 4 years ago

@tatyanade if you have time to make a demo of this (e.g. something like "PEmbroider_shape_outlines") that would be amazing. I'm working on an unrelated deadline (book with Tega) and would appreciate your help making this new example.