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);
11 $s = $con->getGroupTarget();
12 $c = $s->getContent();
13 $s1 = $s->createSimilar($c, $size/2, $size/2);
15 $s1->setDeviceOffset($size/-2, $size/-2);
17 $c = new CairoContext($s1);
18 $c->setSourceRgb(1,0,0);
19 $c->rectangle($pad, $pad, $size - 2*$pad, $size - 2*$pad);
22 $con->setSourceSurface($s1, 0, 0);
25 $sur->writeToPng("device-offset-php.png");