Added some test cases ....
[phpCairo.git] / testcases / phpCairo / large-source.php
blob5064bf6254273e35eec6f637da33f9c2b9cf07a9
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32,20,20);
3 $redmask = 0x5;
4 $greenmask = 0x50;
5 $con = new CairoContext($sur);
6 $con->set_source_rgb(0,0,1);
7 $con->paint();
8 $s = new CairoImageSurface(FORMAT_A1, 6400,20);
9 $stride = $s->get_stride();
10 $height = $s->get_height();
11 $width = $s->get_width();
12 $data = "";
13 for($y = 0; $y<$height; $y++) {
14 for($x=0; $x<($width+7)/8; $x++)
15 $data = $data . chr(5);
17 $s->create_from_data($data,FORMAT_A1,$width, $height, $stride);
18 $con->set_source_rgb(1,0,0);
19 $con->mask_surface($s);
20 $con->fill();
21 $s = new CairoImageSurface(FORMAT_A1,20, 6400);
22 $stride = $s->get_stride();
23 $height = $s->get_height();
24 $width = $s->get_width();
25 $data = "";
26 for($y = 0; $y<$height; $y++) {
27 for($x=0; $x<($width+7)/8; $x++)
28 $data = $data . chr(80);
30 $s->create_from_data($data,FORMAT_A1,$width, $height, $stride);
31 $con->set_source_rgb(0,1,0);
32 $con->mask_surface($s,0,0);
34 $sur->write_to_png("large-source-php.png");