Added some test cases ....
[phpCairo.git] / testcases / phpCairo / miter-precision.php
blobb0fdce52ba47a2651f03fe042411476aaccdf41e
1 <?
2 $sur = new CairoImageSurface(FORMAT_ARGB32, 120, 100);
3 $con = new CairoContext($sur);
5 $con->set_source_rgb ( 1, 1, 1);
6 $con->paint ();
8 $con->set_source_rgb ( 0, 0, 0);
9 $con->set_miter_limit (100000);
10 for ($xscale = 1; $xscale <= 1000; $xscale += 999)
11 for ($yscale = 1; $yscale <= 1000; $yscale += 999)
13 //$max_scale = ($xscale > $yscale) ? $xscale : $yscale;
14 $max_scale = max($xscale, $yscale);
15 $con->save ();
16 if ($xscale > 1)
17 $con->translate (50, 0);
18 if ($yscale > 1)
19 $con->translate ( 0, 50);
20 $con->scale ( $xscale,$yscale);
21 $con->set_line_width ( 10.0 / $max_scale);
22 $con->move_to ( 10.0 / $xscale, 10.0 / $yscale);
23 $con->line_to ( 40.0 / $xscale, 10.0 / $yscale);
24 $con->line_to ( 10.0 / $xscale, 30.0 / $yscale);
25 $con->stroke ();
26 $con->restore ();
28 $sur->write_to_png("miter-precision-php.png");