Issues (331)

examples/scale-down-source-surface-paint.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
$surface = new Image(ImageFormat::ARGB32, 6, 6);
8
$context = new Context($surface);
9
10
$data = '';
11
12
for ($i = 0; $i < 2; $i++)
13
{
14
	$data .= chr(0xff);
15
	$data .= chr(0xff);
16
	$data .= chr(0xff);
17
	$data .= chr(0xff);
18
	
19
	$data .= chr(0xff);
20
	$data .= chr(0xff);
21
	$data .= chr(0xff);
22
	$data .= chr(0xff);
23
	
24
	$data .= chr(0x00);
25
	$data .= chr(0x00);
26
	$data .= chr(0xff);
27
	$data .= chr(0xff);
28
	
29
	$data .= chr(0x00);
30
	$data .= chr(0x00);
31
	$data .= chr(0xff);
32
	$data .= chr(0xff);
33
}
34
35
for ($i = 0; $i < 2; $i++)
36
{
37
	$data .= chr(0x00);
38
	$data .= chr(0xff);
39
	$data .= chr(0x00);
40
	$data .= chr(0xff);
41
	
42
	$data .= chr(0x00);
43
	$data .= chr(0xff);
44
	$data .= chr(0x00);
45
	$data .= chr(0xff);
46
	
47
	$data .= chr(0xff);
48
	$data .= chr(0x00);
49
	$data .= chr(0x00);
50
	$data .= chr(0xff);
51
	
52
	$data .= chr(0xff);
53
	$data .= chr(0x00);
54
	$data .= chr(0x00);
55
	$data .= chr(0xff);
56
}
57
58
$context->setSourceRgb(0, 0, 0);
59
$context->paint();
60
61
$s = new Image(ImageFormat::ARGB32, 100, 100);
62
$s->createForData($data, ImageFormat::RGB24, 4, 4, 16);
63
$context->scale(0.5, 0.5);
64
$context->setSurface($s, 4, 4);
65
$pat = $context->getPattern();
66
$pat->setFilter(Filter::NEAREST);
67
$context->paint();
68
69
$surface->writeToPng(dirname(__FILE__).'/scale-down-source-surface-paint-php.png');
70