• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/component/userprofile/stresslevel/img.php
  • Класс: BitrixIntranetComponentUserProfileStressLevelImg
  • Вызов: Img::drawImageValue
protected function drawImageValue(array $params = [])
{
	$stressValue = (
		isset($params['value'])
			? intval($params['value'])
			: false
	);
	$canvas = (
		isset($params['canvas'])
			? $params['canvas']
			: false
	);
	$center = (
		isset($params['center'])
			? $params['center']
			: false
	);
	$factor = $this->factor;

	if (
		!$canvas
		|| !$center
		|| $stressValue === false
	)
	{
		return false;
	}

	$imageValue = new ImagickDraw();
	$fontPath = $this->getImagePartsPath().'/OpenSans-Semibold.ttf';
	if (!file_exists($fontPath))
	{
		return false;
	}
	$imageValue->setFont($fontPath);
	$imageValue->setFillColor('#525c69');
	$imageValue->setStrokeAntialias(true);
	$imageValue->setTextAntialias(true);
	$imageValue->setFontSize($factor*26);
	$imageValue->setTextAlignment(Imagick::ALIGN_CENTER);
	$imageValue->annotation($center['x'], $center['y']+$factor*10, $stressValue);
	$canvas->drawImage($imageValue);

	$metrics = $canvas->queryFontMetrics($imageValue, $stressValue);

	return $metrics;
}