Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / ps-surface-source.php
blob780fa54c16fcd2e066cf9c2a97706385307975e7
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 CairoPSSurface("ps-surface-source.ps", $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 CairoPSSurface("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("ps-surface-source-php.png");