private function drawPoiRectangle($poi, $color, $borderSize, $imageWidth, $imageHeight) {
        $rect = new ImagickDraw();
        $rect->setStrokeColor($color);
        $rect->setFillColor($color);
        $rect->setStrokeAntialias(false);

        $x1 = max(0, $poi['x'] - $borderSize);
        $x2 = min($imageWidth, $poi['x'] + $poi['width'] + $borderSize);

        // Left
        $rect->rectangle(
            $x1,
            $poi['y'],
            $poi['x'],
            $poi['y'] + $poi['height']
        );

        // Right
        $rect->rectangle(
            $poi['x'] + $poi['width'],
            $poi['y'],
            $x2,
            $poi['y'] + $poi['height']
        );

        // Top
        $rect->rectangle(
            $x1,
            max(0, $poi['y'] - $borderSize),
            $x2,
            $poi['y']
        );

        // Bottom
        $rect->rectangle(
            $x1,
            $poi['y'] + $poi['height'],
            $x2,
            min($imageHeight, $poi['y'] + $poi['height'] + $borderSize)
        );

        // Draw the rectangle
        $this->imagick->drawImage($rect);
    }
private function drawPoiRectangle($poi, $color, $borderSize, $imageWidth, $imageHeight) {
        $rect = new ImagickDraw();
        $rect->setStrokeColor($color);
        $rect->setFillColor($color);
        $rect->setStrokeAntialias(false);

        $x1 = max(0, $poi['x'] - $borderSize);
        $x2 = min($imageWidth, $poi['x'] + $poi['width'] + $borderSize);

        // Left
        $rect->rectangle(
            $x1,
            $poi['y'],
            $poi['x'],
            $poi['y'] + $poi['height']
        );

        // Right
        $rect->rectangle(
            $poi['x'] + $poi['width'],
            $poi['y'],
            $x2,
            $poi['y'] + $poi['height']
        );

        // Top
        $rect->rectangle(
            $x1,
            max(0, $poi['y'] - $borderSize),
            $x2,
            $poi['y']
        );

        // Bottom
        $rect->rectangle(
            $x1,
            $poi['y'] + $poi['height'],
            $x2,
            min($imageHeight, $poi['y'] + $poi['height'] + $borderSize)
        );

        // Draw the rectangle
        $this->imagick->drawImage($rect);
    }
private function drawPoiRectangle ( $ poi , $ color , $ borderSize , $ imageWidth , $ imageHeight ) { $ rect = new ImagickDraw ( ) ; $ rect -> setStrokeColor ( $ color ) ; $ rect -> setFillColor ( $ color ) ; $ rect -> setStrokeAntialias ( false ) ; $ x1 = max ( 0 , $ poi [ 'x' ] - $ borderSize ) ; $ x2 = min ( $ imageWidth , $ poi [ 'x' ] + $ poi [ 'width' ] + $ borderSize ) ; // Left $ rect -> rectangle ( $ x1 , $ poi [ 'y' ] , $ poi [ 'x' ] , $ poi [ 'y' ] + $ poi [ 'height' ] ) ; // Right $ rect -> rectangle ( $ poi [ 'x' ] + $ poi [ 'width' ] , $ poi [ 'y' ] , $ x2 , $ poi [ 'y' ] + $ poi [ 'height' ] ) ; // Top $ rect -> rectangle ( $ x1 , max ( 0 , $ poi [ 'y' ] - $ borderSize ) , $ x2 , $ poi [ 'y' ] ) ; // Bottom $ rect -> rectangle ( $ x1 , $ poi [ 'y' ] + $ poi [ 'height' ] , $ x2 , min ( $ imageHeight , $ poi [ 'y' ] + $ poi [ 'height' ] + $ borderSize ) ) ; // Draw the rectangle $ this -> imagick -> drawImage ( $ rect ) ; }
Draw rectangle around a POI

@param array $poi
@param string $color
@param integer $borderSize
@param integer $imageWidth
@param integer $imageHeight
Draw rectangle around a POI