...Человеческий поиск в разработке...
- Модуль: ui
- Путь к файлу: ~/bitrix/modules/ui/lib/barcode/barcodegenerator.php
- Класс: BitrixUIBarcodeBarcodeGenerator
- Вызов: BarcodeGenerator::allocate_color
private function allocate_color($image, $color) { $color = preg_replace('/[^0-9A-Fa-f]/', '', $color); switch (strlen($color)) { case 1: $v = hexdec($color) * 17; return imagecolorallocate($image, $v, $v, $v); case 2: $v = hexdec($color); return imagecolorallocate($image, $v, $v, $v); case 3: $r = hexdec(substr($color, 0, 1)) * 17; $g = hexdec(substr($color, 1, 1)) * 17; $b = hexdec(substr($color, 2, 1)) * 17; return imagecolorallocate($image, $r, $g, $b); case 4: $a = hexdec(substr($color, 0, 1)) * 17; $r = hexdec(substr($color, 1, 1)) * 17; $g = hexdec(substr($color, 2, 1)) * 17; $b = hexdec(substr($color, 3, 1)) * 17; $a = round((255 - $a) * 127 / 255); return imagecolorallocatealpha($image, $r, $g, $b, $a); case 6: $r = hexdec(substr($color, 0, 2)); $g = hexdec(substr($color, 2, 2)); $b = hexdec(substr($color, 4, 2)); return imagecolorallocate($image, $r, $g, $b); case 8: $a = hexdec(substr($color, 0, 2)); $r = hexdec(substr($color, 2, 2)); $g = hexdec(substr($color, 4, 2)); $b = hexdec(substr($color, 6, 2)); $a = round((255 - $a) * 127 / 255); return imagecolorallocatealpha($image, $r, $g, $b, $a); default: return imagecolorallocatealpha($image, 0, 0, 0, 127); } }