swen100 /
cairo
| 1 | <?php |
||
| 2 | |||
| 3 | use Cairo\Context; |
||
|
0 ignored issues
–
show
|
|||
| 4 | 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. 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\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. 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\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. 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\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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 8 | |||
| 9 | $size = 40; |
||
| 10 | |||
| 11 | $surface = new Image(ImageFormat::ARGB32, $size, $size); |
||
| 12 | $context = new Context($surface); |
||
| 13 | $context->setSourceRgb(1, 1, 1); /* White */ |
||
| 14 | $context->paint(); |
||
| 15 | |||
| 16 | $context->moveTo($size, 0); |
||
| 17 | $context->lineTo($size, $size); |
||
| 18 | $context->lineTo(0, $size); |
||
| 19 | |||
| 20 | $context->setSourceRgb(0, 0, 0); |
||
| 21 | $context->fill(); |
||
| 22 | |||
| 23 | /* Create a pattern with the target surface as the source, |
||
| 24 | * offset by $size/2 */ |
||
| 25 | $pattern = new PatternSurface($surface); |
||
| 26 | $matrix = new Matrix(); |
||
| 27 | $matrix->translate(-$size / 2, -$size / 2); |
||
| 28 | $pattern->setMatrix($matrix); |
||
| 29 | $context->setPattern($pattern); |
||
| 30 | |||
| 31 | /* Copy two rectangles from the upper-left quarter of the image to |
||
| 32 | * the lower right. It will work if we use $context->fill(), but the |
||
| 33 | * $context->clip() $context->paint() combination fails because the clip |
||
| 34 | * on the surface as a destination affects it as the source as |
||
| 35 | * well. |
||
| 36 | */ |
||
| 37 | |||
| 38 | $context->rectangle(2 * $size / 4, 2 * $size / 4, $size / 4, $size / 4); |
||
| 39 | $context->rectangle(3 * $size / 4, 3 * $size / 4, $size / 4, $size / 4); |
||
| 40 | $context->clip(); |
||
| 41 | $context->paint(); |
||
| 42 | |||
| 43 | $surface->writeToPng(dirname(__FILE__).'/self-copy-php.png'); |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths