Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / testcases / phpCairo / degenerate-path.php
blob66ffb6230b6b481880cc5540116e6b01ce584249
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32,3*(3+6+3), 8*(6+3) + 3);
3 $con = new CairoContext($sur);
6 $cap = array(LINE_CAP_ROUND, LINE_CAP_SQUARE, LINE_CAP_BUTT);
8 $dash = array(2.0, 2.0);
9 $dash_long = array(6.0, 6.0);
11 $con->setSourceRgb ( 1, 0, 0);
13 for ($i=0; $i<3; $i++) {
14 $con->save ();
16 $con->setLineCap ( $cap[$i]);
18 /* simple degenerate paths */
19 $con->setLineWidth ( 6);
20 $con->moveTo ( 6, 6);
21 $con->lineTo ( 6, 6);
22 $con->stroke ();
24 $con->translate ( 0, 3*3);
25 $con->moveTo ( 6, 6);
26 $con->closePath ();
27 $con->stroke ();
29 /* degenerate paths starting with dash on */
30 $con->setDash ( $dash, 2, 0.);
32 $con->translate ( 0, 3*3);
33 $con->moveTo ( 6, 6);
34 $con->lineTo ( 6, 6);
35 $con->stroke ();
37 $con->translate ( 0, 3*3);
38 $con->moveTo ( 6, 6);
39 $con->closePath ();
40 $con->stroke ();
42 /* degenerate paths starting with dash off */
43 /* these should not draw anything */
44 $con->setDash ( $dash, 2, 2.);
46 $con->translate ( 0, 3*3);
47 $con->moveTo ( 6, 6);
48 $con->lineTo ( 6, 6);
49 $con->stroke ();
51 $con->translate ( 0, 3*3);
52 $con->moveTo ( 6, 6);
53 $con->closePath ();
54 $con->stroke ();
56 /* this should draw a single degenerate sub-path
57 * at the end of the path */
58 $con->setDash ( $dash_long, 2, 6.);
60 $con->translate ( 0, 3*3);
61 $con->moveTo ( 6 + 6.0, 6);
62 $con->lineTo ( 6, 6);
63 $con->stroke ();
65 /* this should draw a single degenerate sub-path
66 * at the end of the path. The difference between this
67 * and the above is that this ends with a degenerate sub-path*/
68 $con->setDash ( $dash_long, 2, 6.);
70 $con->translate ( 0, 3*3);
71 $con->moveTo ( 6 + 6.0, 6);
72 $con->lineTo ( 6, 6);
73 $con->lineTo ( 6, 6);
74 $con->stroke ();
76 $con->restore ();
78 $con->translate ( 3+6+3, 0);
80 $sur->writeToPng("degenerate-path-php.png");