static function onImageQuality($string, $image, $fontName, $x = 0, $y = 0, $size = 10, $defaultColor = '000', $precision = 2)
    {
        $defaultColor = Color::StringToRgb24($defaultColor);
        $factor = 1 << ($precision > 31 ? 31 : $precision);

        $tokens = self::parseString($string);
        $rawText = '';
        foreach ($tokens as $token)
            $rawText .= $token->text;
        $maxBBox = imagettfbbox($size, 0, self::$fonts[$fontName]->getFile(), $rawText);

        $brush = imagecreatetruecolor($maxBBox[2] * 2, -$maxBBox[5] + 5);
        imagefill($brush, 0, 0, 0x7fffffff);
        $hugeBrush = imagecreatetruecolor(imagesx($brush) * $factor, imagesy($brush) * $factor);
        imagefill($hugeBrush, 0, 0, 0x7fffffff);

        $xOffset = 0;
        foreach ($tokens as $token)
            $xOffset += $token->onImage($hugeBrush, $fontName, $xOffset, imagesy($hugeBrush) * .75, $factor * $size, $defaultColor, $factor);

        $brushX = $x + imagesx($brush) / 2;
        $brushY = $y - imagesy($brush) * .25;
        imagecopyresampled($brush, $hugeBrush, 0, 0, 0, 0, imagesx($brush), imagesy($brush), imagesx($hugeBrush), imagesy($hugeBrush));
        imagesetbrush($image, $brush);
        imageline($image, $brushX, $brushY, $brushX, $brushY, IMG_COLOR_BRUSHED);
    }
static function onImageQuality($string, $image, $fontName, $x = 0, $y = 0, $size = 10, $defaultColor = '000', $precision = 2)
    {
        $defaultColor = Color::StringToRgb24($defaultColor);
        $factor = 1 << ($precision > 31 ? 31 : $precision);

        $tokens = self::parseString($string);
        $rawText = '';
        foreach ($tokens as $token)
            $rawText .= $token->text;
        $maxBBox = imagettfbbox($size, 0, self::$fonts[$fontName]->getFile(), $rawText);

        $brush = imagecreatetruecolor($maxBBox[2] * 2, -$maxBBox[5] + 5);
        imagefill($brush, 0, 0, 0x7fffffff);
        $hugeBrush = imagecreatetruecolor(imagesx($brush) * $factor, imagesy($brush) * $factor);
        imagefill($hugeBrush, 0, 0, 0x7fffffff);

        $xOffset = 0;
        foreach ($tokens as $token)
            $xOffset += $token->onImage($hugeBrush, $fontName, $xOffset, imagesy($hugeBrush) * .75, $factor * $size, $defaultColor, $factor);

        $brushX = $x + imagesx($brush) / 2;
        $brushY = $y - imagesy($brush) * .25;
        imagecopyresampled($brush, $hugeBrush, 0, 0, 0, 0, imagesx($brush), imagesy($brush), imagesx($hugeBrush), imagesy($hugeBrush));
        imagesetbrush($image, $brush);
        imageline($image, $brushX, $brushY, $brushX, $brushY, IMG_COLOR_BRUSHED);
    }
static function onImageQuality ( $ string , $ image , $ fontName , $ x = 0 , $ y = 0 , $ size = 10 , $ defaultColor = '000' , $ precision = 2 ) { $ defaultColor = Color :: StringToRgb24 ( $ defaultColor ) ; $ factor = 1 << ( $ precision > 31 ? 31 : $ precision ) ; $ tokens = self :: parseString ( $ string ) ; $ rawText = '' ; foreach ( $ tokens as $ token ) $ rawText .= $ token -> text ; $ maxBBox = imagettfbbox ( $ size , 0 , self :: $ fonts [ $ fontName ] -> getFile ( ) , $ rawText ) ; $ brush = imagecreatetruecolor ( $ maxBBox [ 2 ] * 2 , - $ maxBBox [ 5 ] + 5 ) ; imagefill ( $ brush , 0 , 0 , 0x7fffffff ) ; $ hugeBrush = imagecreatetruecolor ( imagesx ( $ brush ) * $ factor , imagesy ( $ brush ) * $ factor ) ; imagefill ( $ hugeBrush , 0 , 0 , 0x7fffffff ) ; $ xOffset = 0 ; foreach ( $ tokens as $ token ) $ xOffset += $ token -> onImage ( $ hugeBrush , $ fontName , $ xOffset , imagesy ( $ hugeBrush ) * .75 , $ factor * $ size , $ defaultColor , $ factor ) ; $ brushX = $ x + imagesx ( $ brush ) / 2 ; $ brushY = $ y - imagesy ( $ brush ) * .25 ; imagecopyresampled ( $ brush , $ hugeBrush , 0 , 0 , 0 , 0 , imagesx ( $ brush ) , imagesy ( $ brush ) , imagesx ( $ hugeBrush ) , imagesy ( $ hugeBrush ) ) ; imagesetbrush ( $ image , $ brush ) ; imageline ( $ image , $ brushX , $ brushY , $ brushX , $ brushY , IMG_COLOR_BRUSHED ) ; }
Draw a string with on an image using quality method. Slow with big text size
@param string $string The style-coded string to draw
@param imageResource $image The image to draw on
@param string $fontName The TTF font to use, which has been declared previously
@param int $x X position
@param int $y Y position
@param int $size Font size
@param string $defaultColor Default text color in 3 or 6 hexadecimal characters
@param int $precision Higher value means higher precision (but also longer execution time), usual values are 1 to 3
Draw a string with on an image using quality method . Slow with big text size