Issues (331)

examples/degenerate-path.php (4 issues)

Labels
Severity
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\LineCap;
0 ignored issues
show
The type Cairo\LineCap 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\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...
6
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...
7
8
$surface = new Image(ImageFormat::ARGB32, 3 * (3 + 6 + 3), 8 * (6 + 3) + 3);
9
$context = new Context($surface);
10
11
$cap = [LineCap::ROUND, LineCap::SQUARE, LineCap::BUTT];
12
$dash = [2.0, 2.0];
13
$dash_long = [6.0, 6.0];
14
15
$context->setSourceRgb(1, 0, 0);
16
17
for ($i = 0; $i < 3; $i++)
18
{
19
	$context->save();
20
	
21
	$context->setLineCap($cap[$i]);
22
	
23
	/* simple degenerate paths */
24
	$context->setLineWidth(6);
25
	$context->moveTo(6, 6);
26
	$context->lineTo(6, 6);
27
	$context->stroke();
28
	
29
	$context->translate(0, 3 * 3);
30
	$context->moveTo(6, 6);
31
	$context->closePath();
32
	$context->stroke();
33
	
34
	/* degenerate paths starting with dash on */
35
	$context->setDash($dash, 0.);
36
	
37
	$context->translate(0, 3 * 3);
38
	$context->moveTo(6, 6);
39
	$context->lineTo(6, 6);
40
	$context->stroke();
41
	
42
	$context->translate(0, 3 * 3);
43
	$context->moveTo(6, 6);
44
	$context->closePath();
45
	$context->stroke();
46
	
47
	/* degenerate paths starting with dash off */
48
	/* these should not draw anything */
49
	$context->setDash($dash, 2.);
50
	
51
	$context->translate(0, 3 * 3);
52
	$context->moveTo(6, 6);
53
	$context->lineTo(6, 6);
54
	$context->stroke();
55
	
56
	$context->translate(0, 3 * 3);
57
	$context->moveTo(6, 6);
58
	$context->closePath();
59
	$context->stroke();
60
	
61
	/* this should draw a single degenerate sub-path
62
	 * at the end of the path */
63
	$context->setDash($dash_long, 6.);
64
	
65
	$context->translate(0, 3 * 3);
66
	$context->moveTo(6 + 6.0, 6);
67
	$context->lineTo(6, 6);
68
	$context->stroke();
69
	
70
	/* this should draw a single degenerate sub-path
71
	 * at the end of the path. The difference between this
72
	 * and the above is that this ends with a degenerate sub-path*/
73
	$context->setDash($dash_long, 6.0);
74
	
75
	$context->translate(0, 3 * 3);
76
	$context->moveTo(6 + 6.0, 6);
77
	$context->lineTo(6, 6);
78
	$context->lineTo(6, 6);
79
	$context->stroke();
80
	
81
	$context->restore();
82
	
83
	$context->translate(3 + 6 + 3, 0);
84
}
85
86
$surface->writeToPng(dirname(__FILE__).'/degenerate-path-php.png');
87