Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / testcases / phpCairo / dash-caps-joins.php
blob3b8e5919d3aa5b37bcf475bf5af990c0d4656901
1 <?
2 $linewidth = 10.0;
3 $size = 5*$linewidth;
4 $pad = 2*$linewidth;
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;
12 $con->save();
13 $con->setSourceRgb(1,1,1);
14 $con->paint();
15 $con->restore();
17 for($i = 0; $i<2 ; $i++) {
18 $con->save();
19 $con->setLineWidth($linewidth);
20 $con->setDash($dash, 2, $dashoff);
21 $con->translate($pad, $pad);
23 $con->moveTo(0,0);
24 $con->relLineTo(0,$size);
25 $con->relLineTo($size, 0);
26 $con->closePath();
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);
33 $con->stroke();
35 $con->translate($size+$pad, 0);
37 $con->moveTo(0,0);
38 $con->relLineTo(0,$size);
39 $con->relLineTo($size, 0);
40 $con->closePath();
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);
47 $con->stroke();
48 $con->translate($size+$pad, 0);
50 $con->moveTo(0,0);
51 $con->relLineTo(0,$size);
52 $con->relLineTo($size, 0);
53 $con->closePath();
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);
60 $con->stroke();
61 $con->restore();
62 $con->translate(0,$size+$pad);
63 $dashoff = 0;
65 $sur->writeToPng("dash-caps-joins-php.png");