コード例 #1
0
    /**
     * Draws a polygon on the handle
     *
     * @param ImageMagick-object $handle The handle on which the polygon is drawn
     * @param Zend_Image_Action_DrawPolygon $polygon The object that with all info
     */
    public function perform($handle, Zend_Image_Action_DrawPolygon $polygon) { // As of ZF2.0 / PHP5.3, this can be made static.
        
        $points = $this->_parsePoints($polygon->getPoints());

        if ($polygon->isClosed()){
            //add first point at the end to close
            $points[count($points)] = $points[0];
        }

        $draw = new ImagickDraw();

        $draw->setStrokeColor('#' . $polygon->getStrokeColor()->getHex());

        $draw->setStrokeOpacity($polygon->getStrokeAlpha()/100);
        $draw->setStrokeWidth($polygon->getStrokeWidth());

        $strokeDashArray = $polygon->getStrokeDashPattern();
        if (count($strokeDashArray) > 0){
            $draw->setStrokeDashArray($strokeDashArray);
        }
        $draw->setStrokeDashOffset($polygon->getStrokeDashOffset());

        if($polygon->isFilled()) {
            $fillColor = $polygon->getFillColor();
            $draw->setFillColor('#' . $fillColor->getHex());
            $draw->polygon($points);

        } else {
            //Use transparent fill to render unfilled
            $draw->setFillOpacity(0);
            $draw->polyline($points);
        }

        $handle->getHandle()->drawImage($draw);
    }
コード例 #2
0
ファイル: 88x31.php プロジェクト: lknight/habrometr
 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     $color['habr'] = new ImagickPixel("rgb(83, 121, 139)");
     $color['transparent'] = new ImagickPixel("transparent");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bg']);
     $draw->setStrokeColor($color['habr']);
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => 0)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_CENTER);
     $draw->setTextAntialias(true);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFontSize(10);
     $draw->setFillColor($color['neutral']);
     $draw->annotation(self::WIDTH / 2, 26, "рейтинг: " . $this->_rate);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_CENTER);
     $draw->setTextAntialias(true);
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation(self::WIDTH / 4 + 1, 12, sprintf('%01.2f', $this->_karma));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation(self::WIDTH / 4 * 3 - 1, 12, sprintf('%01.2f', $this->_habraforce));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     return true;
 }
コード例 #3
0
ファイル: functions.php プロジェクト: biswajit-paul/gittest
function fxAnalyzeImage(\Imagick $imagick)
{
    $graphWidth = $imagick->getImageWidth();
    $sampleHeight = 20;
    $graphHeight = 128;
    $border = 2;
    $imageIterator = new \ImagickPixelIterator($imagick);
    $reds = [];
    foreach ($imageIterator as $pixels) {
        /* Loop through pixel rows */
        foreach ($pixels as $pixel) {
            /* Loop through the pixels in the row (columns) */
            /** @var $pixel \ImagickPixel */
            $color = $pixel->getColor();
            $reds[] = $color['r'];
        }
        $imageIterator->syncIterator();
        /* Sync the iterator, this is important to do on each iteration */
    }
    $draw = new \ImagickDraw();
    $strokeColor = new \ImagickPixel('red');
    $fillColor = new \ImagickPixel('none');
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeWidth(1);
    $draw->setFontSize(72);
    $draw->setStrokeAntiAlias(true);
    $x = 0;
    $points = [];
    foreach ($reds as $red) {
        $pos = $graphHeight - $red * $graphHeight / 256;
        $points[] = ['x' => $x, 'y' => $pos];
        $x += 1;
    }
    $draw->polyline($points);
    $plot = new \Imagick();
    $plot->newImage($graphWidth, $graphHeight, 'white');
    $plot->drawImage($draw);
    $outputImage = new \Imagick();
    $outputImage->newImage($graphWidth, $graphHeight + $sampleHeight, 'white');
    $outputImage->compositeimage($plot, \Imagick::COMPOSITE_ATOP, 0, 0);
    $imagick->resizeimage($imagick->getImageWidth(), $sampleHeight, \Imagick::FILTER_LANCZOS, 1);
    $outputImage->compositeimage($imagick, \Imagick::COMPOSITE_ATOP, 0, $graphHeight);
    $outputImage->borderimage('black', $border, $border);
    $outputImage->setImageFormat("png");
    header("Content-Type: image/png");
    echo $outputImage;
}
コード例 #4
0
ファイル: Informer.php プロジェクト: lknight/habrometr
 /**
  * Show image with error text.
  *
  * @param string $text
  * @param int $width
  * @param int $height
  */
 public static function showError($text, $width, $height)
 {
     $canvas = new Imagick();
     $canvas->newImage($width, $height, new ImagickPixel("white"));
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel("white"));
     $draw->setStrokeColor(new ImagickPixel("black"));
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => $width - 1, 'y' => 0), array('x' => $width - 1, 'y' => $height - 1), array('x' => 0, 'y' => $height - 1), array('x' => 0, 'y' => 0)));
     $canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel("black"));
     $draw->setFontSize(12);
     $draw->setTextAlignment(Imagick::ALIGN_CENTER);
     $draw->setTextAntialias(true);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation($width / 2, $height / 2, $text);
     $canvas->drawImage($draw);
     $canvas->setImageFormat('png');
     header("Content-Type: image/png");
     echo $canvas;
     $draw->destroy();
     $canvas->clear();
     $canvas->destroy();
     exit;
 }
コード例 #5
0
ファイル: 350x20.php プロジェクト: lknight/habrometr
 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     $color['habr'] = new ImagickPixel("rgb(83, 121, 139)");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Prepare values for drawing main graph
     define('PADDING', 10);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bg']);
     $draw->setStrokeColor($color['habr']);
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => 0)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextUnderColor($color['bg']);
     $draw->setTextAntialias(true);
     $draw->setFillColor($color['text']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $code = $this->_user;
     $draw->setFontSize(strlen($code) > 8 ? 10 : 11);
     if (strlen($code) > 10) {
         $code = substr($code, 0, 9) . '...';
     }
     $draw->annotation(80, 13, $code);
     $textInfo = $this->_canvas->queryFontMetrics($draw, $code, null);
     $nextX = 80 + 9 + $textInfo['textWidth'];
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFontSize(11);
     $draw->setFillColor($color['neutral']);
     $draw->annotation(5, 13, "хаброметр");
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation($nextX, 13, $text = sprintf('%01.2f', $this->_karma));
     $textInfo = $this->_canvas->queryFontMetrics($draw, $text, null);
     $nextX += $textInfo['textWidth'] + 4;
     $draw->setTextUnderColor($color['bg']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $text = sprintf('%01.2f', $this->_extremums['karma_min']) . '/' . sprintf('%01.2f', $this->_extremums['karma_max']);
     $draw->setFontSize(8);
     $draw->setFillColor($color['karma']);
     $draw->annotation($nextX, 13, $text);
     $textInfo = $this->_canvas->queryFontMetrics($draw, $text, null);
     $nextX += $textInfo['textWidth'] + 9;
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation($nextX, 13, $text = sprintf('%01.2f', $this->_habraforce));
     $textInfo = $this->_canvas->queryFontMetrics($draw, $text, null);
     $nextX += $textInfo['textWidth'] + 4;
     $draw->setTextUnderColor($color['bg']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $text = sprintf('%01.2f', $this->_extremums['habraforce_min']) . '/' . sprintf('%01.2f', $this->_extremums['habraforce_max']);
     $draw->setFontSize(8);
     $draw->setFillColor($color['force']);
     $draw->annotation($nextX, 13, $text);
     $image = new Imagick('stuff/bg-user2.gif');
     $this->_canvas->compositeImage($image, Imagick::COMPOSITE_COPY, 64, 3, Imagick::CHANNEL_ALL);
     $image->clear();
     $image->destroy();
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     return true;
 }
コード例 #6
0
ファイル: Imagick.php プロジェクト: jubinpatel/horde
 /**
  * Draw a polyline (a non-closed, non-filled polygon) based on a
  * set of vertices.
  *
  * @param array $vertices  An array of x and y labeled arrays
  *                         (eg. $vertices[0]['x'], $vertices[0]['y'], ...).
  * @param string $color    The color you want to draw the line with.
  * @param string $width    The width of the line.
  */
 public function polyline($verts, $color, $width = 1)
 {
     $draw = new ImagickDraw();
     $draw->setStrokeColor(new ImagickPixel($color));
     $draw->setStrokeWidth($width);
     $draw->setFillColor(new ImagickPixel('none'));
     $draw->polyline($verts);
     try {
         $res = $this->_imagick->drawImage($draw);
     } catch (ImagickException $e) {
         throw new Horde_Image_Exception($e);
     }
     $draw->destroy();
 }
コード例 #7
0
ファイル: HandleImagek.php プロジェクト: locphp/rsf
 public function brushpng($color, $size, $brushpath)
 {
     $info = $this->_handle->getImageGeometry();
     $image = new \Imagick();
     $image->newImage($info["width"], $info["height"], "transparent", "png");
     //$image->setImageFormat("png");
     $draw = new \ImagickDraw();
     $pixel = new \ImagickPixel();
     $pixel->setColor("transparent");
     $draw->setFillColor($pixel);
     $pixel->setColor($color);
     $draw->setStrokeColor($pixel);
     $draw->setStrokeWidth($size);
     $draw->setStrokeLineCap(\imagick::LINECAP_ROUND);
     $draw->setStrokeLineJoin(\imagick::LINEJOIN_ROUND);
     $draw->polyline($brushpath);
     $image->drawImage($draw);
     $pixel->destroy();
     $draw->destroy();
     $this->_handle = $image;
 }
コード例 #8
0
ファイル: 425x120.php プロジェクト: lknight/habrometr
 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeColor($color['line']);
     $draw->setFillColor($color['bg']);
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Prepare values for drawing main graph
     define('BOTTOM_PAD', 30);
     define('TOP_PAD', 25);
     define('LEFT_PAD', 43);
     define('RIGHT_PAD', 15);
     $graph = array('b' => self::HEIGHT - BOTTOM_PAD, 't' => TOP_PAD);
     $graph['height'] = $graph['b'] - $graph['t'];
     $dataHeight = $this->_max_karma - $this->_min_karma;
     if ($dataHeight != 0) {
         $graph['k'] = $graph['height'] / $dataHeight;
     } else {
         $graph['k'] = 1;
     }
     $karma = array_reverse($this->_karma);
     $graph['segmentWidth'] = (self::WIDTH - LEFT_PAD - RIGHT_PAD) / (count($karma) - 1);
     $lastX = LEFT_PAD;
     $lastY = $karma[0];
     $graph['cords'] = array();
     foreach ($karma as $y) {
         $graph['cords'][] = array('x' => (double) $lastX, 'y' => $graph['b'] - round($y - $this->_min_karma) * $graph['k']);
         $lastX += $graph['segmentWidth'];
     }
     //Draw graph
     $draw->polyline($graph['cords']);
     $this->_canvas->drawImage($draw);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bottom_bg']);
     $draw->polygon(array(array('x' => 0, 'y' => $graph['b'] + TOP_SPACER), array('x' => self::WIDTH, 'y' => $graph['b'] + TOP_SPACER), array('x' => self::WIDTH, 'y' => self::HEIGHT), array('x' => 0, 'y' => self::HEIGHT)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextAntialias(true);
     $draw->setFontSize(12);
     $draw->setFillColor($color['text']);
     $draw->setFont(realpath('stuff/arial.ttf'));
     $draw->annotation(2, 13, 'Хаброметр юзера');
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $code = $this->_user;
     if (strlen($code) > 25) {
         $code = substr($code, 0, 22) . '...';
     }
     $draw->annotation(125, 13, $code);
     $image = new Imagick('stuff/bg-user2.gif');
     $this->_canvas->compositeImage($image, Imagick::COMPOSITE_COPY, 109, 2, Imagick::CHANNEL_ALL);
     $image->clear();
     $image->destroy();
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setFontSize(10);
     $draw->setFillColor($color['karma']);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->annotation(2, $graph['t'] + 5, sprintf('%01.2f', $this->_max_karma));
     $draw->annotation(2, $graph['b'] + 2, sprintf('%01.2f', $this->_min_karma));
     $draw->setFontSize(10);
     $draw->setFillColor($color['neutral']);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $t = preg_split('/-|\\s|:/', $this->_logTime);
     $this->_canvas->annotateImage($draw, self::WIDTH - 3, $graph['b'] + 2, -90, $t[2] . '.' . $t[1] . '.' . substr($t[0], -2) . ' ' . $t[3] . ':' . $t[4]);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setFillColor($color['karma']);
     $text = 'min/max: ' . sprintf('%01.2f', $this->_extremums['karma_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['karma_max']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFillColor($color['bg']);
     $draw->annotation(3, $graph['b'] + 25, $text);
     $draw->setFillColor($color['karma']);
     $draw->annotation(2, $graph['b'] + 24, $text);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_RIGHT);
     $text = 'min/max: ' . sprintf('%01.2f', $this->_extremums['habraforce_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['habraforce_max']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFillColor($color['bg']);
     $draw->annotation(self::WIDTH - 3, $graph['b'] + 25, $text);
     $draw->setFillColor($color['force']);
     $draw->annotation(self::WIDTH - 2, $graph['b'] + 24, $text);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_RIGHT);
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(14);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $textInfo = $this->_canvas->queryFontMetrics($draw, sprintf('%01.2f', $this->_habraforce), null);
     $draw->annotation($lastX - $graph['segmentWidth'] + 1 - $textInfo['textWidth'] - 10, 13, sprintf('%01.2f', $karma[count($karma) - 1]));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation($lastX - $graph['segmentWidth'] + 1, 13, sprintf('%01.2f', $this->_habraforce));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $image = new Imagick('stuff/logo_mini.png');
     $this->_canvas->compositeImage($image, Imagick::COMPOSITE_COPY, 3, 47, Imagick::CHANNEL_ALL);
     $image->clear();
     $image->destroy();
     return true;
 }
コード例 #9
0
ファイル: functions.php プロジェクト: sdmmember/Imagick-demos
function setStrokeLineJoin($strokeColor, $fillColor, $backgroundColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeWidth(1);
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeWidth(20);
    $offset = 220;
    $lineJoinStyle = [\Imagick::LINEJOIN_MITER, \Imagick::LINEJOIN_ROUND, \Imagick::LINEJOIN_BEVEL];
    for ($x = 0; $x < count($lineJoinStyle); $x++) {
        $draw->setStrokeLineJoin($lineJoinStyle[$x]);
        $points = [['x' => 40 * 5, 'y' => 10 * 5 + $x * $offset], ['x' => 20 * 5, 'y' => 20 * 5 + $x * $offset], ['x' => 70 * 5, 'y' => 50 * 5 + $x * $offset], ['x' => 40 * 5, 'y' => 10 * 5 + $x * $offset]];
        $draw->polyline($points);
    }
    $image = new \Imagick();
    $image->newImage(500, 700, $backgroundColor);
    $image->setImageFormat("png");
    $image->drawImage($draw);
    header("Content-Type: image/png");
    echo $image->getImageBlob();
}
コード例 #10
0
ファイル: 88x120.php プロジェクト: lknight/habrometr
 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     $color['habr'] = new ImagickPixel("rgb(83, 121, 139)");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Prepare values for drawing main graph
     define('PADDING', 10);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bg']);
     $draw->setStrokeColor($color['habr']);
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => 0)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextUnderColor($color['bg']);
     $draw->setTextAlignment(Imagick::ALIGN_CENTER);
     $draw->setTextAntialias(true);
     $draw->setFillColor($color['text']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $code = $this->_user;
     $draw->setFontSize(strlen($code) > 8 ? 10 : 11);
     if (strlen($code) > 10) {
         $code = substr($code, 0, 9) . '...';
     }
     $draw->annotation(self::WIDTH / 2, self::HEIGHT - 9, $code);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFontSize(11);
     $draw->setFillColor($color['neutral']);
     $draw->annotation(self::WIDTH / 2, 15, "хаброметр");
     $text = sprintf('%01.2f', $this->_extremums['karma_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['karma_max']);
     $draw->setFontSize(9);
     $draw->setFillColor($color['karma']);
     $draw->annotation(self::WIDTH / 2, 55, $text);
     $text = sprintf('%01.2f', $this->_extremums['habraforce_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['habraforce_max']);
     $draw->setFontSize(9);
     $draw->setFillColor($color['force']);
     $draw->annotation(self::WIDTH / 2, 95, $text);
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(14);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation(self::WIDTH / 2, 35, sprintf('%01.2f', $this->_karma));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation(self::WIDTH / 2, 75, sprintf('%01.2f', $this->_habraforce));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     return true;
 }