/**
  * Verifies that a color is allocated.
  *
  * @param Color $color
  *
  * @return Color
  */
 protected function verifyColor(Color $color)
 {
     if ($color->getIndex() !== null) {
         return $color;
     }
     return $this->allocateColor($color->getRed(), $color->getGreen(), $color->getBlue(), $color->getAlpha());
 }
Beispiel #2
0
 /**
  * Creator constructor.
  *
  * @param bool  $limitUpscaling
  * @param Color $background
  */
 public function __construct($limitUpscaling = true, Color $background = null)
 {
     $this->limitUpscaling = (bool) $limitUpscaling;
     $this->background = $background ?: Color::white();
 }