Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / a1-traps-sample.php
blob422bb6c5714d78b07a02fbed4ecceb87e018283d
1 <?
2 $points = 10.0;
3 $step = 1.0/ $points;
4 $pad = 1.0;
5 $width = ($pad + ($points*2) + $pad);
6 $height = $width;
7 $sur = new CairoImageSurface(FORMAT_ARGB32,$width,$height);
8 //$s = new CairoImageSurface(FORMAT_ARGB32,1,1);
9 //$s->create_from_data($n, FORMAT_ARGB32, 1, 1, 4);
10 $con = new CairoContext($sur);
11 //$c = new CairoContext($s);
12 //$c->set_source_rgb(0,0,0);
13 //$c->paint();
14 $con->setSourceRgb(1,1,1);
15 $con->paint();
17 $con->setSourceRgb(0,0,0);
18 $con->translate($pad, $pad);
19 $con->setAntialias(ANTIALIAS_NONE);
21 for($i = 0; $i < $points; $i++)
22 for($j = 0; $j < $points; $j++) {
23 $t1 = (2 * $i * 1.0) + (($i) * $step * 2.0);
24 $t2 = (2 * $j * 1.0) + (($j) * $step * 1.0);
25 //$con->set_source_surface($s, $t1, $t2);
26 //$pat = $con->get_source();
27 //$pat->set_filter(FILTER_NEAREST);
28 $con->rectangle($t1, $t2, 1, 1);
29 $con->fill();
31 $sur->writeToPng('a1-traps-sample-php.png');