Added some test cases ....
[phpCairo.git] / testcases / phpCairo / pdf-surface-source.php
blob277e7b78122e65db6a06dbdb3544b2049140eada
1 <?
3 function
4 draw_pattern ($surface_size)
6 global $s;
7 $con = new CairoContext($s);
8 $con->set_source_rgb (1, 1, 1);
9 $con->rectangle (0, 0, $surface_size / 2, $surface_size / 2);
10 $con->fill ();
11 $con->set_source_rgb ( 1, 0, 0);
12 $con->rectangle ($surface_size / 2, 0,$surface_size / 2, $surface_size / 2);
13 $con->fill ();
14 $con->set_source_rgb ( 0, 1, 0);
15 $con->rectangle (0, $surface_size / 2, $surface_size / 2, $surface_size / 2);
16 $con->fill ();
17 $con->set_source_rgb ( 0, 0, 1);
18 $con->rectangle ($surface_size / 2, $surface_size / 2, $surface_size / 2, $surface_size / 2);
19 $con->fill ();
20 // $s->write_to_png("temp1.png");
23 $size = 90;
24 $sur = new CairoPDFSurface("pdf-surface-source.pdf", $size, $size);
25 $sur->set_fallback_resolution(72,72);
26 $con = new CairoContext($sur);
28 $con->set_source_rgb(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->write_to_png("temp1.png");
35 $con->set_source_surface($s, 15.0, 15.0);
36 $con->paint();
37 $sur->write_to_png("pdf-surface-source-php.png");