Added some test cases ....
[phpCairo.git] / testcases / phpCairo / a8-mask.php
blobb2e875c5f4329bc22b656622056406c695f947cb
1 <?
2 $width = 8;
3 $height = 8;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
5 $con = new CairoContext($sur);
6 $s = new CairoImageSurface(FORMAT_A8,$width,$height);
7 $str="";
8 $stride = $s->get_stride();
10 for($i=0; $i<8; $i++) {
11 $str=$str . chr(0);
12 $str=$str . chr(0);
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_A8, $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("a8-mask-php.png");