| @@ 18-67 (lines=50) @@ | ||
| 15 | * |
|
| 16 | * @package GravityMedia\Magickly\Image\Palette |
|
| 17 | */ |
|
| 18 | class CMYK implements PaletteInterface |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var null|ColorProfile |
|
| 22 | */ |
|
| 23 | private $colorProfile; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Clone palette object. |
|
| 27 | */ |
|
| 28 | public function __clone() |
|
| 29 | { |
|
| 30 | if (null === $this->colorProfile) { |
|
| 31 | return; |
|
| 32 | } |
|
| 33 | ||
| 34 | $this->colorProfile = clone $this->colorProfile; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function getColorSpace() |
|
| 41 | { |
|
| 42 | return ColorSpace::COLOR_SPACE_CMYK; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| 47 | */ |
|
| 48 | public function getColorProfile() |
|
| 49 | { |
|
| 50 | if (null === $this->colorProfile) { |
|
| 51 | $this->colorProfile = ColorProfile::fromFilename(__DIR__ . '/../../../resources/USWebUncoated.icc'); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $this->colorProfile; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function withColorProfile(ColorProfile $colorProfile) |
|
| 61 | { |
|
| 62 | $palette = clone $this; |
|
| 63 | $palette->colorProfile = $colorProfile; |
|
| 64 | ||
| 65 | return $palette; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 18-67 (lines=50) @@ | ||
| 15 | * |
|
| 16 | * @package GravityMedia\Magickly\Image\Palette |
|
| 17 | */ |
|
| 18 | class Grayscale implements PaletteInterface |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var null|ColorProfile |
|
| 22 | */ |
|
| 23 | private $colorProfile; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Clone palette object. |
|
| 27 | */ |
|
| 28 | public function __clone() |
|
| 29 | { |
|
| 30 | if (null === $this->colorProfile) { |
|
| 31 | return; |
|
| 32 | } |
|
| 33 | ||
| 34 | $this->colorProfile = clone $this->colorProfile; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function getColorSpace() |
|
| 41 | { |
|
| 42 | return ColorSpace::COLOR_SPACE_GRAYSCALE; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| 47 | */ |
|
| 48 | public function getColorProfile() |
|
| 49 | { |
|
| 50 | if (null === $this->colorProfile) { |
|
| 51 | $this->colorProfile = ColorProfile::fromFilename(__DIR__ . '/../../../resources/Dot_Gain_15.icc'); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $this->colorProfile; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function withColorProfile(ColorProfile $colorProfile) |
|
| 61 | { |
|
| 62 | $palette = clone $this; |
|
| 63 | $palette->colorProfile = $colorProfile; |
|
| 64 | ||
| 65 | return $palette; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 18-67 (lines=50) @@ | ||
| 15 | * |
|
| 16 | * @package GravityMedia\Magickly\Image\Palette |
|
| 17 | */ |
|
| 18 | class RGB implements PaletteInterface |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var null|ColorProfile |
|
| 22 | */ |
|
| 23 | private $colorProfile; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Clone palette object. |
|
| 27 | */ |
|
| 28 | public function __clone() |
|
| 29 | { |
|
| 30 | if (null === $this->colorProfile) { |
|
| 31 | return; |
|
| 32 | } |
|
| 33 | ||
| 34 | $this->colorProfile = clone $this->colorProfile; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * {@inheritdoc} |
|
| 39 | */ |
|
| 40 | public function getColorSpace() |
|
| 41 | { |
|
| 42 | return ColorSpace::COLOR_SPACE_RGB; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * {@inheritdoc} |
|
| 47 | */ |
|
| 48 | public function getColorProfile() |
|
| 49 | { |
|
| 50 | if (null === $this->colorProfile) { |
|
| 51 | $this->colorProfile = ColorProfile::fromFilename(__DIR__ . '/../../../resources/sRGB_IEC61966-2-1.icc'); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $this->colorProfile; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * {@inheritdoc} |
|
| 59 | */ |
|
| 60 | public function withColorProfile(ColorProfile $colorProfile) |
|
| 61 | { |
|
| 62 | $palette = clone $this; |
|
| 63 | $palette->colorProfile = $colorProfile; |
|
| 64 | ||
| 65 | return $palette; |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||