- Модуль: ui
- Путь к файлу: ~/bitrix/modules/ui/lib/barcode/barcodegenerator.php
- Класс: BitrixUIBarcodeBarcodeGenerator
- Вызов: BarcodeGenerator::matrix_render_image
private function matrix_render_image(
$image, $code, $x, $y, $w, $h, $colors, $widths, $options
) {
$shape = (isset($options['ms']) ? strtolower($options['ms']) : '');
$density = (isset($options['md']) ? (float)$options['md'] : 1);
list($width, $height) = $this->matrix_calculate_size($code, $widths);
if ($width && $height) {
$scale = min($w / $width, $h / $height);
$scale = (($scale > 1) ? floor($scale) : 1);
$x = floor($x + ($w - $width * $scale) / 2);
$y = floor($y + ($h - $height * $scale) / 2);
} else {
$scale = 1;
$x = floor($x + $w / 2);
$y = floor($y + $h / 2);
}
$x += $code['q'][3] * $widths[0] * $scale;
$y += $code['q'][0] * $widths[0] * $scale;
$wh = $widths[1] * $scale;
foreach ($code['b'] as $by => $row) {
$y1 = $y + $by * $wh;
foreach ($row as $bx => $color) {
$x1 = $x + $bx * $wh;
$mc = $colors[$color];
$this->matrix_dot_image(
$image, $x1, $y1, $wh, $wh, $mc, $shape, $density
);
}
}
}