Added some test cases ....
[phpCairo.git] / testcases / phpCairo / mask-ctm.php
blob8e5422298a99f9563416472cd8d5917a7938128a
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 10, 10);
3 $con = new CairoContext($sur);
5 $data="";
6 for($i = 0; $i<4; $i++) {
7 $data = $data . chr(0x80);
8 $data = $data . chr(0x00);
9 $data = $data . chr(0x00);
10 $data = $data . chr(0x00);
13 $s = new CairoImageSurface(FORMAT_ARGB32,1,1);
14 $s->create_from_data(data,FORMAT_ARGB32, 2, 2, 8);
15 $pat = new CairoSurfacePattern($s);
16 $con->set_source_rgb(1,0,0);
18 $con->save();
19 $con->translate(2,2);
20 $con->mask($pat);
21 $con->restore();
23 $mat = new CairoMatrix();
24 $mat->translate(-4,-4);
25 $pat->set_matrix($mat);
27 $con->mask($pat);
29 $con->translate(2,2);
30 $con->mask($pat);
32 $sur->write_to_png("mask-ctm-php.png");