Updating checkpoint ...
[phpCairo.git] / testcases / phpCairo / pdf-surface-source.php
blob60efac3be751e16bd5e58fd6b018c0f06a9b0892
1 <?
3 function
4 draw_pattern ($surface_size)
6 global $s;
7 $con = new CairoContext($s);
8 $con->setSourceRgb (1, 1, 1);
9 $con->rectangle (0, 0, $surface_size / 2, $surface_size / 2);
10 $con->fill ();
11 $con->setSourceRgb ( 1, 0, 0);
12 $con->rectangle ($surface_size / 2, 0,$surface_size / 2, $surface_size / 2);
13 $con->fill ();
14 $con->setSourceRgb ( 0, 1, 0);
15 $con->rectangle (0, $surface_size / 2, $surface_size / 2, $surface_size / 2);
16 $con->fill ();
17 $con->setSourceRgb ( 0, 0, 1);
18 $con->rectangle ($surface_size / 2, $surface_size / 2, $surface_size / 2, $surface_size / 2);
19 $con->fill ();
20 // $s->writeToPng("temp1.png");
23 $size = 90;
24 $sur = new CairoPDFSurface("pdf-surface-source.pdf", $size, $size);
25 $sur->setFallbackResolution(72,72);
26 $con = new CairoContext($sur);
28 $con->setSourceRgb(0,0,0);
29 $con->paint();
31 $surface_size = $size - 30;
32 $s = new CairoPDFSurface("temp.pdf", $surface_size, $surface_size);
33 draw_pattern($surface_size);
34 $s->writeToPng("temp1.png");
35 $con->setSourceSurface($s, 15.0, 15.0);
36 $con->paint();
37 $sur->writeToPng("pdf-surface-source-php.png");