Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / finer-grained-fallbacks.php
blob1cbeb9a2a9bac3aa20637a3d86b4f2b0f9b29576
1 <?
2 $cisize = 10;
3 $pad = 2;
4 $width = $cisize*6.5 + $pad;
5 $height = $cisize*3.5 + $pad;
7 function draw_circle($x, $y)
9 global $con, $cisize;
10 $con->save();
11 $con->translate($x,$y);
12 $con->arc(0,0,$cisize / 2,0,2*M_PI);
13 $con->fill();
14 $con->restore();
17 function draw_circles()
19 global $con, $cisize;
20 draw_circle(0, $cisize*-0.1);
21 draw_circle($cisize*0.4, $cisize*0.25);
22 draw_circle($cisize*2,0);
23 draw_circle($cisize*4,0);
24 draw_circle($cisize*6,0);
27 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
28 $con = new CairoContext($sur);
30 $con->translate($pad, $pad);
31 $con->setSourceRgb(0,1,0);
32 $con->setOperator(OPERATOR_OVER);
33 draw_circle($cisize*0.5, $cisize*1.5);
34 $con->setSourceRgb(1,0,0);
35 $con->setOperator(OPERATOR_ADD);
36 draw_circle($cisize*0.75, $cisize*1.75);
37 $con->setSourceRgb(0,1,0);
38 $con->setOperator(OPERATOR_OVER);
39 $con->translate($cisize*2.5, $cisize*0.6);
40 draw_circles();
41 $con->setSourceRgb(1,0,0);
42 $con->setOperator(OPERATOR_ADD);
43 $con->translate(0, $cisize*2);
44 draw_circles();
46 $sur->writeToPng("finer-grained-fallbacks-php.png");