5 $width = ($pad +
($points*2) +
$pad);
7 //$n1 = array("255","255","0","0");
9 $sur = new CairoImageSurface(FORMAT_ARGB32
,$width,$height);
10 $s = new CairoImageSurface(FORMAT_ARGB32
,1,1);
11 //$s->create_from_data($n, FORMAT_ARGB32, 1, 1, 4);
12 $con = new CairoContext($sur);
13 $c = new CairoContext($s);
14 $c->setSourceRgb(0,0,0);
16 $con->setSourceRgb(1,1,1);
19 $con->setSourceRgb(0,0,0);
20 $con->translate($pad, $pad);
21 $con->setAntialias(ANTIALIAS_NONE
);
23 for($i = 0; $i < $points; $i++
)
24 for($j = 0; $j < $points; $j++
) {
25 $t1 = (2 * $i) +
(($i+
1) * $step);
26 $t2 = (2 * $j) +
(($j+
1) * $step);
27 $con->setSourceSurface($s, $t1, $t2);
28 $pat = $con->getSource();
29 $pat->setFilter(FILTER_NEAREST
);
32 $sur->writeToPng('a1-image-sample-php.png');