4 $sur = new CairoImageSurface(FORMAT_ARGB32
, $width, $height);
5 $con = new CairoContext($sur);
6 $s = new CairoImageSurface(FORMAT_ARGB32
,$width,$height);
8 $stride = $s->getStride();
9 for($i=0; $i<12; $i++
) {
10 $str=$str . chr(0x00); //blue
11 $str=$str . chr(0x00);//green
12 $str=$str . chr(0xff);//red
13 $str=$str . chr(0xff);//alpha
14 $str=$str . chr(0x00);
15 $str=$str . chr(0xff);
16 $str=$str . chr(0x00);
17 $str=$str . chr(0xff);
18 $str=$str . chr(0xff);
19 $str=$str . chr(0x00);
20 $str=$str . chr(0x00);
21 $str=$str . chr(0xff);
22 $str=$str . chr(0xff);
23 $str=$str . chr(0xff);
24 $str=$str . chr(0xff);
25 $str=$str . chr(0xff);
28 $s->createFromData($str, FORMAT_ARGB32
, $width, $height);
29 $wid = $s->getHeight();
30 $con->setSourceRgb(1,1,1);
33 $con->setSourceSurface($s,0,0);
34 //$con->mask_surface($s,0,0);
36 $sur->writeToPng("bilevel-image-php.png");