Added some test cases ....
[phpCairo.git] / testcases / phpCairo / a1-mask.php
blob4b67562e0067e65959da8eaf1324141b694ff026
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->get_stride();
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->create_from_data($str, FORMAT_A1, $width, $height);
23 $con->set_source_rgb(0,0,1);
24 $con->paint();
26 $con->set_source_rgb(1,0,0);
27 $con->mask_surface($s,0,0);
28 $sur->write_to_png("a1-mask-php.png");