Skip to content

Commit

Permalink
fix color formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Faust authored and Alexander Faust committed Mar 23, 2024
1 parent cd89143 commit d45c2ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Renderer/Image/EpsImageBackEnd.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ final class EpsImageBackEnd implements ImageBackEndInterface
private const GRADIENTD_FORMAT = " /Coords [ ".self::SSSS_SAFE." ]\n";
private const GRADIENTID_FORMAT = " /Coords [ ".self::SSSS_SAFE." ]\n";
private const GRADIENTR_FORMAT = " /Coords [ ".self::SS_SAFE." 0 ".self::SSS_SAFE." ]\n";
private const RGBCOLOR_FORMAT = self::SSS_SAFE;
private const CMYKCOLOR_FORMAT = self::SSSS_SAFE;


private ?string $eps;
Expand Down Expand Up @@ -366,12 +368,12 @@ private function getColorSetString(ColorInterface $color) : string
private function getColorString(ColorInterface $color) : string
{
if ($color instanceof Rgb) {
return sprintf("%1.".self::PRECISION."F %1.".self::PRECISION."F %1.".self::PRECISION."F", $color->getRed() / 255, $color->getGreen() / 255, $color->getBlue() / 255);
return sprintf(self::RGBCOLOR_FORMAT, $color->getRed() / 255, $color->getGreen() / 255, $color->getBlue() / 255);
}

if ($color instanceof Cmyk) {
return sprintf(
"% %1.".self::PRECISION."F %1.".self::PRECISION."F %1.".self::PRECISION."F",
self::CMYKCOLOR_FORMAT,
$color->getCyan() / 100,
$color->getMagenta() / 100,
$color->getYellow() / 100,
Expand Down

0 comments on commit d45c2ac

Please sign in to comment.