Added some test cases ....
[phpCairo.git] / testcases / phpCairo / clip-nesting.php
blob9270a69c0c70a1a99ae813d9457cdd1d43f1989c
1 <?
2 $size = 100;
3 $border = 10;
4 $linewidth = 20;
5 $sur = new CairoImageSurface(FORMAT_ARGB32, $size, $size);
6 $con = new CairoContext($sur);
7 $s = $con->get_group_target();
8 $c = new CairoContext($s);
10 $c->move_to($border, $border);
11 $c->line_to($border + $linewidth, $border);
12 $c->line_to($size - $border, $size - $border);
13 $c->line_to($size - $border-$linewidth, $size - $border);
15 $c->clip();
16 $c->set_source_rgb(0,0,1);
17 $c->paint();
19 $c->set_source_rgb(1,1,1);
20 $c->rectangle($size/2 - $linewidth/2, $border, $linewidth, $size - 2*$border);
21 $c->fill();
23 $c2 = new CairoContext($sur);
24 $c2->set_source_rgb(1,1,1);
25 $c2->rectangle($size - $border - $linewidth, $border, $linewidth, $size - 2 * $border);
26 $c2->fill();
28 $con->set_source_rgb(1,1,1);
29 $con->rectangle($border, $border, $linewidth, $size - 2 * $border);
30 $con->fill();
32 $sur->write_to_png("clip-nesting-php.png");