Beispiel #1
0
 /**
  * @param TextLayerInterface $layer
  */
 protected function initTextLayerResource(TextLayerInterface $layer)
 {
     $resource = $this->rh->getTextGdResource($layer->get('text.font.filename'), $layer->get('text.font.size'), $layer->get('text.font.rgb_color'), $layer->get('text.label'), $layer->get('text.line_spacing'), $layer->get('text.angle'), $layer->get('text.box.paddings'), $layer->get('text.box.rgb_color'));
     $layer->set('final.resource', $resource);
 }
Beispiel #2
0
 /**
  * @param TextLayerInterface $layer
  */
 public function processBox(TextLayerInterface $layer)
 {
     if (!$layer->has('text.box.paddings')) {
         $layer->add(['text.box.paddings' => [0, 0, 0, 0], 'text.box.hex_color' => null]);
         return;
     }
     $paddings = array_values($layer->get('text.box.paddings'));
     $arr = [];
     for ($i = 0; $i < 4; $i++) {
         if (!isset($paddings[$i]) || 0 > $paddings[$i]) {
             $arr[$i] = 0;
         } else {
             $arr[$i] = (int) $paddings[$i];
         }
     }
     $layer->set('text.box.paddings', $arr);
     if (null !== ($color = $layer->get('text.box.hex_color'))) {
         $color = $this->sanitizeHexColor($color);
         $layer->set('text.box.hex_color', $color['hex']);
         $layer->set('text.box.rgb_color', $color['rgb']);
     } else {
         $layer->set('text.box.rgb_color', null);
     }
 }