Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / a1-mask.php
blob8772325f584c21d863a9da286c976cbd3e29505e
1 <?
2 $width = 10;
3 $height = 8;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
5 $con = new CairoContext($sur);
6 $s = new CairoImageSurface(FORMAT_A1,$width,$height);
7 $str="";
8 $stride = $s->getStride();
10 for($i=0; $i<8; $i++) {
11 $str=$str . chr(0x14);
12 $str=$str . chr(0xAA);
13 /*$str=$str . chr(255);
14 $str=$str . chr(0);
15 $str=$str . chr(255);
16 $str=$str . chr(0);
17 $str=$str . chr(0);
18 $str=$str . chr(0);*/
21 echo $str;
22 $s->createFromData($str, FORMAT_A1, $width, $height);
23 $con->setSourceRgb(0,0,1);
24 $con->paint();
26 $con->setSourceRgb(1,0,0);
27 $con->maskSurface($s,0,0);
28 $sur->writeToPng("a1-mask-php.png");