19 declare(strict_types=1);
    45             $pattern = new \Imagick();
    47             $pattern->readImageBlob(
    48                 '<?xml version="1.0" encoding="UTF-8"?><svg id="Ebene_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '    49                 . ($x * 2) . 
' ' . ($x * 2) . 
'"><defs><style>.cls-1{fill:#afafaf;}.cls-1,.cls-2{stroke-width:0px;}.cls-2{fill:#e8e8e8;}</style></defs><g id="Ebene_1-2"><rect class="cls-1" width="'    50                 . $x . 
'" height="' . $x . 
'"/><rect class="cls-2" y="' . $x . 
'" width="' . $x . 
'" height="' . $x
    51                 . 
'"/><rect class="cls-1" x="' . $x . 
'" y="' . $x . 
'" width="' . $x . 
'" height="' . $x
    52                 . 
'"/><rect class="cls-2" x="' . $x . 
'" width="' . $x . 
'" height="' . $x . 
'"/></g></svg>'    54             $pattern = $img->textureImage($pattern);
    55             $pattern->compositeImage(
    57                 \Imagick::COMPOSITE_OVER,
    69         return new \ImagickPixel(
'none');
    74         return \Imagick::ALPHACHANNEL_ACTIVATE;
    79         return new \ImagickPixel(
'transparent');
    89         return $this->pattern ? 
'jpg' : 
'png64';
    97     private function prescaleSVG(
string $svg_content, 
int $max_length): string
   100             $dom = new \DOMDocument();
   101             $dom->loadXML($svg_content);
   102             $svg = $dom->documentElement;
   105             $viewbox = $svg->getAttribute(
'viewBox');
   106             if ($viewbox === 
'') {
   109             $viewbox = explode(
' ', $viewbox);
   110             $width = (float) ($viewbox[2] ?? 0);
   111             $height = (float) ($viewbox[3] ?? 0);
   113             if ($width === 0 || $height === 0) {
   117             [$new_width, $new_height] = $this->calculateWidthHeight(
   122             $svg->setAttribute(
'width', (
string) $new_width);
   123             $svg->setAttribute(
'height', (
string) $new_height);
   125             return $dom->saveXML($svg);