コード例 #1
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();
     }
 }