protected function renderForeground(
        \Jdenticon\Rendering\RendererInterface $renderer, 
        \Jdenticon\Rendering\Rectangle $rect,
        \Jdenticon\IdenticonStyle $style, 
        \Jdenticon\Rendering\ColorTheme $colorTheme, 
        $hash)
    {
        // Ensure rect is quadratic and a multiple of the cell count
        $normalizedRect = $this->normalizeRectangle($rect);
        $cellSize = $normalizedRect->width / $this->getCellCount();

        foreach ($this->getShapes($colorTheme, $hash) as $shape) {
            $rotation = $shape->startRotationIndex;
            
            $renderer->beginShape($shape->color);
            
            $positionCount = count($shape->positions);
            for ($i = 0; $i + 1 < $positionCount; $i += 2) {
                $renderer->setTransform(new Transform(
                    $normalizedRect->x + $shape->positions[$i + 0] * $cellSize,
                    $normalizedRect->y + $shape->positions[$i + 1] * $cellSize,
                    $cellSize, $rotation++ % 4));

                $shape->definition->__invoke($renderer, $cellSize, $i / 2);
            }
            
            $renderer->endShape();
        }
    }
protected function renderForeground(
        \Jdenticon\Rendering\RendererInterface $renderer, 
        \Jdenticon\Rendering\Rectangle $rect,
        \Jdenticon\IdenticonStyle $style, 
        \Jdenticon\Rendering\ColorTheme $colorTheme, 
        $hash)
    {
        // Ensure rect is quadratic and a multiple of the cell count
        $normalizedRect = $this->normalizeRectangle($rect);
        $cellSize = $normalizedRect->width / $this->getCellCount();

        foreach ($this->getShapes($colorTheme, $hash) as $shape) {
            $rotation = $shape->startRotationIndex;
            
            $renderer->beginShape($shape->color);
            
            $positionCount = count($shape->positions);
            for ($i = 0; $i + 1 < $positionCount; $i += 2) {
                $renderer->setTransform(new Transform(
                    $normalizedRect->x + $shape->positions[$i + 0] * $cellSize,
                    $normalizedRect->y + $shape->positions[$i + 1] * $cellSize,
                    $cellSize, $rotation++ % 4));

                $shape->definition->__invoke($renderer, $cellSize, $i / 2);
            }
            
            $renderer->endShape();
        }
    }
protected function renderForeground ( \ Jdenticon \ Rendering \ RendererInterface $ renderer , \ Jdenticon \ Rendering \ Rectangle $ rect , \ Jdenticon \ IdenticonStyle $ style , \ Jdenticon \ Rendering \ ColorTheme $ colorTheme , $ hash ) { // Ensure rect is quadratic and a multiple of the cell count $ normalizedRect = $ this -> normalizeRectangle ( $ rect ) ; $ cellSize = $ normalizedRect -> width / $ this -> getCellCount ( ) ; foreach ( $ this -> getShapes ( $ colorTheme , $ hash ) as $ shape ) { $ rotation = $ shape -> startRotationIndex ; $ renderer -> beginShape ( $ shape -> color ) ; $ positionCount = count ( $ shape -> positions ) ; for ( $ i = 0 ; $ i + 1 < $ positionCount ; $ i += 2 ) { $ renderer -> setTransform ( new Transform ( $ normalizedRect -> x + $ shape -> positions [ $ i + 0 ] * $ cellSize , $ normalizedRect -> y + $ shape -> positions [ $ i + 1 ] * $ cellSize , $ cellSize , $ rotation ++ % 4 ) ) ; $ shape -> definition -> __invoke ( $ renderer , $ cellSize , $ i / 2 ) ; } $ renderer -> endShape ( ) ; } }
Renders the foreground of an icon.

@param \Jdenticon\Rendering\RendererInterface $renderer The renderer to
be used for rendering the icon on the target surface.
@param \Jdenticon\Rendering\Rectangle $rect The outer bounds of the icon.
@param \Jdenticon\IdenticonStyle $style The style of the icon.
@param \Jdenticon\Rendering\ColorTheme $colorTheme A color theme
specifying the colors to be used in the icon.
@param string $hash The hash to be used as basis for the generated icon.
Renders the foreground of an icon .