5 $width = ($pad +
($points*2) +
$pad);
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);
14 $con->setSourceRgb(1,1,1);
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);
31 $sur->writeToPng('a1-traps-sample-php.png');