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->set_source_rgb ( 1, 0, 0);
13 for ($i=0; $i<3; $i++
) {
16 $con->set_line_cap ( $cap[$i]);
18 /* simple degenerate paths */
19 $con->set_line_width ( 6);
20 $con->move_to ( 6, 6);
21 $con->line_to ( 6, 6);
24 $con->translate ( 0, 3*3);
25 $con->move_to ( 6, 6);
29 /* degenerate paths starting with dash on */
30 $con->set_dash ( $dash, 2, 0.);
32 $con->translate ( 0, 3*3);
33 $con->move_to ( 6, 6);
34 $con->line_to ( 6, 6);
37 $con->translate ( 0, 3*3);
38 $con->move_to ( 6, 6);
42 /* degenerate paths starting with dash off */
43 /* these should not draw anything */
44 $con->set_dash ( $dash, 2, 2.);
46 $con->translate ( 0, 3*3);
47 $con->move_to ( 6, 6);
48 $con->line_to ( 6, 6);
51 $con->translate ( 0, 3*3);
52 $con->move_to ( 6, 6);
56 /* this should draw a single degenerate sub-path
57 * at the end of the path */
58 $con->set_dash ( $dash_long, 2, 6.);
60 $con->translate ( 0, 3*3);
61 $con->move_to ( 6 +
6.0, 6);
62 $con->line_to ( 6, 6);
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->set_dash ( $dash_long, 2, 6.);
70 $con->translate ( 0, 3*3);
71 $con->move_to ( 6 +
6.0, 6);
72 $con->line_to ( 6, 6);
73 $con->line_to ( 6, 6);
78 $con->translate ( 3+
6+
3, 0);
80 $sur->write_to_png("degenerate-path-php.png");