Added some test cases ....
[phpCairo.git] / testcases / phpCairo / clip-twice.php
blob3d4266f700bd9d9534c45734588e32eaae46f330
1 <?
2 $width = 64;
3 $height = 64;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
5 $con = new CairoContext($sur);
6 $con->new_path();
7 $con->arc($width/2, $height/2, $width/3, 0, 2 * M_PI);
8 $con->clip();
9 $con->new_path();
10 $con->move_to(0,0);
11 $con->line_to($width/4, $height/2);
12 $con->line_to(0, $height);
13 $con->line_to($width, $height);
14 $con->line_to(3*$width/4, $height/2);
15 $con->line_to($width, 0);
16 $con->close_path();
17 $con->clip();
18 $con->set_source_rgb(0,0,0.6);
19 $con->new_path();
20 $con->move_to(0,0);
21 $con->line_to(0, $height);
22 $con->line_to($width/2, 3*$height/4);
23 $con->line_to($width, $height);
24 $con->line_to($width, 0);
25 $con->line_to($width/2, $height/4);
26 $con->close_path();
27 $con->fill();
28 $con->new_path();
29 $con->arc($width/2, $height/2, $width/5, 0, 2 * M_PI);
30 $con->clip();
31 $con->set_source_rgb(1,1,0);
32 $con->paint();
35 $sur->write_to_png("clip-twice-php.png");