C:\xampp\phpMyAdmin\vendor\bacon\bacon-qr-code\src\BaconQrCode\Renderer\Color\Cmyk.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
 * BaconQrCode
 *
 * @link      http://github.com/Bacon/BaconQrCode For the canonical source repository
 * @copyright 2013 Ben 'DASPRiD' Scholzen
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
 */

namespace BaconQrCode\Renderer\Color;

use 
BaconQrCode\Exception;

/**
 * CMYK color.
 */
class Cmyk implements ColorInterface
{
    
/**
     * Cyan value.
     *
     * @var integer
     */
    
protected $cyan;

    
/**
     * Magenta value.
     *
     * @var integer
     */
    
protected $magenta;

    
/**
     * Yellow value.
     *
     * @var integer
     */
    
protected $yellow;

    
/**
     * Black value.
     *
     * @var integer
     */
    
protected $black;

    
/**
     * Creates a new CMYK color.
     *
     * @param integer $cyan
     * @param integer $magenta
     * @param integer $yellow
     * @param integer $black
     */
    
public function __construct($cyan$magenta$yellow$black)
    {
        if (
$cyan || $cyan 100) {
            throw new 
Exception\InvalidArgumentException('Cyan must be between 0 and 100');
        }

        if (
$magenta || $magenta 100) {
            throw new 
Exception\InvalidArgumentException('Magenta must be between 0 and 100');
        }

        if (
$yellow || $yellow 100) {
            throw new 
Exception\InvalidArgumentException('Yellow must be between 0 and 100');
        }

        if (
$black || $black 100) {
            throw new 
Exception\InvalidArgumentException('Black must be between 0 and 100');
        }

        
$this->cyan    = (int) $cyan;
        
$this->magenta = (int) $magenta;
        
$this->yellow  = (int) $yellow;
        
$this->black   = (int) $black;
    }

    
/**
     * Returns the cyan value.
     *
     * @return integer
     */
    
public function getCyan()
    {
        return 
$this->cyan;
    }

    
/**
     * Returns the magenta value.
     *
     * @return integer
     */
    
public function getMagenta()
    {
        return 
$this->magenta;
    }

    
/**
     * Returns the yellow value.
     *
     * @return integer
     */
    
public function getYellow()
    {
        return 
$this->yellow;
    }

    
/**
     * Returns the black value.
     *
     * @return integer
     */
    
public function getBlack()
    {
        return 
$this->black;
    }

    
/**
     * toRgb(): defined by ColorInterface.
     *
     * @see    ColorInterface::toRgb()
     * @return Rgb
     */
    
public function toRgb()
    {
        
$k $this->black 100;
        
$c = (-$k $this->cyan $k 100 $this->cyan) / 100;
        
$m = (-$k $this->magenta $k 100 $this->magenta) / 100;
        
$y = (-$k $this->yellow $k 100 $this->yellow) / 100;

        return new 
Rgb(
            -
$c 255 255,
            -
$m 255 255,
            -
$y 255 255
        
);
    }

    
/**
     * toCmyk(): defined by ColorInterface.
     *
     * @see    ColorInterface::toCmyk()
     * @return Cmyk
     */
    
public function toCmyk()
    {
        return 
$this;
    }

    
/**
     * toGray(): defined by ColorInterface.
     *
     * @see    ColorInterface::toGray()
     * @return Gray
     */
    
public function toGray()
    {
        return 
$this->toRgb()->toGray();
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586