Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / testcases / phpCairo / rotate-image-surface-paint.php
blob42f4ac5da3fcbe99727f61c92c7e28c779cc232a
1 <?
2 $size = 20;
3 $pad = 2;
4 $surface_size = sqrt(($size - 2*$pad)*($size-2*$pad)/2);
5 $sur = new CairoImageSurface(FORMAT_ARGB32, $size, $size);
6 $con = new CairoContext($sur);
7 $s = new CairoImageSurface(FORMAT_RGB24,
8 $surface_size, $surface_size);
9 $con2 = new CairoContext($s);
10 $con2->setSourceRgb ( 1, 1, 1);
11 $con2->rectangle (
12 0, 0,
13 $surface_size / 2, $surface_size / 2);
14 $con2->fill ();
15 $con2->setSourceRgb ( 1, 0, 0);
16 $con2->rectangle (
17 $surface_size / 2, 0,
18 $surface_size / 2, $surface_size / 2);
19 $con2->fill ();
20 $con2->setSourceRgb ( 0, 1, 0);
21 $con2->rectangle (
22 0, $surface_size / 2,
23 $surface_size / 2, $surface_size / 2);
24 $con2->fill ();
25 $con2->setSourceRgb ( 0, 0, 1);
26 $con2->rectangle (
27 $surface_size / 2, $surface_size / 2,
28 $surface_size / 2, $surface_size / 2);
29 $con2->fill ();
32 /* First paint opaque background (black) so we don't need separate
33 * ARGB32 and RGB24 reference images. */
34 $con->setSourceRgb ( 0, 0, 0); /* black */
35 $con->paint ();
37 $con->translate( $size/2, $size/2);
38 $con->rotate ( M_PI / 4.0);
39 $con->translate ( -$surface_size/2, -$surface_size/2);
41 $con->setSourceSurface ( $s, 0, 0);
42 $pat = $con->getSource();
44 $pat->setFilter(FILTER_NEAREST);
45 $con->setSource($pat);
46 $con->paint ();
47 $sur->writeToPng("rotate-image-surface-paint-php.png");