403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/File/Image/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/File/Image/Color.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2020 Bitrix
 */

namespace Bitrix\Main\File\Image;

class Color
{
	protected
		$red,
		$green,
		$blue,
		$alpha;

	/**
	 * Color constructor.
	 * @param int $red
	 * @param int $green
	 * @param int $blue
	 * @param float $alpha
	 */
	public function __construct($red = 0, $green = 0, $blue = 0, $alpha = 1.0)
	{
		$this->setRed($red)
			->setGreen($green)
			->setBlue($blue)
			->setAlpha($alpha);
	}

	/**
	 * Creates the color from a string like #ffaabb or ffaabb.
	 * @param string $color
	 * @return Color
	 */
	public static function createFromHex($color)
	{
		$color = preg_replace("/[^a-f0-9]/is", "", $color);
		if(strlen($color) != 6)
		{
			$color = "FF0000";
		}

		return new static(
			hexdec(substr($color, 0, 2)),
			hexdec(substr($color, 2, 2)),
			hexdec(substr($color, 4, 2))
		);
	}

	/**
	 * Returns hex representation e.g. #aabbcc.
	 * @return string
	 */
	public function toHex()
	{
		return sprintf("#%02x%02x%02x", $this->getRed(), $this->getGreen(), $this->getBlue());
	}

	/**
	 * Returns rgba representation, e.g. rgba(255, 0, 0, 0.5)
	 * @return string
	 */
	public function toRgba()
	{
		return sprintf("rgba(%d, %d, %d, %0.4f)", $this->getRed(), $this->getGreen(), $this->getBlue(), $this->getAlpha());
	}

	/**
	 * @return int
	 */
	public function getRed()
	{
		return $this->red;
	}

	/**
	 * @param int $red
	 * @return Color
	 */
	public function setRed($red)
	{
		if($red < 0 || $red > 255)
		{
			$red = 0;
		}
		$this->red = (int)$red;
		return $this;
	}

	/**
	 * @return int
	 */
	public function getGreen()
	{
		return $this->green;
	}

	/**
	 * @param int $green
	 * @return Color
	 */
	public function setGreen($green)
	{
		if($green < 0 || $green > 255)
		{
			$green = 0;
		}
		$this->green = (int)$green;
		return $this;
	}

	/**
	 * @return int
	 */
	public function getBlue()
	{
		return $this->blue;
	}

	/**
	 * @param int $blue
	 * @return Color
	 */
	public function setBlue($blue)
	{
		if($blue < 0 || $blue > 255)
		{
			$blue = 0;
		}
		$this->blue = (int)$blue;
		return $this;
	}

	/**
	 * @return float
	 */
	public function getAlpha()
	{
		return $this->alpha;
	}

	/**
	 * @param float $alpha
	 * @return Color
	 */
	public function setAlpha($alpha)
	{
		$this->alpha = (float)$alpha;
		return $this;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit