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