Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/Renderer/Image/SvgImageBackEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
final class SvgImageBackEnd implements ImageBackEndInterface
{
private const PRECISION = 3;
private const SCALE_FORMAT = 'scale(%.' . self::PRECISION . 'F)';
private const TRANSLATE_FORMAT = 'translate(%.' . self::PRECISION . 'F,%.' . self::PRECISION . 'F)';

private ?XMLWriter $xmlWriter;

Expand Down Expand Up @@ -87,7 +85,7 @@ public function scale(float $size) : void
$this->xmlWriter->startElement('g');
$this->xmlWriter->writeAttribute(
'transform',
sprintf(self::SCALE_FORMAT, round($size, self::PRECISION))
sprintf('scale(%s)', round($size, self::PRECISION))
);
++$this->stack[$this->currentStack];
}
Expand All @@ -101,7 +99,7 @@ public function translate(float $x, float $y) : void
$this->xmlWriter->startElement('g');
$this->xmlWriter->writeAttribute(
'transform',
sprintf(self::TRANSLATE_FORMAT, round($x, self::PRECISION), round($y, self::PRECISION))
sprintf('translate(%s,%s)', round($x, self::PRECISION), round($y, self::PRECISION))
);
++$this->stack[$this->currentStack];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400" height="400" viewBox="0 0 400 400">
<rect x="0" y="0" width="400" height="400" fill="#fefefe"/>
<g transform="scale(13.793)">
<g transform="translate(4.000,4.000)">
<g transform="translate(4,4)">
<path fill-rule="evenodd" d="M8 0L8 1L9 1L9 2L8 2L8 5L11 5L11 4L12 4L12 3L13 3L13 0L12 0L12 3L11 3L11 2L10 2L10 0ZM9 2L9 4L11 4L11 3L10 3L10 2ZM8 6L8 7L9 7L9 8L8 8L8 9L7 9L7 8L6 8L6 9L7 9L7 10L5 10L5 9L4 9L4 8L0 8L0 10L2 10L2 11L0 11L0 13L2 13L2 11L3 11L3 13L8 13L8 14L10 14L10 15L9 15L9 17L8 17L8 21L9 21L9 19L11 19L11 21L12 21L12 19L13 19L13 21L16 21L16 20L17 20L17 19L16 19L16 18L15 18L15 17L14 17L14 18L15 18L15 19L13 19L13 17L12 17L12 16L14 16L14 15L15 15L15 16L16 16L16 15L17 15L17 18L18 18L18 19L19 19L19 18L20 18L20 16L19 16L19 15L17 15L17 14L16 14L16 13L15 13L15 12L16 12L16 10L19 10L19 12L20 12L20 14L21 14L21 12L20 12L20 11L21 11L21 8L20 8L20 10L19 10L19 8L16 8L16 9L14 9L14 8L13 8L13 9L12 9L12 12L10 12L10 9L11 9L11 6L10 6L10 7L9 7L9 6ZM12 6L12 7L13 7L13 6ZM9 8L9 9L8 9L8 10L7 10L7 11L5 11L5 10L3 10L3 11L4 11L4 12L7 12L7 11L9 11L9 9L10 9L10 8ZM14 10L14 11L13 11L13 12L12 12L12 14L11 14L11 15L13 15L13 14L14 14L14 13L13 13L13 12L15 12L15 10ZM17 11L17 12L18 12L18 11ZM8 12L8 13L9 13L9 12ZM18 13L18 14L19 14L19 13ZM10 16L10 17L9 17L9 18L10 18L10 17L11 17L11 19L12 19L12 17L11 17L11 16ZM20 19L20 20L21 20L21 19ZM18 20L18 21L19 21L19 20ZM0 0L0 7L7 7L7 0ZM1 1L1 6L6 6L6 1ZM2 2L2 5L5 5L5 2ZM21 0L14 0L14 7L21 7ZM20 1L15 1L15 6L20 6ZM19 2L16 2L16 5L19 5ZM0 21L7 21L7 14L0 14ZM1 20L6 20L6 15L1 15ZM2 19L5 19L5 16L2 16Z" fill="#000000"/>
</g>
</g>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400" height="400" viewBox="0 0 400 400">
<rect x="0" y="0" width="400" height="400" fill="#ffffff"/>
<g transform="scale(13.793)">
<g transform="translate(4.000,4.000)">
<g transform="translate(4,4)">
<defs>
<linearGradient gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="21" y2="0" id="g1-a40de6dbf9322546">
<stop offset="0%" stop-color="#000000"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400" height="400" viewBox="0 0 400 400">
<rect x="0" y="0" width="400" height="400" fill="#ffffff"/>
<g transform="scale(13.793)">
<g transform="translate(4.000,4.000)">
<g transform="translate(4,4)">
<defs>
<linearGradient gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="0" y2="21" id="g1-a2ca2de96657f016">
<stop offset="0%" stop-color="#000000"/>
Expand Down