private function drawRectangleBorder(GraphicsContext $graphicsContext, Node $node, Document $document) { $graphicsContext->setLineDashingPattern($this->convertStyle($this->style, $document)); $size = $document->convertUnit($this->size); $graphicsContext->setLineWidth($size); $boundary = $this->getTranslationAwareBoundary($node, $node->getBoundary()); $points = $this->getPointsWithPositionCorrection($document, $boundary); if ($this->getRadius() !== null) { $firstPoint = $points[3]; $diagonalPoint = $points[1]; $this->drawRoundedBoundary($graphicsContext, $firstPoint[0], $firstPoint[1], $diagonalPoint[0], $diagonalPoint[1], GraphicsContext::SHAPE_DRAW_STROKE); } elseif ($this->type === self::TYPE_ALL) { $this->drawBoundary($graphicsContext, $points, GraphicsContext::SHAPE_DRAW_STROKE, $size / 2); } else { $halfSize = $size / 2; foreach (array(self::TYPE_TOP, self::TYPE_RIGHT, self::TYPE_BOTTOM, self::TYPE_LEFT) as $type) { if ($this->type & $type) { $log = 1; for ($index = 0; $log < $type; $log = $log << 1) { $index++; } list($x1, $y1, $x2, $y2) = $this->getPointsForFixedLine($points, $index, $halfSize); $graphicsContext->drawLine($x1, $y1, $x2, $y2); } } } }