2 $sur = new CairoImageSurface(FORMAT_ARGB32
,20,20);
5 $con = new CairoContext($sur);
6 $con->setSourceRgb(0,0,1);
8 $s = new CairoImageSurface(FORMAT_A1
, 6400,20);
9 $stride = $s->getStride();
10 $height = $s->getHeight();
11 $width = $s->getWidth();
13 for($y = 0; $y<$height; $y++
) {
14 for($x=0; $x<($width+
7)/8; $x++
)
15 $data = $data . chr(5);
17 $s->createFromData($data,FORMAT_A1
,$width, $height, $stride);
18 $con->setSourceRgb(1,0,0);
19 $con->maskSurface($s);
21 $s = new CairoImageSurface(FORMAT_A1
,20, 6400);
22 $stride = $s->getStride();
23 $height = $s->getHeight();
24 $width = $s->getWidth();
26 for($y = 0; $y<$height; $y++
) {
27 for($x=0; $x<($width+
7)/8; $x++
)
28 $data = $data . chr(80);
30 $s->createFromData($data,FORMAT_A1
,$width, $height, $stride);
31 $con->setSourceRgb(0,1,0);
32 $con->maskSurface($s,0,0);
34 $sur->writeToPng("large-source-php.png");