Issues (331)

examples/rotate-image-surface-paint.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\Filter;
0 ignored issues
show
The type Cairo\Filter 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 = 20;
9
$pad = 2;
10
$surfaceSize = sqrt(($size - 2 * $pad) * ($size - 2 * $pad) / 2);
11
12
$surface = new Image(ImageFormat::ARGB32, $size, $size);
13
$context = new Context($surface);
14
15
$s = new Image(ImageFormat::RGB24, $surfaceSize, $surfaceSize);
16
$con2 = new Context($s);
17
18
$con2->setSourceRgb(1, 1, 1);
19
$con2->rectangle(0, 0, $surfaceSize / 2, $surfaceSize / 2);
20
$con2->fill();
21
$con2->setSourceRgb(1, 0, 0);
22
$con2->rectangle($surfaceSize / 2, 0, $surfaceSize / 2, $surfaceSize / 2);
23
$con2->fill();
24
$con2->setSourceRgb(0, 1, 0);
25
$con2->rectangle(0, $surfaceSize / 2, $surfaceSize / 2, $surfaceSize / 2);
26
$con2->fill();
27
$con2->setSourceRgb(0, 0, 1);
28
$con2->rectangle($surfaceSize / 2, $surfaceSize / 2, $surfaceSize / 2, $surfaceSize / 2);
29
$con2->fill();
30
31
/* First paint opaque background (black) so we don't need separate
32
 * ARGB32 and RGB24 reference images. */
33
$context->setSourceRgb(0, 0, 0); /* black */
34
$context->paint();
35
36
$context->translate($size / 2, $size / 2);
37
$context->rotate(M_PI / 4.0);
38
$context->translate(-$surfaceSize / 2, -$surfaceSize / 2);
39
40
$context->setSurface($s, 0, 0);
41
$pat = $context->getPattern();
42
43
$pat->setFilter(Filter::NEAREST);
44
$context->setPattern($pat);
45
$context->paint();
46
47
$surface->writeToPng(dirname(__FILE__).'/rotate-image-surface-paint-php.png');
48