Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / testcases / phpCairo / bilevel-image.php
blob85007609a274c540fcdcffb00ad54fe49012d06b
1 <?
2 $width = 12;
3 $height = 4;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
5 $con = new CairoContext($sur);
6 $s = new CairoImageSurface(FORMAT_ARGB32,$width,$height);
7 $str="";
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);
31 $con->paint();
33 $con->setSourceSurface($s,0,0);
34 //$con->mask_surface($s,0,0);
35 $con->paint();
36 $sur->writeToPng("bilevel-image-php.png");