Affichage barre de progression et image en local lors de l'upload.
[Plinn.git] / photoshop / image_actions.jsxinc
1
2
3 function _loadingProgress(fsPath, background, bullet) {
4
5 // Sélection du calque de fond ===========================
6 var id3 = charIDToTypeID( "slct" );
7 var desc2 = new ActionDescriptor();
8 var id4 = charIDToTypeID( "null" );
9 var ref1 = new ActionReference();
10 var id5 = charIDToTypeID( "Lyr " );
11 ref1.putName( id5, "Fond" );
12 desc2.putReference( id4, ref1 );
13 var id6 = charIDToTypeID( "MkVs" );
14 desc2.putBoolean( id6, false );
15 executeAction( id3, desc2, DialogModes.NO );
16
17 // Changement de la couleur de fond ======================
18 var id7 = charIDToTypeID( "setd" );
19 var desc3 = new ActionDescriptor();
20 var id8 = charIDToTypeID( "null" );
21 var ref2 = new ActionReference();
22 var id9 = stringIDToTypeID( "contentLayer" );
23 var id10 = charIDToTypeID( "Ordn" );
24 var id11 = charIDToTypeID( "Trgt" );
25 ref2.putEnumerated( id9, id10, id11 );
26 desc3.putReference( id8, ref2 );
27 var id12 = charIDToTypeID( "T " );
28 var desc4 = new ActionDescriptor();
29 var id13 = charIDToTypeID( "Clr " );
30 var desc5 = new ActionDescriptor();
31 var id14 = charIDToTypeID( "Rd " );
32 desc5.putDouble( id14, background[0] );
33 var id15 = charIDToTypeID( "Grn " );
34 desc5.putDouble( id15, background[1] );
35 var id16 = charIDToTypeID( "Bl " );
36 desc5.putDouble( id16, background[2] );
37 var id17 = charIDToTypeID( "RGBC" );
38 desc4.putObject( id13, id17, desc5 );
39 var id18 = stringIDToTypeID( "solidColorLayer" );
40 desc3.putObject( id12, id18, desc4 );
41 executeAction( id7, desc3, DialogModes.NO );
42
43 // Sélection du calque 'bullet' ==========================
44 var id19 = charIDToTypeID( "slct" );
45 var desc6 = new ActionDescriptor();
46 var id20 = charIDToTypeID( "null" );
47 var ref3 = new ActionReference();
48 var id21 = charIDToTypeID( "Lyr " );
49 ref3.putName( id21, "bullet" );
50 desc6.putReference( id20, ref3 );
51 var id22 = charIDToTypeID( "MkVs" );
52 desc6.putBoolean( id22, false );
53 executeAction( id19, desc6, DialogModes.NO );
54
55 // Définition de la couleur de la bullet =================
56 var id23 = charIDToTypeID( "setd" );
57 var desc7 = new ActionDescriptor();
58 var id24 = charIDToTypeID( "null" );
59 var ref4 = new ActionReference();
60 var id25 = stringIDToTypeID( "contentLayer" );
61 var id26 = charIDToTypeID( "Ordn" );
62 var id27 = charIDToTypeID( "Trgt" );
63 ref4.putEnumerated( id25, id26, id27 );
64 desc7.putReference( id24, ref4 );
65 var id28 = charIDToTypeID( "T " );
66 var desc8 = new ActionDescriptor();
67 var id29 = charIDToTypeID( "Clr " );
68 var desc9 = new ActionDescriptor();
69 var id30 = charIDToTypeID( "Rd " );
70 desc9.putDouble( id30, bullet[0] );
71 var id31 = charIDToTypeID( "Grn " );
72 desc9.putDouble( id31, bullet[1] );
73 var id32 = charIDToTypeID( "Bl " );
74 desc9.putDouble( id32, bullet[2] );
75 var id33 = charIDToTypeID( "RGBC" );
76 desc8.putObject( id29, id33, desc9 );
77 var id34 = stringIDToTypeID( "solidColorLayer" );
78 desc7.putObject( id28, id34, desc8 );
79 executeAction( id23, desc7, DialogModes.NO );
80
81 // Enregistrement de l'image gif =========================
82 var id87 = charIDToTypeID( "Expr" );
83 var desc14 = new ActionDescriptor();
84 var id88 = charIDToTypeID( "Usng" );
85 var desc15 = new ActionDescriptor();
86 var id89 = charIDToTypeID( "Op " );
87 var id90 = charIDToTypeID( "SWOp" );
88 var id91 = charIDToTypeID( "OpSa" );
89 desc15.putEnumerated( id89, id90, id91 );
90 var id92 = charIDToTypeID( "Fmt " );
91 var id93 = charIDToTypeID( "IRFm" );
92 var id94 = charIDToTypeID( "GIFf" );
93 desc15.putEnumerated( id92, id93, id94 );
94 var id95 = charIDToTypeID( "Intr" );
95 desc15.putBoolean( id95, false );
96 var id96 = charIDToTypeID( "RedA" );
97 var id97 = charIDToTypeID( "IRRd" );
98 var id98 = charIDToTypeID( "Sltv" );
99 desc15.putEnumerated( id96, id97, id98 );
100 var id99 = charIDToTypeID( "RChT" );
101 desc15.putBoolean( id99, false );
102 var id100 = charIDToTypeID( "RChV" );
103 desc15.putBoolean( id100, false );
104 var id101 = charIDToTypeID( "AuRd" );
105 desc15.putBoolean( id101, false );
106 var id102 = charIDToTypeID( "NCol" );
107 desc15.putInteger( id102, 256 );
108 var id103 = charIDToTypeID( "Dthr" );
109 var id104 = charIDToTypeID( "IRDt" );
110 var id105 = charIDToTypeID( "Dfsn" );
111 desc15.putEnumerated( id103, id104, id105 );
112 var id106 = charIDToTypeID( "DthA" );
113 desc15.putInteger( id106, 100 );
114 var id107 = charIDToTypeID( "DChS" );
115 desc15.putInteger( id107, 0 );
116 var id108 = charIDToTypeID( "DCUI" );
117 desc15.putInteger( id108, 0 );
118 var id109 = charIDToTypeID( "DChT" );
119 desc15.putBoolean( id109, false );
120 var id110 = charIDToTypeID( "DChV" );
121 desc15.putBoolean( id110, false );
122 var id111 = charIDToTypeID( "WebS" );
123 desc15.putInteger( id111, 0 );
124 var id112 = charIDToTypeID( "TDth" );
125 var id113 = charIDToTypeID( "IRDt" );
126 var id114 = charIDToTypeID( "None" );
127 desc15.putEnumerated( id112, id113, id114 );
128 var id115 = charIDToTypeID( "TDtA" );
129 desc15.putInteger( id115, 100 );
130 var id116 = charIDToTypeID( "Loss" );
131 desc15.putInteger( id116, 0 );
132 var id117 = charIDToTypeID( "LChS" );
133 desc15.putInteger( id117, 0 );
134 var id118 = charIDToTypeID( "LCUI" );
135 desc15.putInteger( id118, 100 );
136 var id119 = charIDToTypeID( "LChT" );
137 desc15.putBoolean( id119, false );
138 var id120 = charIDToTypeID( "LChV" );
139 desc15.putBoolean( id120, false );
140 var id121 = charIDToTypeID( "Trns" );
141 desc15.putBoolean( id121, false );
142 var id122 = charIDToTypeID( "Mtt " );
143 desc15.putBoolean( id122, true );
144 var id123 = charIDToTypeID( "MttR" );
145 desc15.putInteger( id123, 255 );
146 var id124 = charIDToTypeID( "MttG" );
147 desc15.putInteger( id124, 255 );
148 var id125 = charIDToTypeID( "MttB" );
149 desc15.putInteger( id125, 255 );
150 var id126 = charIDToTypeID( "SHTM" );
151 desc15.putBoolean( id126, false );
152 var id127 = charIDToTypeID( "SImg" );
153 desc15.putBoolean( id127, true );
154 var id128 = charIDToTypeID( "SSSO" );
155 desc15.putBoolean( id128, false );
156 var id129 = charIDToTypeID( "SSLt" );
157 var list2 = new ActionList();
158 desc15.putList( id129, list2 );
159 var id130 = charIDToTypeID( "DIDr" );
160 desc15.putBoolean( id130, false );
161 var id131 = charIDToTypeID( "In " );
162 desc15.putPath( id131, new File( fsPath ) );
163 var id132 = stringIDToTypeID( "SaveForWeb" );
164 desc14.putObject( id88, id132, desc15 );
165 executeAction( id87, desc14, DialogModes.NO );
166 }
167
168 function _plinnLogo(fsPath, background, bullet) {
169 // Sélection du calque de fond ===========================
170 var id7 = charIDToTypeID( "slct" );
171 var desc3 = new ActionDescriptor();
172 var id8 = charIDToTypeID( "null" );
173 var ref2 = new ActionReference();
174 var id9 = charIDToTypeID( "Lyr " );
175 ref2.putName( id9, "Fond" );
176 desc3.putReference( id8, ref2 );
177 var id10 = charIDToTypeID( "MkVs" );
178 desc3.putBoolean( id10, false );
179 executeAction( id7, desc3, DialogModes.NO );
180
181 // Définition de la couleur de fond ======================
182 var id11 = charIDToTypeID( "setd" );
183 var desc4 = new ActionDescriptor();
184 var id12 = charIDToTypeID( "null" );
185 var ref3 = new ActionReference();
186 var id13 = stringIDToTypeID( "contentLayer" );
187 var id14 = charIDToTypeID( "Ordn" );
188 var id15 = charIDToTypeID( "Trgt" );
189 ref3.putEnumerated( id13, id14, id15 );
190 desc4.putReference( id12, ref3 );
191 var id16 = charIDToTypeID( "T " );
192 var desc5 = new ActionDescriptor();
193 var id17 = charIDToTypeID( "Clr " );
194 var desc6 = new ActionDescriptor();
195 var id18 = charIDToTypeID( "Rd " );
196 desc6.putDouble( id18, background[0] );
197 var id19 = charIDToTypeID( "Grn " );
198 desc6.putDouble( id19, background[1] );
199 var id20 = charIDToTypeID( "Bl " );
200 desc6.putDouble( id20, background[2] );
201 var id21 = charIDToTypeID( "RGBC" );
202 desc5.putObject( id17, id21, desc6 );
203 var id22 = stringIDToTypeID( "solidColorLayer" );
204 desc4.putObject( id16, id22, desc5 );
205 executeAction( id11, desc4, DialogModes.NO );
206
207 // Sélection du calque avec la bullet ====================
208 var id23 = charIDToTypeID( "slct" );
209 var desc7 = new ActionDescriptor();
210 var id24 = charIDToTypeID( "null" );
211 var ref4 = new ActionReference();
212 var id25 = charIDToTypeID( "Lyr " );
213 ref4.putName( id25, "Fond 2" );
214 desc7.putReference( id24, ref4 );
215 var id26 = charIDToTypeID( "MkVs" );
216 desc7.putBoolean( id26, false );
217 executeAction( id23, desc7, DialogModes.NO );
218
219 // Définition de la couleur de la bullet =================
220 var id27 = charIDToTypeID( "setd" );
221 var desc8 = new ActionDescriptor();
222 var id28 = charIDToTypeID( "null" );
223 var ref5 = new ActionReference();
224 var id29 = stringIDToTypeID( "contentLayer" );
225 var id30 = charIDToTypeID( "Ordn" );
226 var id31 = charIDToTypeID( "Trgt" );
227 ref5.putEnumerated( id29, id30, id31 );
228 desc8.putReference( id28, ref5 );
229 var id32 = charIDToTypeID( "T " );
230 var desc9 = new ActionDescriptor();
231 var id33 = charIDToTypeID( "Clr " );
232 var desc10 = new ActionDescriptor();
233 var id34 = charIDToTypeID( "Rd " );
234 desc10.putDouble( id34, bullet[0] );
235 var id35 = charIDToTypeID( "Grn " );
236 desc10.putDouble( id35, bullet[1] );
237 var id36 = charIDToTypeID( "Bl " );
238 desc10.putDouble( id36, bullet[2] );
239 var id37 = charIDToTypeID( "RGBC" );
240 desc9.putObject( id33, id37, desc10 );
241 var id38 = stringIDToTypeID( "solidColorLayer" );
242 desc8.putObject( id32, id38, desc9 );
243 executeAction( id27, desc8, DialogModes.NO );
244
245 // Ajustement hauteur à 64px et exportation gif ==========
246 var id39 = charIDToTypeID( "Expr" );
247 var desc11 = new ActionDescriptor();
248 var id40 = charIDToTypeID( "Usng" );
249 var desc12 = new ActionDescriptor();
250 var id41 = charIDToTypeID( "Op " );
251 var id42 = charIDToTypeID( "SWOp" );
252 var id43 = charIDToTypeID( "OpSa" );
253 desc12.putEnumerated( id41, id42, id43 );
254 var id44 = charIDToTypeID( "Fmt " );
255 var id45 = charIDToTypeID( "IRFm" );
256 var id46 = charIDToTypeID( "GIFf" );
257 desc12.putEnumerated( id44, id45, id46 );
258 var id47 = charIDToTypeID( "Intr" );
259 desc12.putBoolean( id47, false );
260 var id48 = charIDToTypeID( "RedA" );
261 var id49 = charIDToTypeID( "IRRd" );
262 var id50 = charIDToTypeID( "Sltv" );
263 desc12.putEnumerated( id48, id49, id50 );
264 var id51 = charIDToTypeID( "RChT" );
265 desc12.putBoolean( id51, false );
266 var id52 = charIDToTypeID( "RChV" );
267 desc12.putBoolean( id52, false );
268 var id53 = charIDToTypeID( "AuRd" );
269 desc12.putBoolean( id53, false );
270 var id54 = charIDToTypeID( "NCol" );
271 desc12.putInteger( id54, 256 );
272 var id55 = charIDToTypeID( "Dthr" );
273 var id56 = charIDToTypeID( "IRDt" );
274 var id57 = charIDToTypeID( "Dfsn" );
275 desc12.putEnumerated( id55, id56, id57 );
276 var id58 = charIDToTypeID( "DthA" );
277 desc12.putInteger( id58, 100 );
278 var id59 = charIDToTypeID( "DChS" );
279 desc12.putInteger( id59, 0 );
280 var id60 = charIDToTypeID( "DCUI" );
281 desc12.putInteger( id60, 0 );
282 var id61 = charIDToTypeID( "DChT" );
283 desc12.putBoolean( id61, false );
284 var id62 = charIDToTypeID( "DChV" );
285 desc12.putBoolean( id62, false );
286 var id63 = charIDToTypeID( "WebS" );
287 desc12.putInteger( id63, 0 );
288 var id64 = charIDToTypeID( "TDth" );
289 var id65 = charIDToTypeID( "IRDt" );
290 var id66 = charIDToTypeID( "None" );
291 desc12.putEnumerated( id64, id65, id66 );
292 var id67 = charIDToTypeID( "TDtA" );
293 desc12.putInteger( id67, 100 );
294 var id68 = charIDToTypeID( "Loss" );
295 desc12.putInteger( id68, 0 );
296 var id69 = charIDToTypeID( "LChS" );
297 desc12.putInteger( id69, 0 );
298 var id70 = charIDToTypeID( "LCUI" );
299 desc12.putInteger( id70, 100 );
300 var id71 = charIDToTypeID( "LChT" );
301 desc12.putBoolean( id71, false );
302 var id72 = charIDToTypeID( "LChV" );
303 desc12.putBoolean( id72, false );
304 var id73 = charIDToTypeID( "Trns" );
305 desc12.putBoolean( id73, false );
306 var id74 = charIDToTypeID( "Mtt " );
307 desc12.putBoolean( id74, true );
308 var id75 = charIDToTypeID( "MttR" );
309 desc12.putInteger( id75, 255 );
310 var id76 = charIDToTypeID( "MttG" );
311 desc12.putInteger( id76, 255 );
312 var id77 = charIDToTypeID( "MttB" );
313 desc12.putInteger( id77, 255 );
314 var id78 = charIDToTypeID( "HScl" );
315 var id79 = charIDToTypeID( "#Prc" );
316 desc12.putUnitDouble( id78, id79, 25.000000 );
317 var id80 = charIDToTypeID( "VScl" );
318 var id81 = charIDToTypeID( "#Prc" );
319 desc12.putUnitDouble( id80, id81, 24.902724 );
320 var id82 = charIDToTypeID( "SHTM" );
321 desc12.putBoolean( id82, false );
322 var id83 = charIDToTypeID( "SImg" );
323 desc12.putBoolean( id83, true );
324 var id84 = charIDToTypeID( "SSSO" );
325 desc12.putBoolean( id84, false );
326 var id85 = charIDToTypeID( "SSLt" );
327 var list1 = new ActionList();
328 desc12.putList( id85, list1 );
329 var id86 = charIDToTypeID( "DIDr" );
330 desc12.putBoolean( id86, false );
331 var id87 = charIDToTypeID( "In " );
332 desc12.putPath( id87, new File( fsPath ) );
333 var id88 = stringIDToTypeID( "SaveForWeb" );
334 desc11.putObject( id40, id88, desc12 );
335 executeAction( id39, desc11, DialogModes.NO );
336
337 }