Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / device-offset-positive.php
blob206c6d4b7025a6269f990a1a54e573f101e61eb3
1 <?
2 $size = 10;
3 $pad = 2;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $size, $size);
5 $con = new CairoContext($sur);
7 $con->setSourceRgb(0,0,1);
8 $con->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad);
9 $con->fill();
11 $s = $con->getGroupTarget();
12 $c = $s->getContent();
13 $s1 = $s->createSimilar($c, $size/2, $size/2);
15 $c = new CairoContext($s1);
16 $c->setSourceRgb(1,0,0);
17 $c->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad);
18 $c->fill();
20 $s1->setDeviceOffset($size/2, $size/2);
21 $con->setSourceSurface($s1, $size/2, $size/2);
22 $con->paint();
24 $sur->writeToPng("device-offset-positive-php.png");