Issues (331)

examples/leaky-dashed-rectangle.php (3 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\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
$width = 60;
8
$height = 60;
9
$dash = [4.0, 2.0];
10
11
$surface = new Image(ImageFormat::ARGB32, $width, $height);
12
$context = new Context($surface);
13
14
$context->setSourceRgb(1, 1, 1);
15
$context->paint();
16
$context->setSourceRgb(0., 0., 0);
17
$context->translate(0.5, .5);
18
$context->setLineWidth(1); /* This is vital to reproduce the bug. */
19
20
/* First check simple rectangles */
21
$context->setSourceRgb(0., 0., 0);
22
$context->rectangle(-$width / 4, -$height / 4, $width, $height);
23
$context->stroke();
24
$context->rectangle($width + $width / 4, -$height / 4, -$width, $height);
25
$context->stroke();
26
$context->rectangle(-$width / 4, $height + $height / 4, $width, -$height);
27
$context->stroke();
28
$context->rectangle($width + $width / 4, $height + $height / 4, -$width, -$height);
29
$context->stroke();
30
31
$context->setDash($dash, 0);
32
33
/* And now dashed. */
34
$context->setSourceRgb(1., 0., 0);
35
$context->rectangle(-$width / 4, -$height / 4, $width, $height);
36
$context->stroke();
37
$context->setSourceRgb(0., 1., 0);
38
$context->rectangle($width + $width / 4, -$height / 4, -$width, $height);
39
$context->stroke();
40
$context->setSourceRgb(0., 0., 1);
41
$context->rectangle(-$width / 4, $height + $height / 4, $width, -$height);
42
$context->stroke();
43
$context->setSourceRgb(1., 1., 0);
44
$context->rectangle($width + $width / 4, $height + $height / 4, -$width, -$height);
45
$context->stroke();
46
47
$surface->writeToPng(dirname(__FILE__).'/leaky-dashed-rectangle-php.png');
48