2 $sur = new CairoImageSurface(FORMAT_ARGB32
,20,20);
5 $con = new CairoContext($sur);
6 $con->set_source_rgb(0,0,1);
8 $s = new CairoImageSurface(FORMAT_A1
, 6400,20);
9 $stride = $s->get_stride();
10 $height = $s->get_height();
11 $width = $s->get_width();
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);
21 $s = new CairoImageSurface(FORMAT_A1
,20, 6400);
22 $stride = $s->get_stride();
23 $height = $s->get_height();
24 $width = $s->get_width();
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");