Added some test cases ....
[phpCairo.git] / testcases / phpCairo / device-offset.php
blob9dafd6b7e4c5952d4c158a21cc7da36af2010d1b
1 <?
2 $size = 10;
3 $pad = 2;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $size, $size);
5 $con = new CairoContext($sur);
7 $con->set_source_rgb(0,0,1);
8 $con->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad);
9 $con->fill();
11 $s = $con->get_group_target();
12 $c = $s->get_content();
13 $s1 = $s->create_similar($c, $size/2, $size/2);
15 $s1->set_device_offset($size/-2, $size/-2);
17 $c = new CairoContext($s1);
18 $c->set_source_rgb(1,0,0);
19 $c->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad);
20 $c->fill();
22 //$s1->set_device_offset($size/-2, $size/-2);
23 $con->set_source_surface($s1, 0, 0);
24 $con->paint();
26 $sur->write_to_png("device-offset-php.png");