Added some test cases ....
[phpCairo.git] / testcases / phpCairo / scale-source-surface-paint.php
blob414776bebfd54a6079ce75e31fb6ab8d524d643f
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 12, 12);
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 echo $data;
51 //$con->set_source_rgb(0,0,0);
52 //$con->paint();
54 $s = new CairoImageSurface(FORMAT_ARGB32, 100,100);
55 $s->create_from_data($data, FORMAT_RGB24, 4, 4, 16);
56 //$con->test_paint_checkered();
57 $con->scale(2,2);
58 $con->set_source_surface($s,1,1);
59 $pat = $con->get_source();
60 $pat->set_filter( FILTER_NEAREST);
61 $con->paint();
63 $sur->write_to_png("scale-source-surface-paint-php.png");