Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / caps-joins.php
blobff9be9cc98e8a41bcc8013fb2b188566c8786a96
1 <?
2 $linewidth = 10.0;
3 $size = 5 * $linewidth;
4 $pad = 2 * $linewidth;
5 $width = 3*($pad + $size) + $pad;
6 $height = $pad + $size + $pad;
7 $sur = new CairoImageSurface(FORMAT_ARGB32,$width, $height);
8 $con = new CairoContext($sur);
9 $con->save();
10 $con->setSourceRgb(1,1,1);
11 $con->paint();
12 $con->restore();
14 $con->setLineWidth($linewidth);
15 $con->translate($pad, $pad);
17 $con->moveTo(0,0);
18 $con->relLineTo(0,$size);
19 $con->relLineTo($size,0);
20 $con->closePath();
22 $con->moveTo(2*$linewidth, 0);
23 $con->relLineTo(3*$linewidth, 0);
24 $con->relLineTo(0,3*$linewidth);
26 $con->setLineCap(LINE_CAP_BUTT);
27 $con->setLineJoin(LINE_JOIN_BEVEL);
28 $con->stroke();
30 $con->translate($size+$pad, 0);
32 $con->moveTo(0,0);
33 $con->relLineTo(0,$size);
34 $con->relLineTo($size,0);
35 $con->closePath();
37 $con->moveTo(2*$linewidth, 0);
38 $con->relLineTo(3*$linewidth, 0);
39 $con->relLineTo(0,3*$linewidth);
41 $con->setLineCap(LINE_CAP_ROUND);
42 $con->setLineJoin(LINE_JOIN_ROUND);
43 $con->stroke();
45 $con->translate($size+$pad,0);
47 $con->moveTo(0,0);
48 $con->relLineTo(0,$size);
49 $con->relLineTo($size,0);
50 $con->closePath();
52 $con->moveTo(2*$linewidth, 0);
53 $con->relLineTo(3*$linewidth, 0);
54 $con->relLineTo(0,3*$linewidth);
56 $con->setLineCap(LINE_CAP_SQUARE);
57 $con->setLineJoin(LINE_JOIN_MITER);
58 $con->stroke();
59 $sur->writeToPng("caps-joins-php.png");