Erweiterung der Farbmodel-Tests. Dabei wurden mehrfach verwendete Methoden in eine eigene Klasse ausgelagert.
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace TorstenHettstedt\Colors\ColorModels;
|
||||
|
||||
/**
|
||||
* Definition des allgemeinen CMYK-Farbraumes. Die Werte für die eigenschaften sind reelle Zahlen von 0 bis einschließlich 1.
|
||||
* Ohne Änderung der Eigenschaften wird die Farbe *weiß* dargestellt.
|
||||
*/
|
||||
class CyanMagentaYellowKey extends AbstractColorModel
|
||||
{
|
||||
/** @var float : Definition des Cyan-Anteil */
|
||||
protected float $cyan = 0.0;
|
||||
/** @var float : Definition des Magenta-Anteil */
|
||||
protected float $magenta = 0.0;
|
||||
/** @var float : Definition des Gelbanteil */
|
||||
protected float $yellow = 0.0;
|
||||
/** @var float : Definition des Schwarzanteil */
|
||||
protected float $key = 0.0;
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getCyan(): float
|
||||
{
|
||||
return $this->cyan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $cyan
|
||||
* @return CyanMagentaYellowKey
|
||||
*/
|
||||
public function setCyan(float $cyan): CyanMagentaYellowKey
|
||||
{
|
||||
$this->checkValue($cyan);
|
||||
$this->cyan = $cyan;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getMagenta(): float
|
||||
{
|
||||
return $this->magenta;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $magenta
|
||||
* @return CyanMagentaYellowKey
|
||||
*/
|
||||
public function setMagenta(float $magenta): CyanMagentaYellowKey
|
||||
{
|
||||
$this->checkValue($magenta);
|
||||
$this->magenta = $magenta;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getYellow(): float
|
||||
{
|
||||
return $this->yellow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $yellow
|
||||
* @return CyanMagentaYellowKey
|
||||
*/
|
||||
public function setYellow(float $yellow): CyanMagentaYellowKey
|
||||
{
|
||||
$this->checkValue($yellow);
|
||||
$this->yellow = $yellow;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getKey(): float
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $key
|
||||
* @return CyanMagentaYellowKey
|
||||
*/
|
||||
public function setKey(float $key): CyanMagentaYellowKey
|
||||
{
|
||||
$this->checkValue($key);
|
||||
$this->key = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user