Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / testcases / phpCairo / a1-image-sample.php
bloba9da60e200abea2d22e9e9450a54db5618a291b1
1 <?
2 $points = 10;
3 $step = 1.0/ $points;
4 $pad = 1;
5 $width = ($pad + ($points*2) + $pad);
6 $height = $width;
7 //$n1 = array("255","255","0","0");
8 //$n = implode($n1);
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);
15 $c->paint();
16 $con->setSourceRgb(1,1,1);
17 $con->paint();
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);
30 $con->paint();
32 $sur->writeToPng('a1-image-sample-php.png');