Issues (331)

examples/rectilinear-stroke.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
$size = 25;
9
$surface = new Image(ImageFormat::ARGB32, $size, $size);
10
$context = new Context($surface);
11
/* Paint background white, then draw in black. */
12
$context->setSourceRgb(1.0, 1.0, 1.0); /* white */
13
$context->paint();
14
$context->setSourceRgb(0.0, 0.0, 0.0); /* black */
15
$context->setLineWidth(1.0);
16
$context->translate(1, 1);
17
18
/* Draw everything first with square caps. */
19
$context->setLineCap(LineCap::SQUARE);
20
21
/* Draw horizontal and vertical segments, each in both
22
 * directions. */
23
$context->moveTo(4.5, 0.5);
24
$context->relLineTo(2.0, 0.0);
25
26
$context->moveTo(10.5, 4.5);
27
$context->relLineTo(0.0, 2.0);
28
29
$context->moveTo(6.5, 10.5);
30
$context->relLineTo(-2.0, 0.0);
31
32
$context->moveTo(0.5, 6.5);
33
$context->relLineTo(0.0, -2.0);
34
35
/* Draw right angle turns in four directions. */
36
$context->moveTo(0.5, 2.5);
37
$context->relLineTo(0.0, -2.0);
38
$context->relLineTo(2.0, 0.0);
39
40
$context->moveTo(8.5, 0.5);
41
$context->relLineTo(2.0, 0.0);
42
$context->relLineTo(0.0, 2.0);
43
44
$context->moveTo(10.5, 8.5);
45
$context->relLineTo(0.0, 2.0);
46
$context->relLineTo(-2.0, 0.0);
47
48
$context->moveTo(2.5, 10.5);
49
$context->relLineTo(-2.0, 0.0);
50
$context->relLineTo(0.0, -2.0);
51
52
/* Draw a closed-path rectangle */
53
$context->rectangle(0.5, 12.5, 10.0, 10.0);
54
55
$context->stroke();
56
57
$context->translate(12, 0);
58
59
/* Now draw the same results, but with butt caps. */
60
$context->setLineCap(LineCap::BUTT);
61
62
/* Draw horizontal and vertical segments, each in both
63
 * directions. */
64
$context->moveTo(4.0, 0.5);
65
$context->relLineTo(3.0, 0.0);
66
67
$context->moveTo(10.5, 4.0);
68
$context->relLineTo(0.0, 3.0);
69
70
$context->moveTo(7.0, 10.5);
71
$context->relLineTo(-3.0, 0.0);
72
73
$context->moveTo(0.5, 7.0);
74
$context->relLineTo(0.0, -3.0);
75
76
/* Draw right angle turns in four directions. */
77
$context->moveTo(0.5, 3.0);
78
$context->relLineTo(0.0, -2.5);
79
$context->relLineTo(2.5, 0.0);
80
81
$context->moveTo(8.0, 0.5);
82
$context->relLineTo(2.5, 0.0);
83
$context->relLineTo(0.0, 2.5);
84
85
$context->moveTo(10.5, 8.0);
86
$context->relLineTo(0.0, 2.5);
87
$context->relLineTo(-2.5, 0.0);
88
89
$context->moveTo(3.0, 10.5);
90
$context->relLineTo(-2.5, 0.0);
91
$context->relLineTo(0.0, -2.5);
92
93
/* Draw a closed-path rectangle */
94
$context->rectangle(0.5, 12.5, 10.0, 10.0);
95
96
/* Draw a path that is rectilinear initially, but not completely */
97
/* We draw this out of the target window.  The bug that caused this
98
 * addition was leaks if part of the path was rectilinear but not
99
 * completely */
100
$context->moveTo(3.0, 30.5);
101
$context->relLineTo(-2.5, 0.0);
102
$context->relLineTo(+2.5, +2.5);
103
104
$context->stroke();
105
$surface->writeToPng(dirname(__FILE__).'/rectilinear-stroke-php.png');
106