Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / scale-down-source-surface-paint.php
blobf7ba1ecd55a074419a4206200ada79cbdcde7529
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 6, 6);
3 $con = new CairoContext($sur);
5 $data="";
7 for($i=0; $i<2;$i++) {
8 $data.=chr(0xff);
9 $data.=chr(0xff);
10 $data.=chr(0xff);
11 $data.=chr(0xff);
13 $data.=chr(0xff);
14 $data.=chr(0xff);
15 $data.=chr(0xff);
16 $data.=chr(0xff);
18 $data.=chr(0x00);
19 $data.=chr(0x00);
20 $data.=chr(0xff);
21 $data.=chr(0xff);
23 $data.=chr(0x00);
24 $data.=chr(0x00);
25 $data.=chr(0xff);
26 $data.=chr(0xff);
29 for($i=0; $i<2;$i++) {
30 $data.=chr(0x00);
31 $data.=chr(0xff);
32 $data.=chr(0x00);
33 $data.=chr(0xff);
35 $data.=chr(0x00);
36 $data.=chr(0xff);
37 $data.=chr(0x00);
38 $data.=chr(0xff);
40 $data.=chr(0xff);
41 $data.=chr(0x00);
42 $data.=chr(0x00);
43 $data.=chr(0xff);
45 $data.=chr(0xff);
46 $data.=chr(0x00);
47 $data.=chr(0x00);
48 $data.=chr(0xff);
50 $con->setSourceRgb(0,0,0);
51 $con->paint();
53 $s = new CairoImageSurface(FORMAT_ARGB32, 100,100);
54 $s->createFromData($data, FORMAT_RGB24, 4, 4, 16);
55 //$con->test_paint_checkered();
56 $con->scale(0.5,0.5);
57 $con->setSourceSurface($s,4,4);
58 $pat = $con->getSource();
59 $pat->setFilter( FILTER_NEAREST);
60 $con->paint();
62 $sur->writeToPng("scale-down-source-surface-paint-php.png");