Added some test cases ....
[phpCairo.git] / testcases / phpCairo / set-source.php
blobad5253207080e59ec239514b364af7c4f40e586b
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 5, 5);
3 $con = new CairoContext($sur);
5 $color = "";
6 $color.= chr(0x4c);
7 $color.= chr(0x33);
8 $color.= chr(0x19);
9 $color.= chr(0x80);
11 $s = new CairoImageSurface(FORMAT_ARGB32, 1, 1);
12 $s->create_from_data($color, FORMAT_ARGB32, 1,1,4);
14 $pat = new CairoSurfacePattern($s);
15 $pat->set_extend(EXTEND_REPEAT);
17 for($i=0; $i<5; $i++) {
18 switch($i) {
19 case 0:
20 $con->set_source_rgb(.6,.7,.8);
21 break;
22 case 1:
23 $con->set_source_rgba(.2,.4,.6,.5);
24 break;
25 case 2:
26 $con->set_source_rgba(.2,.4,.6,.5);
27 break;
28 case 3:
29 default:
30 $con->set_source($pat);
33 $con->rectangle($i,0,1,5);
34 $con->fill();
36 $sur->write_to_png("set-source-php.png");