Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / self-intersecting.php
blob251f727e9dff0c6fbf85983651f9f5f4aa042227
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 10 , 20);
3 $con = new CairoContext($sur);
4 $con->translate (1.0, 1.0);
6 $con->setSourceRgb (1, 0, 0); /* red */
8 /* First draw the desired shape with a fill */
9 $con->rectangle (0.5, 0.5, 4.0, 4.0);
10 $con->rectangle (3.5, 3.5, 4.0, 4.0);
11 $con->rectangle (3.5, 1.5, -2.0, 2.0);
12 $con->rectangle (6.5, 4.5, -2.0, 2.0);
14 $con->fill ();
16 /* Then try the same thing with a stroke */
17 $con->translate (0, 10);
18 $con->moveTo (1.0, 1.0);
19 $con->relLineTo ( 3.0, 0.0);
20 $con->relLineTo ( 0.0, 6.0);
21 $con->relLineTo ( 3.0, 0.0);
22 $con->relLineTo ( 0.0, -3.0);
23 $con->relLineTo (-6.0, 0.0);
24 $con->closePath ();
26 $con->setLineWidth (1.0);
27 $con->stroke ();
28 $sur->writeToPng("self-intersecting-php.png");