Could someone please tell me why the PDF doesn't show the dashes that I see on the screen. What would be the best way to output a file so as to show the dashes?
Code:import processing.pdf.*;
int numFlower = 5;
Flower[] flowers1 = new Flower[numFlower];
float[] dashes = { 4.0f, 6.0f, 4.0f, 6.0f};
BasicStroke pen;
void setup(){
size(400,240);
smooth();
pen = new BasicStroke(3.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 4.0f, dashes, 0.0f);
Graphics2D g2 = ((PGraphicsJava2D) g).g2;
g2.setStroke(pen);
}
void draw(){
background(255);
int f = frameCount;
if (f < 2){
frameRate(0.5);
beginRecord(PDF, "gl-##.pdf");
for (int i = 0; i < numFlower; i++){
float w = random(width);
float h = random(height);
if (w < 50){w = w + 50;}
if (w > 350){w = w - 50;}
flowers1[i] = new Flower(w, h, 30, 50, 6, 30); //Flower(x,y,r1,r2,divisions,flare)
}
for(int i = 0; i < numFlower; i++){
flowers1[i].display();
}
endRecord();
}
}
class Flower {
float ox;
float oy;
int r1; //interior points of petals
int r2; //control points of petals
int divisions;
int flare;
Flower(float xIn, float yIn, int r1In, int r2In, int divIn, int flareIn){
ox = xIn;
oy = yIn;
r1 = r1In;
r2 = r2In;
divisions = divIn;
flare = flareIn;
}
void display(){
float inc = 360/divisions;
float x = ox + (cos(radians(inc))*r1);
float y = oy + (sin(radians(inc))*r1);
fill(255);
beginShape();
vertex(x,y);
for (float deg=inc; deg < 360+inc; deg+= inc){ //petals
float angle1 = radians(deg);
float angle2 = radians(deg+inc);
float cx1 = ox + (cos(angle1+PI/flare) * r2);
float cy1 = oy + (sin(angle1+PI/flare) * r2);
float cx2 = ox + (cos(angle2-PI/flare) * r2);
float cy2 = oy + (sin(angle2-PI/flare) * r2);
float x2 = ox + (cos(angle2) * r1);
float y2 = oy + (sin(angle2) * r1);
bezierVertex(cx1,cy1,cx2,cy2,x2,y2);
}
endShape();
noFill();
ellipse(ox,oy,r1*1.5,r1*1.5);
}
}
thanks