コード例 #1
0
 protected function convertColor(Node $node, Document $document)
 {
     $color = $node->getAttribute('color');
     if ($color) {
         $node->setAttribute('color', $document->getColorFromPalette($color));
     }
     if ($node->hasAttribute('chart-colors')) {
         $colors = $node->getAttribute('chart-colors');
         foreach ($colors as $key => $color) {
             $colors[$key] = $document->getColorFromPalette($color);
         }
         $node->setAttribute('chart-colors', $colors);
     }
 }
コード例 #2
0
 public function enhance(Node $node, Document $document)
 {
     $color = $document->getColorFromPalette($this->getColor());
     $alpha = $node->getAlpha();
     $graphicsContext = $node->getGraphicsContext();
     $isAlphaSet = $alpha != 1 && $alpha !== null;
     $rotationNode = $node->getAncestorWithRotation();
     if ($color || $isAlphaSet || $rotationNode) {
         $graphicsContext->saveGS();
     }
     if ($rotationNode) {
         $middlePoint = $rotationNode->getMiddlePoint();
         $graphicsContext->rotate($middlePoint->getX(), $middlePoint->getY(), $rotationNode->getRotate());
     }
     if ($alpha !== null) {
         $graphicsContext->setAlpha($alpha);
     }
     if ($color) {
         $graphicsContext->setLineColor($color);
         $graphicsContext->setFillColor($color);
     }
     $this->doEnhance($graphicsContext, $node, $document);
     if ($color || $isAlphaSet || $rotationNode) {
         $graphicsContext->restoreGs();
     }
 }