Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / leaky-dashed-rectangle.php
blob80f4b85ae290c890f8f3282257292d1ee38847c2
1 <?
2 $width = 60;
3 $height = 60;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
5 $con = new CairoContext($sur);
7 $dash = array(4.0, 2.0);
9 $con->setSourceRgb ( 1, 1, 1);
10 $con->paint ();
12 $con->setSourceRgb ( 0., 0., 0);
14 $con->translate ( 0.5, .5);
15 $con->setLineWidth ( 1); /* This is vital to reproduce the bug. */
17 /* First check simple rectangles */
18 $con->setSourceRgb ( 0., 0., 0);
19 $con->rectangle ( -$width/4, -$height/4, $width, $height);
20 $con->stroke ();
21 $con->rectangle ( $width+$width/4, -$height/4, -$width, $height);
22 $con->stroke ();
23 $con->rectangle ( -$width/4, $height+$height/4, $width, -$height);
24 $con->stroke ();
25 $con->rectangle ( $width+$width/4, $height+$height/4, -$width, -$height);
26 $con->stroke ();
28 $con->setDash ( $dash, 2, 0);
30 /* And now dashed. */
31 $con->setSourceRgb ( 1., 0., 0);
32 $con->rectangle ( -$width/4, -$height/4, $width, $height);
33 $con->stroke ();
34 $con->setSourceRgb ( 0., 1., 0);
35 $con->rectangle ( $width+$width/4, -$height/4, -$width, $height);
36 $con->stroke ();
37 $con->setSourceRgb ( 0., 0., 1);
38 $con->rectangle ( -$width/4, $height+$height/4, $width, -$height);
39 $con->stroke ();
40 $con->setSourceRgb ( 1., 1., 0);
41 $con->rectangle ( $width+$width/4, $height+$height/4, -$width, -$height);
42 $con->stroke ();
43 $sur->writeToPng("leaky-dashed-rectangle-php.png");