6 $sur = new CairoImageSurface(FORMAT_ARGB32
, 3 * ($pad+
$size) +
$pad, 3*$pad+
2*$size);
7 $con = new CairoContext($sur);
9 $dash = array($linewidth, 1.5*$linewidth);
10 $dashoff = -2*$linewidth;
13 $con->setSourceRgb(1,1,1);
17 for($i = 0; $i<2 ; $i++
) {
19 $con->setLineWidth($linewidth);
20 $con->setDash($dash, 2, $dashoff);
21 $con->translate($pad, $pad);
24 $con->relLineTo(0,$size);
25 $con->relLineTo($size, 0);
27 $con->moveTo(2*$linewidth,0);
28 $con->relLineTo(3*$linewidth, 0);
29 $con->relLineTo(0,3*$linewidth);
31 $con->setLineCap(LINE_CAP_BUTT
);
32 $con->setLineJoin(LINE_JOIN_BEVEL
);
35 $con->translate($size+
$pad, 0);
38 $con->relLineTo(0,$size);
39 $con->relLineTo($size, 0);
41 $con->moveTo(2*$linewidth,0);
42 $con->relLineTo(3*$linewidth, 0);
43 $con->relLineTo(0,3*$linewidth);
45 $con->setLineCap(LINE_CAP_ROUND
);
46 $con->setLineJoin(LINE_JOIN_ROUND
);
48 $con->translate($size+
$pad, 0);
51 $con->relLineTo(0,$size);
52 $con->relLineTo($size, 0);
54 $con->moveTo(2*$linewidth,0);
55 $con->relLineTo(3*$linewidth, 0);
56 $con->relLineTo(0,3*$linewidth);
58 $con->setLineCap(LINE_CAP_SQUARE
);
59 $con->setLineJoin(LINE_JOIN_MITER
);
62 $con->translate(0,$size+
$pad);
65 $sur->writeToPng("dash-caps-joins-php.png");