ManaPHP\Image\Adapter\Imagick::text PHP Method

text() public method

Execute a text
public text ( string $text, integer $offsetX, integer $offsetY, float $opacity = 1, integer $color, integer $size = 12, string $font_file = null ) : static
$text string
$offsetX integer
$offsetY integer
$opacity float
$color integer
$size integer
$font_file string
return static
    public function text($text, $offsetX = 0, $offsetY = 0, $opacity = 1.0, $color = 0x0, $size = 12, $font_file = null)
    {
        $draw = new \ImagickDraw();
        $textColor = sprintf('rgb(%u,%u,%u)', $color >> 16 & 0xff, $color >> 8 & 0xff, $color & 0xff);
        $draw->setFillColor(new \ImagickPixel($textColor));
        if ($font_file) {
            $draw->setFont($this->alias->resolve($font_file));
        }
        $draw->setFontSize($size);
        $draw->setFillOpacity($opacity);
        $draw->setGravity(\Imagick::GRAVITY_NORTHWEST);
        $this->_image->annotateImage($draw, $offsetX, $offsetY, 0, $text);
        $draw->destroy();
        return $this;
    }