Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / testcases / phpCairo / source-clip.php
blobd28a0a83ddcbaca58a58d53fb09abc32be3727c0
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 12, 12);
3 $con = new CairoContext($sur);
4 $source = $sur->createSimilar (
5 CONTENT_COLOR_ALPHA,
6 12, 12);
8 $con2 = new CairoContext($source);
10 /* Fill the source surface with green */
12 $con2->setSourceRgb ( 0, 1, 0);
13 $con2->paint ();
15 /* Draw a blue square in the middle of the source with clipping,
16 * and leave the clip there. */
17 $con2->rectangle (
18 12 / 4, 12 / 4,
19 12 / 2, 12 / 2);
20 $con2->clip ();
21 $con2->setSourceRgb ( 0, 0, 1);
22 $con2->paint ();
24 /* Fill the destination surface with solid red (should not appear
25 * in final result) */
26 $con->setSourceRgb ( 1, 0, 0);
27 $con->paint ();
29 /* Now draw the source surface onto the destination surface */
30 $con->setSourceSurface ( $source, 0, 0);
31 $con->paint ();
32 $sur->writeToPng("source-clip-php.png");