Here's some java code that should help you out. (modify to suit your language needs) If anyone sees any problems with this code, please let me know so I can fix my stuff :) float x, y, width, height - these are already set. float hwidth = width / 2; float hheight = height / 2; float ab = (float)(hwidth * (4.0/3.0*(Math.sqrt(2.0)-1.0))); float cd = (float)(hheight * (4.0/3.0*(Math.sqrt(2.0)-1.0))); pdf.moveto(x, y + hheight); // top right pdf.curveto(x + ab, y + hheight, // B x + hwidth, y + cd, // C x + hwidth, y); // bottom right pdf.curveto(x + hwidth, y - cd, x + ab, y - hheight, x, y - hheight); // bottom left pdf.curveto(x - ab, y - hheight, x - hwidth, y - cd, x - hwidth, y); // top left pdf.curveto(x - hwidth, y + cd, x - ab, y + hheight, x, y + hheight); pdf.moveto(x, y + hheight); pdf.fill();
|