Issues (331)

examples/miter-precision.php (3 issues)

1
<?php
2
3
use Cairo\Context;
0 ignored issues
show
The type Cairo\Context was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
use Cairo\Surface\Image;
0 ignored issues
show
The type Cairo\Surface\Image was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Cairo\Surface\ImageFormat;
0 ignored issues
show
The type Cairo\Surface\ImageFormat was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
$surface = new Image(ImageFormat::ARGB32, 120, 100);
8
$context = new Context($surface);
9
10
$context->setSourceRgb(1, 1, 1);
11
$context->paint();
12
$context->setSourceRgb(0, 0, 0);
13
$context->setMiterLimit(100000);
14
15
for ($xscale = 1; $xscale <= 1000; $xscale += 999)
16
{
17
	for ($yscale = 1; $yscale <= 1000; $yscale += 999)
18
	{
19
		$max_scale = max($xscale, $yscale);
20
		$context->save();
21
		
22
		if ($xscale > 1)
23
		{
24
			$context->translate(50, 0);
25
		}
26
		
27
		if ($yscale > 1)
28
		{
29
			$context->translate(0, 50);
30
		}
31
		
32
		$context->scale($xscale, $yscale);
33
		$context->setLineWidth(10.0 / $max_scale);
34
		$context->moveTo(10.0 / $xscale, 10.0 / $yscale);
35
		$context->lineTo(40.0 / $xscale, 10.0 / $yscale);
36
		$context->lineTo(10.0 / $xscale, 30.0 / $yscale);
37
		$context->stroke();
38
		$context->restore();
39
	}
40
}
41
42
$surface->writeToPng(dirname(__FILE__).'/miter-precision-php.png');
43