Added some test cases ....
[phpCairo.git] / testcases / phpCairo / clip-fill-rule.php
blob8a854f49f7896e71848f1261233d2cbcfe29c296
1 <?
2 $starsize = 20;
3 $sur = new CairoImageSurface(FORMAT_ARGB32, $starsize * 2 + 2, $starsize+2);
4 $con = new CairoContext($sur);
5 $con->set_source_rgb(1,0,0);
6 //$con->paint();
7 $con->translate(1,1);
8 $con->save();
10 $con->move_to(10, 0);
11 $con->rel_line_to ( 6, 20);
12 $con->rel_line_to ( -16, -12);
13 $con->rel_line_to ( 20, 0);
14 $con->rel_line_to ( -16, 12);
16 $con->set_fill_rule (FILL_RULE_WINDING);
17 $con->clip ();
18 $con->paint ();
20 $con->restore ();
21 $con->translate ($starsize + 1, 0);
22 $con->save ();
24 $con->move_to(10, 0);
25 $con->rel_line_to ( 6, 20);
26 $con->rel_line_to ( -16, -12);
27 $con->rel_line_to ( 20, 0);
28 $con->rel_line_to ( -16, 12);
30 $con->set_fill_rule (FILL_RULE_EVEN_ODD);
31 $con->clip ();
32 $con->paint ();
34 $con->restore();
35 $sur->write_to_png("clip-fill-rule-php.png");