CreativeInquiry / PEmbroider

Embroidery Library for Processing
Other
442 stars 28 forks source link

Registration point for type is not working as expected #5

Closed golanlevin closed 4 years ago

golanlevin commented 4 years ago

This type was set with the registration point (0,0). It is located at the incorrect position and should behave just like regular Processing.

Screen Shot 2020-06-06 at 6 53 38 PM

Here's the code:


import processing.embroider.*;
PEmbroiderGraphics E;

void setup() {
  noLoop(); 
  size (600, 400);
  PFont myFont = createFont("Helvetica-Bold", 100);

  E = new PEmbroiderGraphics(this, width, height);
  String outputFilePath = sketchPath("PEmbroider_text.vp3");
  E.setPath(outputFilePath); 

  E.beginDraw(); 
  E.clear();

  E.hatchMode(PEmbroiderGraphics.PARALLEL);
  E.strokeMode(PEmbroiderGraphics.PERPENDICULAR);
  E.hatchSpacing(4);
  E.strokeSpacing(4);

  E.textFont(myFont);
  E.fill(0);
  E.strokeWeight(12);
  E.textSize(250);
  E.text("ABC", 0, 0);

  //-----------------------
  E.visualize();
  //E.optimize(); // slow, but very good and important
  //E.endDraw(); // write out the file
}
LingDong- commented 4 years ago

@golanlevin Now fixed in : 1cbdf12c1cb65519556c0ab5fdcc12586994a2e8

Example also updated: examples/PEmbroider_text/PEmbroider_text.pde

PEmbroider_text

In the same commit I also added

E.stitchLength(float x); 
// stitch length will be approximately this length in pixels

E.minStitchLength(float x); 
// stitch length will be at least this length, 
// inputs containing smaller stitches will be resampled

E.setStitch(float min_stitch_length, float stitch_length, float resample_noise);  
// larger resample noise, less stitch alignment patterns, default = 0.5