C:\xampp2_not used\phpMyAdmin\vendor\bacon\bacon-qr-code\src\BaconQrCode\Renderer\Image\Eps.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
<?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\Image;

use 
BaconQrCode\Renderer\Color\ColorInterface;
use 
BaconQrCode\Renderer\Color\Rgb;
use 
BaconQrCode\Renderer\Color\Cmyk;
use 
BaconQrCode\Renderer\Color\Gray;

/**
 * EPS backend.
 */
class Eps extends AbstractRenderer
{
    
/**
     * EPS string.
     *
     * @var string
     */
    
protected $eps;

    
/**
     * Colors used for drawing.
     *
     * @var array
     */
    
protected $colors = array();

    
/**
     * Current color.
     *
     * @var string
     */
    
protected $currentColor;

    
/**
     * init(): defined by RendererInterface.
     *
     * @see    ImageRendererInterface::init()
     * @return void
     */
    
public function init()
    {
        
$this->eps "%!PS-Adobe-3.0 EPSF-3.0\n"
                   
"%%BoundingBox: 0 0 " $this->finalWidth " " $this->finalHeight "\n"
                   
"/F { rectfill } def\n";
    }

    
/**
     * addColor(): defined by RendererInterface.
     *
     * @see    ImageRendererInterface::addColor()
     * @param  string         $id
     * @param  ColorInterface $color
     * @return void
     */
    
public function addColor($idColorInterface $color)
    {
        if (
            !
$color instanceof Rgb
            
&& !$color instanceof Cmyk
            
&& !$color instanceof Gray
        
) {
            
$color $color->toCmyk();
        }

        
$this->colors[$id] = $color;
    }

    
/**
     * drawBackground(): defined by RendererInterface.
     *
     * @see    ImageRendererInterface::drawBackground()
     * @param  string $colorId
     * @return void
     */
    
public function drawBackground($colorId)
    {
        
$this->setColor($colorId);
        
$this->eps .= "0 0 " $this->finalWidth " " $this->finalHeight " F\n";
    }

    
/**
     * drawBlock(): defined by RendererInterface.
     *
     * @see    ImageRendererInterface::drawBlock()
     * @param  integer $x
     * @param  integer $y
     * @param  string  $colorId
     * @return void
     */
    
public function drawBlock($x$y$colorId)
    {
        
$this->setColor($colorId);
        
$this->eps .= $x " " . ($this->finalHeight $y $this->blockSize) . " " $this->blockSize " " $this->blockSize " F\n";
    }

    
/**
     * getByteStream(): defined by RendererInterface.
     *
     * @see    ImageRendererInterface::getByteStream()
     * @return string
     */
    
public function getByteStream()
    {
        return 
$this->eps;
    }

    
/**
     * Sets color to use.
     *
     * @param  string $colorId
     * @return void
     */
    
protected function setColor($colorId)
    {
        if (
$colorId !== $this->currentColor) {
            
$color $this->colors[$colorId];

            if (
$color instanceof Rgb) {
                
$this->eps .= sprintf(
                    
"%F %F %F setrgbcolor\n",
                    
$color->getRed() / 100,
                    
$color->getGreen() / 100,
                    
$color->getBlue() / 100
                
);
            } elseif (
$color instanceof Cmyk) {
                
$this->eps .= sprintf(
                    
"%F %F %F %F setcmykcolor\n",
                    
$color->getCyan() / 100,
                    
$color->getMagenta() / 100,
                    
$color->getYellow() / 100,
                    
$color->getBlack() / 100
                
);
            } elseif (
$color instanceof Gray) {
                
$this->eps .= sprintf(
                    
"%F setgray\n",
                    
$color->getGray() / 100
                
);
            }

            
$this->currentColor $colorId;
        }
    }
}
x

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