Issues (331)

examples/meta-surface-pattern.php (7 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\Extend;
0 ignored issues
show
The type Cairo\Extend 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\Matrix;
0 ignored issues
show
The type Cairo\Matrix 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\Pattern\Surface as PatternSurface;
0 ignored issues
show
The type Cairo\Pattern\Surface 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
use Cairo\Surface\Content;
0 ignored issues
show
The type Cairo\Surface\Content 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...
8
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...
9
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...
10
11
$patternWidth = 120;
12
$patternHeight = 120;
13
$size = ($patternWidth * 2);
14
$pad = 2;
15
$width = ($pad + $size + $pad);
16
$height = $width;
17
18
$surface = new Image(ImageFormat::ARGB32, $width, $height);
19
$context = new Context($surface);
20
$context->translate($pad, $pad);
21
22
$patternSurface = $surface->createSimilar(Content::COLOR_ALPHA, $patternWidth, $patternHeight);
23
24
$cr2 = new Context($patternSurface);
25
26
$cr2->setSourceRgba(1, 0, 1, 0.5);
27
$cr2->rectangle($patternWidth / 6.0, $patternHeight / 6.0, $patternWidth / 4.0, $patternHeight / 4.0);
28
$cr2->fill();
29
30
$cr2->setSourceRgba(0, 1, 1, 0.5);
31
$cr2->rectangle($patternWidth / 2.0, $patternHeight / 2.0, $patternWidth / 4.0, $patternHeight / 4.0);
32
$cr2->fill();
33
34
$cr2->setLineWidth(1);
35
$cr2->moveTo($patternWidth / 6.0, 0);
36
$cr2->lineTo(0, 0);
37
$cr2->lineTo(0, $patternHeight / 6.0);
38
$cr2->setSourceRgb(1, 0, 0);
39
$cr2->stroke();
40
$cr2->moveTo($patternWidth / 6.0, $patternHeight);
41
$cr2->lineTo(0, $patternHeight);
42
$cr2->lineTo(0, 5 * $patternHeight / 6.0);
43
$cr2->setSourceRgb(0, 1, 0);
44
$cr2->stroke();
45
$cr2->moveTo(5 * $patternWidth / 6.0, 0);
46
$cr2->lineTo($patternWidth, 0);
47
$cr2->lineTo($patternWidth, $patternHeight / 6.0);
48
$cr2->setSourceRgb(0, 0, 1);
49
$cr2->stroke();
50
$cr2->moveTo(5 * $patternWidth / 6.0, $patternHeight);
51
$cr2->lineTo($patternWidth, $patternHeight);
52
$cr2->lineTo($patternWidth, 5 * $patternHeight / 6.0);
53
$cr2->setSourceRgb(1, 1, 0);
54
$cr2->stroke();
55
56
$cr2->setSourceRgb(0.5, 0.5, 0.5);
57
$cr2->setLineWidth($patternWidth / 10.0);
58
59
$cr2->moveTo(0, $patternHeight / 4.0);
60
$cr2->lineTo($patternWidth, $patternHeight / 4.0);
61
$cr2->stroke();
62
63
$cr2->moveTo($patternWidth / 4.0, 0);
64
$cr2->lineTo($patternWidth / 4.0, $patternWidth);
65
$cr2->stroke();
66
67
$pattern = new PatternSurface($patternSurface);
68
69
$matrix = new Matrix();
70
$matrix->scale(2, 1.5);
71
$matrix->rotate(1);
72
$matrix->translate(-$patternWidth / 4.0, -$patternWidth / 2.0);
73
$pattern->setMatrix($matrix);
74
$pattern->setExtend(Extend::NONE);
75
76
$context->setPattern($pattern);
77
$context->paint();
78
79
$surface->writeToPng(dirname(__FILE__).'/meta-surface-pattern-php.png');
80