Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js new file mode 100644 index 0000000..501b69b --- a/dev/null +++ b/frontend/gamma/js/Clipperz/PM/UI/Canvas/Features/protect.js | |||
@@ -0,0 +1,237 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer to http://www.clipperz.com | ||
12 | |||
13 | * Javascript Crypto Library is free software: you can redistribute | ||
14 | it and/or modify it under the terms of the GNU Affero General Public | ||
15 | License as published by the Free Software Foundation, either version | ||
16 | 3 of the License, or (at your option) any later version. | ||
17 | |||
18 | * Javascript Crypto Library is distributed in the hope that it will | ||
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
21 | See the GNU Affero General Public License for more details. | ||
22 | |||
23 | * You should have received a copy of the GNU Affero General Public | ||
24 | License along with Javascript Crypto Library. If not, see | ||
25 | <http://www.gnu.org/licenses/>. | ||
26 | |||
27 | */ | ||
28 | |||
29 | // | ||
30 | //protect.js | ||
31 | //protect | ||
32 | // | ||
33 | //Created by Giulio Cesare Solaroli on 3/7/10 | ||
34 | //Copyright 2010 Clipperz | ||
35 | //This code was generated by Opacity. You may use or modify it in any way. | ||
36 | // | ||
37 | |||
38 | var kClipperz_PM_UI_Canvas_Features_protectWidth = 76.0; | ||
39 | var kClipperz_PM_UI_Canvas_Features_protectHeight = 76.0; | ||
40 | |||
41 | function Clipperz_PM_UI_Canvas_Features_protect(canvas, aColor, aBannerColor, aBannerBackgroundColor) | ||
42 | { | ||
43 | var context = canvas.getContext("2d"); | ||
44 | var alignStroke; | ||
45 | var resolution; | ||
46 | var path; | ||
47 | var pointX; | ||
48 | var pointY; | ||
49 | var controlPoint1X; | ||
50 | var controlPoint1Y; | ||
51 | var controlPoint2X; | ||
52 | var controlPoint2Y; | ||
53 | var stroke; | ||
54 | if (window.devicePixelRatio) | ||
55 | resolution = window.devicePixelRatio; | ||
56 | else | ||
57 | resolution = 1.0; | ||
58 | resolution *= 0.5 * (canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth + canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight); | ||
59 | |||
60 | context.save(); | ||
61 | context.scale(canvas.width / kClipperz_PM_UI_Canvas_Features_protectWidth, canvas.height / kClipperz_PM_UI_Canvas_Features_protectHeight); | ||
62 | context.clearRect(0.0, 0.0, kClipperz_PM_UI_Canvas_Features_protectWidth, kClipperz_PM_UI_Canvas_Features_protectHeight); | ||
63 | |||
64 | // Layer 1 | ||
65 | |||
66 | alignStroke = 0.0; | ||
67 | context.beginPath(); | ||
68 | pointX = 38.5; | ||
69 | pointY = 36.0; | ||
70 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
71 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
72 | context.moveTo(pointX, pointY); | ||
73 | pointX = 37.068; | ||
74 | pointY = 38.816; | ||
75 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
76 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
77 | controlPoint1X = 37.41; | ||
78 | controlPoint1Y = 36.234; | ||
79 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
80 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
81 | controlPoint2X = 37.175; | ||
82 | controlPoint2Y = 37.907; | ||
83 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
84 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
85 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
86 | pointX = 37.031; | ||
87 | pointY = 40.802; | ||
88 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
89 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
90 | controlPoint1X = 36.991; | ||
91 | controlPoint1Y = 39.474; | ||
92 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
93 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
94 | controlPoint2X = 36.98; | ||
95 | controlPoint2Y = 40.141; | ||
96 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
97 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
98 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
99 | pointX = 37.258; | ||
100 | pointY = 42.23; | ||
101 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
102 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
103 | controlPoint1X = 37.068; | ||
104 | controlPoint1Y = 41.283; | ||
105 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
106 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
107 | controlPoint2X = 37.139; | ||
108 | controlPoint2Y = 41.762; | ||
109 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
110 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
111 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
112 | pointX = 38.348; | ||
113 | pointY = 43.979; | ||
114 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
115 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
116 | controlPoint1X = 37.402; | ||
117 | controlPoint1Y = 42.799; | ||
118 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
119 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
120 | controlPoint2X = 37.682; | ||
121 | controlPoint2Y = 43.798; | ||
122 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
123 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
124 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
125 | pointX = 38.5; | ||
126 | pointY = 36.0; | ||
127 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
128 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
129 | controlPoint1X = 40.249; | ||
130 | controlPoint1Y = 44.497; | ||
131 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
132 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
133 | controlPoint2X = 40.723; | ||
134 | controlPoint2Y = 36.303; | ||
135 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
136 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
137 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
138 | pointX = 38.5; | ||
139 | pointY = 36.0; | ||
140 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
141 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
142 | context.lineTo(pointX, pointY); | ||
143 | context.closePath(); | ||
144 | pointX = 50.0; | ||
145 | pointY = 52.0; | ||
146 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
147 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
148 | context.moveTo(pointX, pointY); | ||
149 | pointX = 26.0; | ||
150 | pointY = 52.0; | ||
151 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
152 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
153 | context.lineTo(pointX, pointY); | ||
154 | pointX = 26.0; | ||
155 | pointY = 33.0; | ||
156 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
157 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
158 | context.lineTo(pointX, pointY); | ||
159 | pointX = 50.0; | ||
160 | pointY = 33.0; | ||
161 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
162 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
163 | context.lineTo(pointX, pointY); | ||
164 | pointX = 50.0; | ||
165 | pointY = 52.0; | ||
166 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
167 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
168 | context.lineTo(pointX, pointY); | ||
169 | context.closePath(); | ||
170 | context.fillStyle = aColor; | ||
171 | context.fill(); | ||
172 | |||
173 | alignStroke = 0.0; | ||
174 | context.beginPath(); | ||
175 | pointX = 47.0; | ||
176 | pointY = 32.463; | ||
177 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
178 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
179 | context.moveTo(pointX, pointY); | ||
180 | pointX = 38.0; | ||
181 | pointY = 52.0; | ||
182 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
183 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
184 | controlPoint1X = 47.0; | ||
185 | controlPoint1Y = 52.925; | ||
186 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
187 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
188 | controlPoint2X = 38.0; | ||
189 | controlPoint2Y = 52.0; | ||
190 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
191 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
192 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
193 | pointX = 29.0; | ||
194 | pointY = 32.463; | ||
195 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
196 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
197 | controlPoint1X = 38.0; | ||
198 | controlPoint1Y = 52.0; | ||
199 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
200 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
201 | controlPoint2X = 29.0; | ||
202 | controlPoint2Y = 52.925; | ||
203 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
204 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
205 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
206 | pointX = 47.0; | ||
207 | pointY = 32.463; | ||
208 | pointX = (Math.round(resolution * pointX + alignStroke) - alignStroke) / resolution; | ||
209 | pointY = (Math.round(resolution * pointY + alignStroke) - alignStroke) / resolution; | ||
210 | controlPoint1X = 29.0; | ||
211 | controlPoint1Y = 12.0; | ||
212 | controlPoint1X = (Math.round(resolution * controlPoint1X + alignStroke) - alignStroke) / resolution; | ||
213 | controlPoint1Y = (Math.round(resolution * controlPoint1Y + alignStroke) - alignStroke) / resolution; | ||
214 | controlPoint2X = 47.0; | ||
215 | controlPoint2Y = 12.0; | ||
216 | controlPoint2X = (Math.round(resolution * controlPoint2X + alignStroke) - alignStroke) / resolution; | ||
217 | controlPoint2Y = (Math.round(resolution * controlPoint2Y + alignStroke) - alignStroke) / resolution; | ||
218 | context.bezierCurveTo(controlPoint1X, controlPoint1Y, controlPoint2X, controlPoint2Y, pointX, pointY); | ||
219 | context.closePath(); | ||
220 | context.strokeStyle = aColor; | ||
221 | stroke = 4.0; | ||
222 | stroke *= resolution; | ||
223 | if (stroke < 1.0) | ||
224 | stroke = Math.ceil(stroke); | ||
225 | else | ||
226 | stroke = Math.round(stroke); | ||
227 | stroke /= resolution; | ||
228 | stroke *= 2.0; | ||
229 | context.lineWidth = stroke; | ||
230 | context.lineCap = "square"; | ||
231 | context.save(); | ||
232 | context.clip(); | ||
233 | context.stroke(); | ||
234 | context.restore(); | ||
235 | |||
236 | context.restore(); | ||
237 | } | ||