Debian Codegraph @

texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty

raw
1 % Author.........: C. Pierquet
2 % licence........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
3
4 \NeedsTeXFormat{LaTeX2e}
5 \ProvidesPackage{PixelArtTikz}[2025/12/07 v0.20a PixelArts with csv and TikZ]
6 % 0.20a Clé [Legende]
7 % 0.1.9 l3 version (simple usage)
8 % 0.1.8 Bugfix
9 % 0.1.7 Correction d'un bug avec les découpages
10 % 0.1.6 Ajout d'un style pour les traits + utilisation de datatool (plus rapide ?)
11 % 0.1.5 Amélioration du code interne + possibilité de créer des grilles avec des symboles choisis dans une liste
12 % 0.1.4 Cylinder anamorphic pixelart
13 % 0.1.3 Split PA into grid
14 % 0.1.2 Mini pixerlart
15 % 0.1.1 Small bugfix with color
16 % 0.1.0 Version initiale
17
18 %------Option(s)
19 \newif\if@csvii \@csviifalse
20 \DeclareOption{csvii}{\@csviitrue}
21 \newif\if@lthree \@lthreefalse
22 \DeclareOption{l3}{\@lthreetrue}
23 \DeclareOption*{}
24 \ProcessOptions\relax
25
26 %------Packages utiles
27 \RequirePackage{tikz}
28 \RequirePackage{simplekv}
29 \RequirePackage{xintexpr}
30 \RequirePackage{xinttools}
31 \RequirePackage{xstring}
32 \RequirePackage{multicol}
33 \RequirePackage{listofitems}
34 \RequirePackage{ifthen}
35 %cvs
36 \if@csvii
37 \RequirePackage[legacy]{csvsimple}
38 \else
39 \RequirePackage{expl3}
40 \RequirePackage[l3]{csvsimple}
41 \fi
42
43 %------Int macro
44 \ExplSyntaxOn
45 \NewDocumentCommand{\intpartnumtoletter}{m}
46 {
47 \int_to_Alph:n { #1 } % Pour majuscules A, B, C...
48 }
49 \ExplSyntaxOff
50
51 %------Styles tikz
52 \tikzset{pixlarttrait/.style={}}
53 \tikzset{pixlarttraitdecoup/.style={thick,purple}}
54 \tikzset{pixlartnoticedecoup/.style={font=\large\sffamily}}
55 \tikzset{pixlartlegende/.style={darkgray,font=\PATtaille\sffamily,inner sep=0pt}}
56
57 \NewDocumentCommand\TraiteListeSymbPixelArt{ m }{%
58 \IfSubStr{#1}{§}%
59 {%
60 \setsepchar{§}%
61 \readlist*\lstPAchoices{#1}%
62 \xdef\lstPAchoicesrand{\fpeval{randint(1,\lstPAchoiceslen)}}%
63 \lstPAchoices[\lstPAchoicesrand]%
64 }%
65 {%c'est normal
66 #1%
67 }%
68 }
69
70 %------clés [fr] / keys [en]
71 \defKV[pixelarttkz]{%
72 Codes=\def\PATlettres{#1},%
73 Couleurs=\def\PATcouleurs{#1},%
74 Symboles=\def\PATchiffres{#1},%
75 Style=\def\PATtaille{#1},%
76 Unite=\def\PATunit{#1},%
77 Decoupage=\def\PATdecoup{#1}
78 }
79
80 \setKVdefault[pixelarttkz]{%
81 Style=\scriptsize,%
82 Correction=false,%
83 Symb=false,%
84 BordCases=true,%
85 Unite=1,%
86 Decoupage={},%
87 Legende=false
88 }
89
90 %----[fr] commands
91 \NewDocumentCommand\PixelArtTikz{ s O{} D<>{} m }{%commande autonome
92 \useKVdefault[pixelarttkz]%
93 \setKV[pixelarttkz]{#2}%
94 %affichage du corrigé / display of correction
95 \IfBooleanTF{#1}{}{\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#3]}
96 \ifboolKV[pixelarttkz]{Correction}%
97 {%
98 \setsepchar{,}%
99 \readlist*\LCPA\PATcouleurs%
100 \csvloop{file=#4,no head,command={%
101 \foreach \l [count=\n] in \csvline {%
102 \StrDel{\l}{ }[\l]%
103 \StrPosition{\PATlettres}{\l}[\pixcnt]%
104 \ifnum\pixcnt>0%
105 \ifboolKV[pixelarttkz]{BordCases}%
106 {\draw[fill={\LCPA[\pixcnt]}] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
107 {\filldraw[{\LCPA[\pixcnt]}] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
108 \fi%
109 }%
110 }%
111 }%
112 }%
113 {%
114 \ifboolKV[pixelarttkz]{Symb}{%affichage du pixelart versions chiffres si besoin
115 \setsepchar{,}%
116 \readlist*\LCNA\PATchiffres%
117 \csvloop{file=#4,no head,command={%
118 \foreach \l [count=\n] in \csvline {%
119 \StrDel{\l}{ }[\l]%
120 \StrPosition{\PATlettres}{\l}[\pixpos]%
121 \xintifboolexpr{\pixpos>0}%
122 {%
123 \itemtomacro\LCNA[\pixpos]\pixchf%
124 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
125 }%
126 {}%
127 }%
128 }%
129 }%
130 }%
131 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
132 \csvloop{file=#4,no head,command={%
133 \foreach \l [count=\n] in \csvline {%
134 \StrDel{\l}{ }[\l]%
135 \IfSubStr{\PATlettres}{\l}%
136 {%
137 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};%
138 }%
139 {}%
140 }%
141 }%
142 }%
143 }%
144 }%
145 %affichage des découpages éventuels
146 \IfStrEq{\PATdecoup}{}%
147 {}%
148 {%
149 \setKV[pixelarttkz]{Legende=false}%
150 \csvreader{#4}{}{}%en test
151 \xdef\NbLigTot{\thecsvinputline}%
152 \xdef\NbColTot{\thecsvcolumncount}%
153 \IfSubStr{\PATdecoup}{x}%
154 {%
155 \StrCut{\PATdecoup}{x}{\NbLigBloc}{\NbColBloc}%tracés des traits
156 \foreach \i in {0,\NbLigBloc,...,\NbLigTot}{\draw[pixlarttraitdecoup] ({0.5-0.33},{-\i-0.5}) -- ({\thecsvcolumncount+0.5+0.33},{-\i-0.5}) ;}%
157 \foreach \j in {0,\NbColBloc,...,\NbColTot}{\draw[pixlarttraitdecoup] ({\j+0.5},{-0.5+0.33}) -- ({\j+0.5},{-\thecsvinputline+0.5-0.33}) ;}%
158 }%
159 {}%
160 \IfSubStr{\PATdecoup}{+}%
161 {%
162 \StrCut{\PATdecoup}{+}{\NbBlocLIG}{\NbBlocCOL}%
163 \def\NbLigBloc{\xintieval{(\NbLigTot-1)/\NbBlocLIG}}%
164 \def\NbColBloc{\xintieval{(\NbColTot)/\NbBlocCOL}}%
165 \foreach \i in {0,\NbLigBloc,...,\NbLigTot}{\draw[pixlarttraitdecoup] ({0.5-0.33},{-\i-0.5}) -- ({\thecsvcolumncount+0.5+0.33},{-\i-0.5}) ;}%
166 \foreach \j in {0,\NbColBloc,...,\NbColTot}{\draw[pixlarttraitdecoup] ({\j+0.5},{-0.5+0.33}) -- ({\j+0.5},{-\thecsvinputline+0.5-0.33}) ;}%
167 }%
168 {}%
169 }%
170 \ifboolKV[pixelarttkz]{Legende}%
171 {%
172 \csvreader{#4}{}{}%get rows and columns
173 %légende haute
174 \foreach \i in {1,...,\thecsvcolumncount}{%
175 \draw (\i,-\thecsvinputline+0.5) node[below=\fpeval{0.133*\PATunit}cm,pixlartlegende] {\i} ;
176 \draw (\i,-0.5) node[above=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\i} ;
177 }%
178 \foreach \j in {1,...,\numexpr\thecsvinputline-1\relax}{%
179 \def\k{\inteval{\thecsvinputline-\j}}%
180 \draw (0.5,-\j) node[left=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
181 \draw (\thecsvcolumncount+0.5,-\j) node[right=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
182 }%
183 }%
184 {}%
185 \IfBooleanTF{#1}{}{\end{tikzpicture}}%
186 }
187
188 \NewDocumentEnvironment{EnvPixelArtTikz}{ O{} D<>{} m }%environnement
189 {%
190 \useKVdefault[pixelarttkz]%
191 \setKV[pixelarttkz]{#1}%
192 %affichage du corrigé / display of correction
193 \begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
194 \ifboolKV[pixelarttkz]{Correction}%
195 {%
196 \setsepchar{,}%
197 \readlist*\LCPA\PATcouleurs%
198 \csvloop{file=#3,no head,command={%
199 \foreach \l [count=\n] in \csvline {%
200 \StrDel{\l}{ }[\l]%
201 \StrPosition{\PATlettres}{\l}[\pixcnt]%
202 \xintifboolexpr{\pixcnt>0}%
203 {%
204 \itemtomacro\LCPA[\pixcnt]\pixcol%
205 \ifboolKV[pixelarttkz]{BordCases}%
206 {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
207 {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
208 }%
209 {}%
210 }%
211 }%
212 }%
213 }%
214 {%
215 \ifboolKV[pixelarttkz]{Symb}{%affichage du pixelart versions chiffres si besoin
216 \setsepchar{,}%
217 \readlist*\LCNA\PATchiffres%
218 \csvloop{file=#3,no head,command={%
219 \foreach \l [count=\n] in \csvline {%
220 \StrDel{\l}{ }[\l]%
221 \StrPosition{\PATlettres}{\l}[\pixpos]%
222 \xintifboolexpr{\pixpos>0}%
223 {%
224 \itemtomacro\LCNA[\pixpos]\pixchf%
225 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
226 }%
227 {}%
228 }%
229 }%
230 }%
231 }%
232 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
233 \csvloop{file=#3,no head,command={%
234 \foreach \l [count=\n] in \csvline {%
235 \StrDel{\l}{ }[\l]%
236 \IfSubStr{\PATlettres}{\l}%
237 {%
238 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};%
239 }%
240 {}%
241 }%
242 }%
243 }%
244 }%
245 }%
246 \ifboolKV[pixelarttkz]{Legende}%
247 {%
248 \csvreader{#3}{}{}%get rows and columns
249 %légende haute
250 \foreach \i in {1,...,\thecsvcolumncount}{%
251 \draw (\i,-\thecsvinputline+0.5) node[below=\fpeval{0.133*\PATunit}cm,pixlartlegende] {\i} ;
252 \draw (\i,-0.5) node[above=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\i} ;
253 }%
254 \foreach \j in {1,...,\numexpr\thecsvinputline-1\relax}{%
255 \def\k{\inteval{\thecsvinputline-\j}}%
256 \draw (0.5,-\j) node[left=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
257 \draw (\thecsvcolumncount+0.5,-\j) node[right=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
258 }%
259 }%
260 {}%
261 }%
262 {%
263 \end{tikzpicture}%
264 }%
265
266 %----[en] commands
267 \defKV[pixelarttkzen]{%
268 Codes=\def\PATlettres{#1},%
269 Colors=\def\PATcouleurs{#1},%
270 Symbols=\def\PATchiffres{#1},%
271 Style=\def\PATtaille{#1},%
272 Unit=\def\PATunit{#1},%
273 Grid=\def\PATdecoup{#1}
274 }
275
276 \setKVdefault[pixelarttkzen]{%
277 Style=\scriptsize,%
278 Correction=false,%
279 Symb=false,%
280 Border=true,%
281 Unit=1,%
282 Grid={},%
283 Legend=false
284 }
285
286 \NewDocumentCommand\PixlArtTikz{ s O{} D<>{} m }{%commande autonome
287 \useKVdefault[pixelarttkzen]%
288 \setKV[pixelarttkzen]{#2}%
289 %affichage du corrigé / display of correction
290 \IfBooleanTF{#1}{}{\begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#3]}
291 \ifboolKV[pixelarttkzen]{Correction}%
292 {%
293 \setsepchar{,}%
294 \readlist*\LCPA\PATcouleurs%
295 \csvloop{file=#4,no head,command={%
296 \foreach \l [count=\n] in \csvline {%
297 \StrDel{\l}{ }[\l]%
298 \StrPosition{\PATlettres}{\l}[\pixcnt]%
299 \xintifboolexpr{\pixcnt>0}%
300 {%
301 \itemtomacro\LCPA[\pixcnt]\pixcol%
302 \ifboolKV[pixelarttkzen]{Border}%
303 {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
304 {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
305 }%
306 {}%
307 }%
308 }%
309 }%
310 }%
311 {%
312 \ifboolKV[pixelarttkzen]{Symb}{%affichage du pixelart versions chiffres si besoin
313 \setsepchar{,}%
314 \readlist*\LCNA\PATchiffres%
315 \csvloop{file=#4,no head,command={%
316 \foreach \l [count=\n] in \csvline {%
317 \StrDel{\l}{ }[\l]%
318 \StrPosition{\PATlettres}{\l}[\pixpos]%
319 \xintifboolexpr{\pixpos>0}%
320 {%
321 \itemtomacro\LCNA[\pixpos]\pixchf%
322 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
323 }%
324 {}%
325 }%
326 }%
327 }%
328 }%
329 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
330 \csvloop{file=#4,no head,command={%
331 \foreach \l [count=\n] in \csvline {%
332 \StrDel{\l}{ }[\l]%
333 \IfSubStr{\PATlettres}{\l}%
334 {%
335 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};%
336 }%
337 {}%
338 }%
339 }%
340 }%
341 }%
342 }%
343 %affichage des découpages éventuels
344 \IfStrEq{\PATdecoup}{}%
345 {}%
346 {%
347 \setKV[pixelarttkzen]{Legend=false}%
348 \csvreader{#4}{}{}%en test
349 \xdef\NbLigTot{\thecsvinputline}%
350 \xdef\NbColTot{\thecsvcolumncount}%
351 \IfSubStr{\PATdecoup}{x}%
352 {%
353 \StrCut{\PATdecoup}{x}{\NbLigBloc}{\NbColBloc}%tracés des traits
354 \foreach \i in {0,\NbLigBloc,...,\NbLigTot}{\draw[thick,purple] ({0.5-0.33},{-\i-0.5}) -- ({\thecsvcolumncount+0.5+0.33},{-\i-0.5}) ;}%
355 \foreach \j in {0,\NbColBloc,...,\NbColTot}{\draw[thick,purple] ({\j+0.5},{-0.5+0.33}) -- ({\j+0.5},{-\thecsvinputline+0.5-0.33}) ;}%
356 }%
357 {}%
358 \IfSubStr{\PATdecoup}{+}%
359 {%
360 \StrCut{\PATdecoup}{+}{\NbBlocLIG}{\NbBlocCOL}%
361 \def\NbLigBloc{\xintieval{(\NbLigTot-1)/\NbBlocLIG}}%
362 \def\NbColBloc{\xintieval{(\NbColTot)/\NbBlocCOL}}%
363 \foreach \i in {0,\NbLigBloc,...,\NbLigTot}{\draw[thick,purple] ({0.5-0.33},{-\i-0.5}) -- ({\thecsvcolumncount+0.5+0.33},{-\i-0.5}) ;}%
364 \foreach \j in {0,\NbColBloc,...,\NbColTot}{\draw[thick,purple] ({\j+0.5},{-0.5+0.33}) -- ({\j+0.5},{-\thecsvinputline+0.5-0.33}) ;}%
365 }%
366 {}%
367 }%
368 \ifboolKV[pixelarttkzen]{Legend}%
369 {%
370 \csvreader{#4}{}{}%get rows and columns
371 %légende haute
372 \foreach \i in {1,...,\thecsvcolumncount}{%
373 \draw (\i,-\thecsvinputline+0.5) node[below=\fpeval{0.133*\PATunit}cm,pixlartlegende] {\i} ;
374 \draw (\i,-0.5) node[above=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\i} ;
375 }%
376 \foreach \j in {1,...,\numexpr\thecsvinputline-1\relax}{%
377 \def\k{\inteval{\thecsvinputline-\j}}%
378 \draw (0.5,-\j) node[left=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
379 \draw (\thecsvcolumncount+0.5,-\j) node[right=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
380 }%
381 }%
382 {}%
383 \IfBooleanTF{#1}{}{\end{tikzpicture}}%
384 }
385
386 \NewDocumentEnvironment{EnvPixlArtTikz}{ O{} D<>{} m }%environnement
387 {%
388 \useKVdefault[pixelarttkzen]%
389 \setKV[pixelarttkzen]{#1}%
390 %affichage du corrigé / display of correction
391 \begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
392 \ifboolKV[pixelarttkzen]{Correction}%
393 {%
394 \setsepchar{,}%
395 \readlist*\LCPA\PATcouleurs%
396 \csvloop{file=#3,no head,command={%
397 \foreach \l [count=\n] in \csvline {%
398 \StrDel{\l}{ }[\l]%
399 \StrPosition{\PATlettres}{\l}[\pixcnt]%
400 \xintifboolexpr{\pixcnt>0}%
401 {%
402 \itemtomacro\LCPA[\pixcnt]\pixcol%
403 \ifboolKV[pixelarttkzen]{Border}%
404 {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
405 {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
406 }%
407 {}%
408 }%
409 }%
410 }%
411 }%
412 {%
413 \ifboolKV[pixelarttkzen]{Symb}{%affichage du pixelart versions chiffres si besoin
414 \setsepchar{,}%
415 \readlist*\LCNA\PATchiffres%
416 \csvloop{file=#3,no head,command={%
417 \foreach \l [count=\n] in \csvline {%
418 \StrDel{\l}{ }[\l]%
419 \StrPosition{\PATlettres}{\l}[\pixpos]%
420 \xintifboolexpr{\pixpos>0}%
421 {%
422 \itemtomacro\LCNA[\pixpos]\pixchf%
423 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
424 }%
425 {}%
426 }%
427 }%
428 }%
429 }%
430 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
431 \csvloop{file=#3,no head,command={%
432 \foreach \l [count=\n] in \csvline {%
433 \StrDel{\l}{ }[\l]%
434 \IfSubStr{\PATlettres}{\l}%
435 {%
436 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};%
437 }%
438 {}%
439 }%
440 }%
441 }%
442 }%
443 }%
444 \ifboolKV[pixelarttkzen]{Legend}%
445 {%
446 \csvreader{#3}{}{}%get rows and columns
447 %légende haute
448 \foreach \i in {1,...,\thecsvcolumncount}{%
449 \draw (\i,-\thecsvinputline+0.5) node[below=\fpeval{0.133*\PATunit}cm,pixlartlegende] {\i} ;
450 \draw (\i,-0.5) node[above=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\i} ;
451 }%
452 \foreach \j in {1,...,\numexpr\thecsvinputline-1\relax}{%
453 \def\k{\inteval{\thecsvinputline-\j}}%
454 \draw (0.5,-\j) node[left=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
455 \draw (\thecsvcolumncount+0.5,-\j) node[right=\fpeval{0.1*\PATunit}cm,pixlartlegende] {\intpartnumtoletter{\k}} ;
456 }%
457 }%
458 {}%
459 }%
460 {%
461 \end{tikzpicture}%
462 }%
463
464 %----mini pixelart
465 \newlength{\minipaunit}
466 \defKV[miniPA]{Unite=\setlength{\minipaunit}{#1}}
467 \setKVdefault[miniPA]{Bord=false,Unite=0.25em}
468
469 \NewDocumentCommand\DessineCarrePA{ m m m }{%1=nblig,%2=nbcol,%3=color
470 \xdef\tmpcol{teal}%
471 \IfStrEq{#3}{R}{\xdef\tmpcol{red}}{}%
472 \IfStrEq{#3}{V}{\xdef\tmpcol{green}}{}%
473 \IfStrEq{#3}{B}{\xdef\tmpcol{blue}}{}%
474 \IfStrEq{#3}{J}{\xdef\tmpcol{yellow}}{}%
475 \IfStrEq{#3}{N}{\xdef\tmpcol{black}}{}%
476 \IfStrEq{#3}{G}{\xdef\tmpcol{gray}}{}%
477 \IfStrEq{#3}{.}{\xdef\tmpcol{white}}{}%
478 \IfStrEq{#3}{M}{\xdef\tmpcol{brown}}{}%
479 \IfStrEq{#3}{O}{\xdef\tmpcol{orange}}{}%
480 \IfStrEq{#3}{P}{\xdef\tmpcol{violet}}{}%
481 \ifboolKV[miniPA]{Bord}%
482 {\draw[line width=0.075\minipaunit,draw=black,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}%
483 {\draw[line width=0.075\minipaunit,draw=\tmpcol,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}%
484 }
485
486 \NewDocumentCommand\MiniPixelArt{ O{} m D<>{} }{%
487 \restoreKV[miniPA]%
488 \setKV[miniPA]{#1}%
489 \setsepchar{,}%
490 \readlist*\tmpdata{#2}%
491 \xdef\tmpnblgn{\tmpdatalen}%
492 \itemtomacro\tmpdata[1]\tmpdatacola%
493 \StrLen{\tmpdatacola}[\tmpnbcol]%
494 \begin{tikzpicture}[x=\minipaunit,y=\minipaunit,#3]
495 \foreach \i in {1,...,\tmpnblgn}{%
496 \itemtomacro\tmpdata[\i]\tmplgn%
497 \foreach \j in {1,...,\tmpnbcol}{%
498 \StrChar{\tmplgn}{\j}[\tmpchar]%
499 \DessineCarrePA{\j}{\i}{\tmpchar}%
500 }%
501 }%
502 \end{tikzpicture}%
503 }
504
505 \defKV[miniPAen]{Unit=\setlength{\minipaunit}{#1}}
506 \setKVdefault[miniPAen]{Border=false,Unit=0.25em}
507
508 \NewDocumentCommand\DrawSquarePA{ m m m }{%1=nblig,%2=nbcol,%3=color
509 \xdef\tmpcol{teal}%
510 \IfStrEq{#3}{R}{\xdef\tmpcol{red}}{}%
511 \IfStrEq{#3}{G}{\xdef\tmpcol{green}}{}%
512 \IfStrEq{#3}{C}{\xdef\tmpcol{blue}}{}%
513 \IfStrEq{#3}{Y}{\xdef\tmpcol{yellow}}{}%
514 \IfStrEq{#3}{B}{\xdef\tmpcol{black}}{}%
515 \IfStrEq{#3}{L}{\xdef\tmpcol{gray}}{}%
516 \IfStrEq{#3}{.}{\xdef\tmpcol{white}}{}%
517 \IfStrEq{#3}{M}{\xdef\tmpcol{brown}}{}%
518 \IfStrEq{#3}{O}{\xdef\tmpcol{orange}}{}%
519 \IfStrEq{#3}{P}{\xdef\tmpcol{violet}}{}%
520 \ifboolKV[miniPAen]{Border}%
521 {\draw[line width=0.075\minipaunit,draw=black,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}%
522 {\draw[line width=0.075\minipaunit,draw=\tmpcol,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}%
523 }
524
525 \NewDocumentCommand\MiniPixlArt{ O{} m D<>{} }{%
526 \restoreKV[miniPAen]%
527 \setKV[miniPAen]{#1}%
528 \setsepchar{,}%
529 \readlist*\tmpdata{#2}%
530 \xdef\tmpnblgn{\tmpdatalen}%
531 \itemtomacro\tmpdata[1]\tmpdatacola%
532 \StrLen{\tmpdatacola}[\tmpnbcol]%
533 \begin{tikzpicture}[x=\minipaunit,y=\minipaunit,#3]
534 \foreach \i in {1,...,\tmpnblgn}{%
535 \itemtomacro\tmpdata[\i]\tmplgn%
536 \foreach \j in {1,...,\tmpnbcol}{%
537 \StrChar{\tmplgn}{\j}[\tmpchar]%
538 \DrawSquarePA{\j}{\i}{\tmpchar}%
539 }%
540 }%
541 \end{tikzpicture}%
542 }
543
544 %----découpage [fr]
545 \NewDocumentCommand\PixelArtTikzBloc{ O{} D<>{} m m m }{%commande individuelle
546 %3=fichier
547 %4=taille blocs (LxC) ou nombre de blocs (L+C)
548 %5=numbloc
549 %dernier argument := bloc
550 \useKVdefault[pixelarttkz]%
551 \setKV[pixelarttkz]{#1}%
552 \csvreader{#3}{}{}%en test
553 \xdef\NbLigTot{\thecsvinputline}%
554 \xdef\NbColTot{\thecsvcolumncount}%
555 \IfSubStr{#4}{x}%
556 {%
557 \StrCut{#4}{x}{\NbLigBloc}{\NbColBloc}%
558 }%
559 {}%
560 \IfSubStr{#4}{+}%
561 {%
562 \StrCut{#4}{+}{\NbBlocLIG}{\NbBlocCOL}%
563 \xdef\NbLigBloc{\xinteval{(\NbLigTot-1)/\NbBlocLIG}}%
564 \xdef\NbColBloc{\xinteval{(\NbColTot)/\NbBlocCOL}}%
565 }%
566 {}%
567 \StrCut{#5}{/}{\NumBlocLig}{\NumBlocCol}%
568 \xdef\PAfirstline{\xinteval{\NbLigBloc*(\NumBlocLig-1)+1}}%
569 \xdef\PAlastline{\xinteval{\NbLigBloc*(\NumBlocLig-1)+\NbLigBloc}}%
570 \xdef\PAblocmin{\xinteval{(\NbColBloc*(\NumBlocCol-1)+1)}}%
571 \xdef\PAblocmax{\xinteval{(\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}}%
572 %affichage du corrigé / display of correction
573 \begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
574 \ifboolKV[pixelarttkz]{Correction}%
575 {%
576 \setsepchar{,}%
577 \readlist*\LCPA\PATcouleurs%
578 \csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
579 \foreach \l [count=\n] in \csvline {%
580 \xintifboolexpr{ \n >= \PAblocmin 'and' \n <= \PAblocmax}%
581 {%
582 \StrDel{\l}{ }[\l]%
583 \setsepchar{,}%
584 %\readlist*\LCPA\PATcouleurs%
585 \StrPosition{\PATlettres}{\l}[\pixcnt]%
586 \xintifboolexpr{\pixcnt>0}%
587 {%
588 \itemtomacro\LCPA[\pixcnt]\pixcol%
589 \ifboolKV[pixelarttkz]{BordCases}%
590 {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
591 {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
592 }%
593 {}%
594 }%
595 {}%
596 }%
597 }%
598 }%
599 }%
600 {%
601 \ifboolKV[pixelarttkz]{Symb}{%affichage du pixelart versions chiffres si besoin
602 \setsepchar{,}%
603 \readlist*\LCNA\PATchiffres%
604 \csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
605 \foreach \l [count=\n] in \csvline {%
606 \xintifboolexpr{ \n >= \PAblocmin 'and' \n <= \PAblocmax}%
607 {%
608 \StrDel{\l}{ }[\l]%
609 \setsepchar{,}%
610 %\readlist*\LCNA\PATchiffres%
611 \StrPosition{\PATlettres}{\l}[\pixpos]%
612 \xintifboolexpr{\pixpos>0}%
613 {%
614 \itemtomacro\LCNA[\pixpos]\pixchf%
615 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
616 }%
617 {}%
618 }%
619 {}%
620 }%
621 }%
622 }%
623 }%
624 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
625 \csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
626 \foreach \l [count=\n] in \csvline {%
627 \xintifboolexpr{ \n >= \PAblocmin 'and' \n <= \PAblocmax}%
628 {%
629 \StrDel{\l}{ }[\l]%
630 \IfSubStr{\PATlettres}{\l}%
631 {%
632 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};%
633 }%
634 {}%
635 }%
636 {}%
637 }%
638 }%
639 }%
640 }%
641 }%
642 \end{tikzpicture}%
643 }
644
645 \def\PAalphabet{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
646
647 \NewDocumentCommand\DecoupPixelArtTikz{ s O{} D<>{} m m }{%commande de découpage global
648 %(*)=lettre pour les lignes
649 %1=clés globales
650 %2=options tikz
651 %3=fichier
652 %4=taille blocs LxC ou L+C
653 \csvreader{#4}{}{}%en test
654 \IfSubStr{#5}{x}%
655 {%
656 \StrCut{#5}{x}{\NbLigBloc}{\NbColBloc}%
657 \xdef\NbTotLig{\xintieval{(\thecsvinputline-1)/\NbLigBloc}}%
658 \xdef\NbTotCol{\xintieval{(\thecsvcolumncount)/\NbColBloc}}%
659 }%
660 {}%
661 \IfSubStr{#5}{+}%
662 {%
663 \StrCut{#5}{+}{\NbTotLig}{\NbTotCol}%
664 }%
665 {}%
666 \xintFor* ##1 in {\xintSeq{1}{\NbTotLig}}\do{%
667 \begin{tabular}{*{\NbTotCol}{c}}
668 \xintFor* ##2 in {\xintSeq{1}{\NbTotCol-1}}\do{%
669 Grille \IfBooleanTF{#1}{##1.}{\StrChar{\PAalphabet}{##1}}##2 &
670 }
671 Grille \IfBooleanTF{#1}{##1.}{\StrChar{\PAalphabet}{##1}}\NbTotCol \\
672 \xintFor* ##2 in {\xintSeq{1}{\NbTotCol-1}}\do{%
673 \PixelArtTikzBloc[#2]<#3>{#4}{#5}{##1/##2}&
674 }
675 \PixelArtTikzBloc[#2]<#3>{#4}{#5}{##1/\NbTotCol}\\
676 \end{tabular}\xintifboolexpr{##1 == \NbTotLig}{}{\\}
677 }%
678 }
679
680 \NewDocumentCommand\AideGrillePixelArtTikz{ s O{1} m m }{%création de la grille d'aide
681 \csvreader{#3}{}{}%en test
682 \IfSubStr{#4}{x}%
683 {%
684 \StrCut{#4}{x}{\NbLigBloc}{\NbColBloc}%
685 \xdef\NbTotLig{\xintieval{(\thecsvinputline-1)/\NbLigBloc}}%
686 \xdef\NbTotCol{\xintieval{(\thecsvcolumncount)/\NbColBloc}}%
687 }%
688 {}%
689 \IfSubStr{#4}{+}%
690 {%
691 \StrCut{#4}{+}{\NbTotLig}{\NbTotCol}%
692 }%
693 {}%
694 \xdef\EchelleGrilleAide{\xintfloateval{(\NbTotCol)/(\NbTotLig)}}%
695 \begin{tikzpicture}[scale=#2,transform shape]
696 \xintFor* ##1 in {\xintSeq{1}{\NbTotLig}}\do{%
697 \xintFor* ##2 in {\xintSeq{1}{\NbTotCol}}\do{%
698 \draw[semithick] (##2,{-##1*(\EchelleGrilleAide)}) rectangle++(1,{-1*(\EchelleGrilleAide)}) node[midway,pixlartnoticedecoup] {\IfBooleanTF{#1}{##1.}{\StrChar{\PAalphabet}{##1}}##2} ;
699 }%
700 }%
701 \end{tikzpicture}%
702 }
703
704 %----découpage [en]
705 \NewDocumentCommand\PixlArtTikzBlock{ O{} D<>{} m m m }{%commande individuelle
706 %3=fichier
707 %4=taille blocs (LxC) ou nombre de blocs (L+C)
708 %5=numbloc
709 %dernier argument := bloc
710 \useKVdefault[pixelarttkzen]%
711 \setKV[pixelarttkzen]{#1}%
712 \csvreader{#3}{}{}%en test
713 \xdef\NbLigTot{\thecsvinputline}%
714 \xdef\NbColTot{\thecsvcolumncount}%
715 \IfSubStr{#4}{x}%
716 {%
717 \StrCut{#4}{x}{\NbLigBloc}{\NbColBloc}%
718 }%
719 {}%
720 \IfSubStr{#4}{+}%
721 {%
722 \StrCut{#4}{+}{\NbBlocLIG}{\NbBlocCOL}%
723 \xdef\NbLigBloc{\xinteval{(\NbLigTot-1)/\NbBlocLIG}}%
724 \xdef\NbColBloc{\xinteval{(\NbColTot)/\NbBlocCOL}}%
725 }%
726 {}%
727 \StrCut{#5}{/}{\NumBlocLig}{\NumBlocCol}%
728 \xdef\PAfirstline{\xinteval{\NbLigBloc*(\NumBlocLig-1)+1}}%
729 \xdef\PAlastline{\xinteval{\NbLigBloc*(\NumBlocLig-1)+\NbLigBloc}}%
730 \xdef\PAblocmin{\xinteval{(\NbColBloc*(\NumBlocCol-1)+1)}}%
731 \xdef\PAblocmax{\xinteval{(\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}}%
732 %affichage du corrigé / display of correction
733 \begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
734 \ifboolKV[pixelarttkzen]{Correction}%
735 {%
736 \setsepchar{,}%
737 \readlist*\LCPA\PATcouleurs%
738 \csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
739 \foreach \l [count=\n] in \csvline {%
740 \xintifboolexpr{ \n >= \PAblocmin 'and' \n <= \PAblocmax}%
741 {%
742 \StrDel{\l}{ }[\l]%
743 \setsepchar{,}%
744 %\readlist*\LCPA\PATcouleurs%
745 \StrPosition{\PATlettres}{\l}[\pixcnt]%
746 \xintifboolexpr{\pixcnt>0}%
747 {%
748 \itemtomacro\LCPA[\pixcnt]\pixcol%
749 \ifboolKV[pixelarttkzen]{Border}%
750 {\draw[fill=\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
751 {\filldraw[\pixcol] ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) ;}%
752 }%
753 {}%
754 }%
755 {}%
756 }%
757 }%
758 }%
759 }%
760 {%
761 \ifboolKV[pixelarttkzen]{Symb}{%affichage du pixelart versions chiffres si besoin
762 \setsepchar{,}%
763 \readlist*\LCNA\PATchiffres%
764 \csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
765 \foreach \l [count=\n] in \csvline {%
766 \xintifboolexpr{ \n >= \PAblocmin 'and' \n <= \PAblocmax}%
767 {%
768 \StrDel{\l}{ }[\l]%
769 \setsepchar{,}%
770 %\readlist*\LCNA\PATchiffres%
771 \StrPosition{\PATlettres}{\l}[\pixpos]%
772 \xintifboolexpr{\pixpos>0}%
773 {%
774 \itemtomacro\LCNA[\pixpos]\pixchf%
775 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
776 }%
777 {}%
778 }%
779 {}%
780 }%
781 }%
782 }%
783 }%
784 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
785 \csvloop{file=#3,range=\PAfirstline-\PAlastline,no head,command={%
786 \foreach \l [count=\n] in \csvline {%
787 \xintifboolexpr{ \n >= \PAblocmin 'and' \n <= \PAblocmax}%
788 {%
789 \StrDel{\l}{ }[\l]%
790 \IfSubStr{\PATlettres}{\l}%
791 {%
792 \draw ({\n-0.5},{-\thecsvrow+0.5}) rectangle ({\n+0.5},{-\thecsvrow-0.5}) node[inner sep=0,midway,font=\PATtaille] {\l};%
793 }%
794 {}%
795 }%
796 {}%
797 }%
798 }%
799 }%
800 }%
801 }%
802 \end{tikzpicture}%
803 }
804
805 \NewDocumentCommand\CutPixlArtTikz{ s O{} D<>{} m m }{%commande de découpage global
806 %(*)=lettre pour les lignes
807 %1=clés globales
808 %2=options tikz
809 %3=fichier
810 %4=taille blocs LxC ou L+C
811 \csvreader{#4}{}{}%en test
812 \IfSubStr{#5}{x}%
813 {%
814 \StrCut{#5}{x}{\NbLigBloc}{\NbColBloc}%
815 \xdef\NbTotLig{\xintieval{(\thecsvinputline-1)/\NbLigBloc}}%
816 \xdef\NbTotCol{\xintieval{(\thecsvcolumncount)/\NbColBloc}}%
817 }%
818 {}%
819 \IfSubStr{#5}{+}%
820 {%
821 \StrCut{#5}{+}{\NbTotLig}{\NbTotCol}%
822 }%
823 {}%
824 \xintFor* ##1 in {\xintSeq{1}{\NbTotLig}}\do{%
825 \begin{tabular}{*{\NbTotCol}{c}}
826 \xintFor* ##2 in {\xintSeq{1}{\NbTotCol-1}}\do{%
827 Sample \IfBooleanTF{#1}{##1.}{\StrChar{\PAalphabet}{##1}}##2 &
828 }
829 Sample \IfBooleanTF{#1}{##1.}{\StrChar{\PAalphabet}{##1}}\NbTotCol \\
830 \xintFor* ##2 in {\xintSeq{1}{\NbTotCol-1}}\do{%
831 \PixlArtTikzBlock[#2]<#3>{#4}{#5}{##1/##2}&
832 }
833 \PixlArtTikzBlock[#2]<#3>{#4}{#5}{##1/\NbTotCol}\\
834 \end{tabular}\xintifboolexpr{##1 == \NbTotLig}{}{\\}
835 }%
836 }
837
838 \NewDocumentCommand\HelpGridPixelArtTikz{ s O{1} m m }{%création de la grille d'aide
839 \csvreader{#3}{}{}%en test
840 \IfSubStr{#4}{x}%
841 {%
842 \StrCut{#4}{x}{\NbLigBloc}{\NbColBloc}%
843 \xdef\NbTotLig{\xintieval{(\thecsvinputline-1)/\NbLigBloc}}%
844 \xdef\NbTotCol{\xintieval{(\thecsvcolumncount)/\NbColBloc}}%
845 }%
846 {}%
847 \IfSubStr{#4}{+}%
848 {%
849 \StrCut{#4}{+}{\NbTotLig}{\NbTotCol}%
850 }%
851 {}%
852 \begin{tikzpicture}[scale=#2,transform shape]
853 \xintFor* ##1 in {\xintSeq{1}{\NbTotLig}}\do{%
854 \xintFor* ##2 in {\xintSeq{1}{\NbTotCol}}\do{
855 \draw[semithick] (##2,{-##1*(\NbTotCol)/(\NbTotLig)}) rectangle++(1,{-1*(\NbTotCol)/(\NbTotLig)}) node[midway] {\IfBooleanTF{#1}{##1.}{\StrChar{\PAalphabet}{##1}}##2} ;
856 }%
857 }%
858 \end{tikzpicture}%
859 }
860
861 %====TABLEAU AUTOMATIQUE DES COULEURS (expérimental)
862 \RequirePackage{tabularray}
863
864 \defKV[TableCouleursPA]{%
865 Police=\def\PAtablfonte{#1},%
866 Largeur=\def\PAtabllarg{#1}
867 }
868 \setKVdefault[TableCouleursPA]{%
869 Police={\normalsize\normalfont},%
870 Largeur=auto
871 }
872
873 \NewDocumentCommand\TablCouleursPixelArt{ s O{} D<>{} m }{%
874 \restoreKV[TableCouleursPA]%
875 \setKV[TableCouleursPA]{#2}%
876 \def\runlistcolors{#4}%
877 \setsepchar{,}%
878 \readlist*\ListeCoulCases{#4}%
879 \def\PAtablenotice{}%
880 \IfBooleanTF{#1}%
881 {%
882 \foreach \AAAA/\BBBB/\CCCC/\DDDD [count=\i] in \runlistcolors{%
883 \xdef\PAtablenotice{\PAtablenotice \SetCell{bg=\BBBB,fg=\CCCC}\AAAA & \DDDD \\}
884 }%
885 \IfStrEq{\PAtabllarg}{auto}%
886 {%
887 \begin{tblr}[expand=\PAtablenotice]{hlines,vlines,colspec={*{2}{Q[m,c]}},cells={font=\PAtablfonte},#3}
888 \PAtablenotice
889 \end{tblr}%
890 }%
891 {%
892 \IfSubStr{\PAtabllarg}{/}%
893 {%
894 \StrCut{\PAtabllarg}{/}{\tmpLargColA}{\tmpLargColB}%
895 \IfStrEq{\tmpLargColA}{}%
896 {%
897 \IfStrEq{\tmpLargColB}{}%
898 {%
899 \begin{tblr}[expand=\PAtablenotice]{hlines,vlines,colspec={Q[m,c]Q[m,c]},cells={font=\PAtablfonte},#3}
900 \PAtablenotice
901 \end{tblr}%
902 }%
903 {%
904 \begin{tblr}[expand=\PAtablenotice]{hlines,vlines,colspec={Q[m,c]Q[m,c,\tmpLargColB]},cells={font=\PAtablfonte},#3}
905 \PAtablenotice
906 \end{tblr}%
907 }%
908 }%
909 {%
910 \IfStrEq{\tmpLargColB}{}%
911 {%
912 \begin{tblr}[expand=\PAtablenotice]{hlines,vlines,colspec={Q[m,c,\tmpLargColA]Q[m,c]},cells={font=\PAtablfonte},#3}
913 \PAtablenotice
914 \end{tblr}%
915 }%
916 {%
917 \begin{tblr}[expand=\PAtablenotice]{hlines,vlines,colspec={Q[m,c,\tmpLargColA]Q[m,c,\tmpLargColB]},cells={font=\PAtablfonte},#3}
918 \PAtablenotice
919 \end{tblr}%
920 }%
921 }%
922 }%
923 {%
924 \begin{tblr}[expand=\PAtablenotice]{width=\PAtabllarg,hlines,vlines,colspec={*{2}{X[m,c]}},cells={font=\PAtablfonte},#3}
925 \PAtablenotice
926 \end{tblr}%
927 }%
928 }%
929 }%
930 {%
931 \foreach \AAAA/\BBBB/\CCCC/\DDDD [count=\i] in \runlistcolors{%
932 \xdef\PAtablenotice{\PAtablenotice \SetCell{bg=\BBBB,fg=\CCCC}\AAAA \xintifboolexpr{\i == \ListeCoulCaseslen}{\\}{&}}
933 }%
934 \foreach \AAAA/\BBBB/\CCCC/\DDDD [count=\i] in \runlistcolors{%
935 \xdef\PAtablenotice{\PAtablenotice {\DDDD} \xintifboolexpr{\i == \ListeCoulCaseslen}{\\}{&}}
936 }%
937 \IfStrEq{\PAtabllarg}{auto}%
938 {%
939 \begin{tblr}[expand=\PAtablenotice]{hlines,vlines,colspec={*{\ListeCoulCaseslen}{Q[m,c]}},cells={font=\PAtablfonte},#3}
940 \PAtablenotice
941 \end{tblr}%
942 }%
943 {%
944 \begin{tblr}[expand=\PAtablenotice]{width=\PAtabllarg,hlines,vlines,colspec={*{\ListeCoulCaseslen}{X[m,c]}},cells={font=\PAtablfonte},#3}
945 \PAtablenotice
946 \end{tblr}%
947 }%
948 }%
949 }
950
951 %====COMMANDE SIMPLIFIÉE tabularray
952 \NewExpandableDocumentCommand\cctblr{ O{black} m m }{%
953 %1=couleur police
954 %2=couleur case
955 %3=case
956 \SetCell{bg=#2,fg=#1}#3
957 }
958
959 %====ANAMORPHIC CYLINDER PixelArt [fr]
960 \defKV[PixelArtCylinder]{
961 Largeur=\def\AAanamcyllarg{#1},%
962 Centre=\def\AAanamcylcenter{#1},%
963 Codes=\def\PATAAlettres{#1},%
964 Couleurs=\def\PATAAcouleurs{#1},%
965 Symboles=\def\PATAAchiffres{#1},%
966 Style=\def\PATAAtaille{#1}
967 }
968 \setKVdefault[PixelArtCylinder]{
969 Largeur=6,%
970 Centre=1.25,%
971 Symb=false,%
972 Correction=false,%
973 Style=\normalsize,%
974 Solution=false,%
975 Swap=false,%
976 Legende=false
977 }
978 \NewDocumentCommand\PixelArtTikzCylindre{ O{} m }{%
979 \restoreKV[PixelArtCylinder]%
980 \setKV[PixelArtCylinder]{#1}%
981 \csvreader{#2}{}{}%en test
982 \xdef\NbLigTot{\thecsvinputline}%
983 \xdef\NbColTot{\thecsvcolumncount}%
984 \xdef\CylindAng{\xintfloateval{round(180/\NbColTot,4)}}%\CylindNbsections~%
985 \xdef\CylindSect{\xintfloateval{round((\AAanamcyllarg-\AAanamcylcenter)/(\NbLigTot-1),4)}}%\CylindNbhauteurs%
986 \ifboolKV[PixelArtCylinder]{Solution}%
987 {%
988 \ifboolKV[PixelArtCylinder]{Swap}%
989 {\PixelArtTikz[#1,Correction,Unite=\CylindSect]{#2}}%
990 {\PixelArtTikz[#1,Correction,Unite=\CylindSect]<yscale=-1>{#2}}%
991 }%
992 {%
993 \begin{tikzpicture}[line join=round]
994 \csvloop{file=#2,no head,command={%
995 \foreach \l [count=\nnnn] in \csvline {%
996 \StrDel{\l}{ }[\l]%
997 \StrPosition{\PATAAlettres}{\l}[\pixcnt]%
998 \xintifboolexpr{\pixcnt>0}%
999 {%
1000 \ifboolKV[PixelArtCylinder]{Correction}%
1001 {%
1002 \setsepchar{,}%
1003 \readlist*\LCPA\PATAAcouleurs%
1004 \itemtomacro\LCPA[\pixcnt]\pixcol%
1005 \ifboolKV[PixelArtCylinder]{Swap}%
1006 {%
1007 \draw[fill=\pixcol] ({(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-1)*\CylindSect}) arc({(\nnnn-1)*\CylindAng}:{(\nnnn)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-1)*\CylindSect})--++ ({(\nnnn)*\CylindAng}:{\CylindSect}) arc({(\nnnn)*\CylindAng}:{(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow)*\CylindSect}) ;%
1008 }%
1009 {%
1010 \draw[fill=\pixcol] ({(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-\thecsvrow*\CylindSect}) arc({(\nnnn-1)*\CylindAng}:{(\nnnn)*\CylindAng}:{-\AAanamcylcenter-\thecsvrow*\CylindSect})--++ ({(\nnnn)*\CylindAng}:{\CylindSect}) arc({(\nnnn)*\CylindAng}:{(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-1)*\CylindSect}) ;%
1011 }%
1012 }%
1013 {%
1014 \ifboolKV[PixelArtCylinder]{Symb}%
1015 {%
1016 \setsepchar{,}%
1017 \readlist*\LCNA\PATAAchiffres%
1018 \StrPosition{\PATAAlettres}{\l}[\pixpos]%
1019 \itemtomacro\LCNA[\pixpos]\pixchf%
1020 \ifboolKV[PixelArtCylinder]{Swap}%
1021 {%
1022 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
1023 }%
1024 {%
1025 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
1026 }%
1027 }%
1028 {%
1029 \ifboolKV[PixelArtCylinder]{Swap}%
1030 {%
1031 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
1032 }%
1033 {%
1034 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
1035 }%
1036 }%
1037 }%
1038 }%
1039 {}%
1040 }%
1041 }%
1042 }%
1043 %création de la grille en surimpression
1044 \draw ({-\AAanamcyllarg},0)--({\AAanamcyllarg},0) arc (0:-180:\AAanamcyllarg) ;
1045 \foreach \agl in {0,-\CylindAng,...,-180}{\draw (\agl:\AAanamcylcenter)--(\agl:\AAanamcyllarg) ;}
1046 \foreach \sector in {0,\CylindSect,...,\xintfloateval{\AAanamcyllarg-\AAanamcylcenter}}{%
1047 \draw ({\AAanamcylcenter+\sector},0) arc (0:-180:{\AAanamcylcenter+\sector}) ;
1048 }%
1049 %légende ?
1050 \ifboolKV[PixelArtCylinder]{Legende}%
1051 {%
1052 \foreach \i in {1,...,\thecsvcolumncount}{%les numéros
1053 \draw ({0.5*\CylindAng+(\i-1)*\CylindAng}:{-\AAanamcylcenter-(\NbLigTot-0.66)*\CylindSect}) node[rotate={90+0.5*\CylindAng+(\i-1)*\CylindAng},pixlartlegende] {\i};%
1054 \draw ({0.5*\CylindAng+(\i-1)*\CylindAng}:{-\AAanamcylcenter+0.25*\CylindSect}) node[rotate={90+0.5*\CylindAng+(\i-1)*\CylindAng},pixlartlegende] {\i};%
1055 }%
1056 \foreach \j in {1,...,\numexpr\thecsvinputline-1\relax}{%les numéros
1057 %\def\k{\inteval{\thecsvinputline-\j}}%
1058 \draw ({\AAanamcylcenter+(\j-0.5)*\CylindSect},0.25) node[rotate=180,pixlartlegende] {\intpartnumtoletter{\j}};%
1059 \draw ({-\AAanamcylcenter-(\j-0.5)*\CylindSect},0.25) node[rotate=180,pixlartlegende] {\intpartnumtoletter{\j}};%
1060 }%
1061 }%
1062 {}%
1063 \end{tikzpicture}%
1064 }%
1065 }
1066
1067 %====ANAMORPHIC CYLINDER PixelArt [en]
1068 \defKV[PixlArtCylinder]{
1069 Width=\def\AAanamcyllarg{#1},%
1070 Center=\def\AAanamcylcenter{#1},%
1071 Codes=\def\PATAAlettres{#1},%
1072 Colors=\def\PATAAcouleurs{#1},%
1073 Symbols=\def\PATAAchiffres{#1},%
1074 Style=\def\PATAAtaille{#1}
1075 }
1076 \setKVdefault[PixlArtCylinder]{
1077 Width=6,%
1078 Center=1.25,%
1079 Symb=false,%
1080 Correction=false,%
1081 Style=\normalsize,%
1082 Solution=false,%
1083 Swap=false,%
1084 Legend=false
1085 }
1086 \NewDocumentCommand\PixlArtTikzCylindric{ O{} m }{%
1087 \restoreKV[PixlArtCylinder]%
1088 \setKV[PixlArtCylinder]{#1}%
1089 \csvreader{#2}{}{}%en test
1090 \xdef\NbLigTot{\thecsvinputline}%
1091 \xdef\NbColTot{\thecsvcolumncount}%
1092 \xdef\CylindAng{\xintfloateval{round(180/\NbColTot,4)}}%\CylindNbsections~%
1093 \xdef\CylindSect{\xintfloateval{round((\AAanamcyllarg-\AAanamcylcenter)/(\NbLigTot-1),4)}}%\CylindNbhauteurs%
1094 \ifboolKV[PixlArtCylinder]{Solution}%
1095 {%
1096 \ifboolKV[PixlArtCylinder]{Swap}%
1097 {\PixlArtTikz[#1,Correction,Unit=\CylindSect]{#2}}%
1098 {\PixlArtTikz[#1,Correction,Unit=\CylindSect]<yscale=-1>{#2}}%
1099 }%
1100 {%
1101 \begin{tikzpicture}[line join=round]
1102 \csvloop{file=#2,no head,command={%
1103 \foreach \l [count=\nnnn] in \csvline {%
1104 \StrDel{\l}{ }[\l]%
1105 \StrPosition{\PATAAlettres}{\l}[\pixcnt]%
1106 \xintifboolexpr{\pixcnt>0}%
1107 {%
1108 \ifboolKV[PixlArtCylinder]{Correction}%
1109 {%
1110 \setsepchar{,}%
1111 \readlist*\LCPA\PATAAcouleurs%
1112 \itemtomacro\LCPA[\pixcnt]\pixcol%
1113 \ifboolKV[PixlArtCylinder]{Swap}%
1114 {%
1115 \draw[fill=\pixcol] ({(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-1)*\CylindSect}) arc({(\nnnn-1)*\CylindAng}:{(\nnnn)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-1)*\CylindSect})--++ ({(\nnnn)*\CylindAng}:{\CylindSect}) arc({(\nnnn)*\CylindAng}:{(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow)*\CylindSect}) ;%
1116 }%
1117 {%
1118 \draw[fill=\pixcol] ({(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-\thecsvrow*\CylindSect}) arc({(\nnnn-1)*\CylindAng}:{(\nnnn)*\CylindAng}:{-\AAanamcylcenter-\thecsvrow*\CylindSect})--++ ({(\nnnn)*\CylindAng}:{\CylindSect}) arc({(\nnnn)*\CylindAng}:{(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-1)*\CylindSect}) ;%
1119 }%
1120 }%
1121 {%
1122 \ifboolKV[PixlArtCylinder]{Symb}%
1123 {%
1124 \setsepchar{,}%
1125 \readlist*\LCNA\PATAAchiffres%
1126 \StrPosition{\PATAAlettres}{\l}[\pixpos]%
1127 \itemtomacro\LCNA[\pixpos]\pixchf%
1128 \ifboolKV[PixlArtCylinder]{Swap}%
1129 {%
1130 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
1131 }%
1132 {%
1133 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
1134 }%
1135 }%
1136 {%
1137 \ifboolKV[PixlArtCylinder]{Swap}%
1138 {%
1139 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
1140 }%
1141 {%
1142 \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
1143 }%
1144 }%
1145 }%
1146 }%
1147 {}%
1148 }%
1149 }%
1150 }%
1151 %création de la grille en surimpression
1152 \draw ({-\AAanamcyllarg},0)--({\AAanamcyllarg},0) arc (0:-180:\AAanamcyllarg) ;
1153 \foreach \agl in {0,-\CylindAng,...,-180}{\draw (\agl:\AAanamcylcenter)--(\agl:\AAanamcyllarg) ;}
1154 \foreach \sector in {0,\CylindSect,...,\xintfloateval{\AAanamcyllarg-\AAanamcylcenter}}{%
1155 \draw ({\AAanamcylcenter+\sector},0) arc (0:-180:{\AAanamcylcenter+\sector}) ;
1156 }%
1157 %legende ?
1158 \ifboolKV[PixlArtCylinder]{Legend}%
1159 {%
1160 \foreach \i in {1,...,\thecsvcolumncount}{%les numéros
1161 \draw ({0.5*\CylindAng+(\i-1)*\CylindAng}:{-\AAanamcylcenter-(\NbLigTot-0.66)*\CylindSect}) node[rotate={90+0.5*\CylindAng+(\i-1)*\CylindAng},pixlartlegende] {\i};%
1162 \draw ({0.5*\CylindAng+(\i-1)*\CylindAng}:{-\AAanamcylcenter+0.25*\CylindSect}) node[rotate={90+0.5*\CylindAng+(\i-1)*\CylindAng},pixlartlegende] {\i};%
1163 }%
1164 \foreach \j in {1,...,\numexpr\thecsvinputline-1\relax}{%les numéros
1165 %\def\k{\inteval{\thecsvinputline-\j}}%
1166 \draw ({\AAanamcylcenter+(\j-0.5)*\CylindSect},0.25) node[rotate=180,pixlartlegende] {\intpartnumtoletter{\j}};%
1167 \draw ({-\AAanamcylcenter-(\j-0.5)*\CylindSect},0.25) node[rotate=180,pixlartlegende] {\intpartnumtoletter{\j}};%
1168 }%
1169 }%
1170 {}%
1171 \end{tikzpicture}%
1172 }%
1173 }
1174
1175 %-----With datatool, faster ?
1176 \RequirePackage{datatool}
1177
1178 \NewDocumentCommand\readdtcsv{ m m }{%
1179 \DTLsetseparator{|}%
1180 \DTLloaddb[noheader,keys={cvsline}]{#2}{#1}%
1181 }
1182
1183 \NewDocumentCommand\dtpixlarttikz{ O{} D<>{} m }{%commande autonome
1184 \useKVdefault[pixelarttkz]%
1185 \setKV[pixelarttkz]{#1}%
1186 %affichage du corrigé / display of correction
1187 \begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
1188 \ifboolKV[pixelarttkz]{Correction}%
1189 {%
1190 \setsepchar{,}%
1191 \readlist*\LCPA\PATcouleurs%
1192 \DTLforeach*{#3}{\csvline=cvsline}{%
1193 \setsepchar{,}%
1194 \readlist*\tmpcsvline\csvline%
1195 \foreachitem\PAchar\in\tmpcsvline{%
1196 \StrPosition{\PATlettres}{\PAchar}[\pixcnt]%
1197 \ifnum\pixcnt>0%
1198 \ifboolKV[pixelarttkz]{BordCases}%
1199 {\draw[fill={\LCPA[\pixcnt]}] ({\PAcharcnt-0.5},{-\theDTLrowi+0.5}) rectangle++(1,-1) ;}%
1200 {\filldraw[{\LCPA[\pixcnt]}] ({\PAcharcnt-0.5},{-\theDTLrowi+0.5}) rectangle++(1,-1) ;}%
1201 \fi%
1202 }
1203 % \foreach \l [count=\n] in \csvline {%old vesion, with foreach ?
1204 % \StrPosition{\PATlettres}{\l}[\pixcnt]%
1205 % \ifnum\pixcnt>0%
1206 % \ifboolKV[pixelarttkz]{BordCases}%
1207 % {\draw[fill={\LCPA[\pixcnt]}] ({\n-0.5},{-\theDTLrowi+0.5}) rectangle ({\n+0.5},{-\theDTLrowi-0.5}) ;}%
1208 % {\filldraw[{\LCPA[\pixcnt]}] ({\n-0.5},{-\theDTLrowi+0.5}) rectangle ({\n+0.5},{-\theDTLrowi-0.5}) ;}%
1209 % \fi%
1210 % }%
1211 }%
1212 }%
1213 {%
1214 \ifboolKV[pixelarttkz]{Symb}%
1215 {%affichage du pixelart versions chiffres si besoin
1216 \setsepchar{,}%
1217 \readlist*\LCNA\PATchiffres%
1218 \DTLforeach*{#3}{\csvline=cvsline}{%
1219 \setsepchar{,}%
1220 \readlist*\tmpcsvline\csvline%
1221 \foreachitem\PAchar\in\tmpcsvline{%
1222 \StrPosition{\PATlettres}{\PAchar}[\pixpos]%
1223 \xintifboolexpr{\pixpos>0}%
1224 {%
1225 \itemtomacro\LCNA[\pixpos]\pixchf%
1226 \draw ({\PAcharcnt-0.5},{-\theDTLrowi+0.5}) rectangle++(1,-1) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
1227 }%
1228 {}%
1229 }
1230 }%
1231 }%
1232 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
1233 \DTLforeach*{#3}{\csvline=cvsline}{%
1234 \setsepchar{,}%
1235 \readlist*\tmpcsvline\csvline%
1236 \foreachitem\PAchar\in\tmpcsvline{%
1237 \IfSubStr{\PATlettres}{\PAchar}%
1238 {%
1239 \draw ({\PAcharcnt-0.5},{-\theDTLrowi+0.5}) rectangle++(1,-1) node[inner sep=0,midway,font=\PATtaille] {\PAchar};%
1240 }%
1241 {}%
1242 }%
1243 }%
1244 }%
1245 }%
1246 %affichage des découpages éventuels
1247 \IfStrEq{\PATdecoup}{}%
1248 {}%
1249 {%
1250 \xdef\NbLigTot{\DTLrowcount{#3}}%
1251 \DTLgetvalue{\myvalrowone}{#3}{1}{1}%
1252 \StrCount{\myvalrowone}{,}[\NbColTot]%
1253 \xdef\NbColTot{\inteval{\NbColTot+1}}%
1254 \IfSubStr{\PATdecoup}{x}%
1255 {%
1256 \StrCut{\PATdecoup}{x}{\NbLigBloc}{\NbColBloc}%tracés des traits
1257 \foreach \i in {0,\NbLigBloc,...,\NbLigTot}{\draw[pixlarttraitdecoup] ({0.5-0.33},{-\i-0.5}) -- ({\NbColTot+0.5+0.33},{-\i-0.5}) ;}%
1258 \foreach \j in {0,\NbColBloc,...,\NbColTot}{\draw[pixlarttraitdecoup] ({\j+0.5},{-0.5+0.33}) -- ({\j+0.5},{-\NbLigTot-0.5-0.33}) ;}%
1259 }%
1260 {}%
1261 \IfSubStr{\PATdecoup}{+}%
1262 {%
1263 \StrCut{\PATdecoup}{+}{\NbBlocLIG}{\NbBlocCOL}%
1264 \def\NbLigBloc{\xintieval{(\NbLigTot-1)/\NbBlocLIG}}%
1265 \def\NbColBloc{\xintieval{(\NbColTot)/\NbBlocCOL}}%
1266 \foreach \i in {0,\NbLigBloc,...,\NbLigTot}{\draw[pixlarttraitdecoup] ({0.5-0.33},{-\i-0.5}) -- ({\NbColTot+0.5+0.33},{-\i-0.5}) ;}%
1267 \foreach \j in {0,\NbColBloc,...,\NbColTot}{\draw[pixlarttraitdecoup] ({\j+0.5},{-0.5+0.33}) -- ({\j+0.5},{-\NbLigTot-0.5-0.33}) ;}%
1268 }%
1269 {}%
1270 }%
1271 \end{tikzpicture}%
1272 }
1273
1274 \NewDocumentCommand\dtpixlarttikzblock{ O{} D<>{} m m m }{%commande individuelle avec loi & datatool...
1275 %3=fichier
1276 %4=taille blocs (LxC) ou nombre de blocs (L+C)
1277 %5=numbloc
1278 \useKVdefault[pixelarttkz]%
1279 \setKV[pixelarttkz]{#1}%
1280 \xdef\NbLigTot{\DTLrowcount{#3}}%
1281 \DTLgetvalue{\myvalrowone}{#3}{1}{1}%
1282 \StrCount{\myvalrowone}{,}[\NbColTot]%
1283 \xdef\NbColTot{\inteval{\NbColTot+1}}%
1284 \IfSubStr{#4}{x}%
1285 {%
1286 \StrCut{#4}{x}{\NbLigBloc}{\NbColBloc}%
1287 }%
1288 {}%
1289 \IfSubStr{#4}{+}%
1290 {%
1291 \StrCut{#4}{+}{\NbBlocLIG}{\NbBlocCOL}%
1292 \xdef\NbLigBloc{\xinteval{(\NbLigTot-1)/\NbBlocLIG}}%
1293 \xdef\NbColBloc{\xinteval{(\NbColTot)/\NbBlocCOL}}%
1294 }%
1295 {}%
1296 \StrCut{#5}{/}{\NumBlocLig}{\NumBlocCol}%
1297 \xdef\PAfirstline{\xinteval{\NbLigBloc*(\NumBlocLig-1)+1}}%
1298 \xdef\PAlastline{\xinteval{\NbLigBloc*(\NumBlocLig-1)+\NbLigBloc}}%
1299 \xdef\PAblocmin{\xinteval{(\NbColBloc*(\NumBlocCol-1)+1)}}%
1300 \xdef\PAblocmax{\xinteval{(\NbColBloc*(\NumBlocCol-1)+\NbColBloc)}}%
1301 %affichage du corrigé / display of correction
1302 \begin{tikzpicture}[x=\PATunit cm,y=\PATunit cm,#2]
1303 \ifboolKV[pixelarttkz]{Correction}%
1304 {%
1305 \setsepchar{,}%
1306 \readlist*\LCPA\PATcouleurs%
1307 \foreach \line in {\PAfirstline,...,\PAlastline}{%
1308 \DTLgetvalue{\csvline}{#3}{\line}{1}%
1309 \setsepchar{,}%
1310 \readlist*\tmpcsvline\csvline%
1311 \foreachitem\PAchar\in\tmpcsvline{%
1312 \xintifboolexpr{ \PAcharcnt >= \PAblocmin 'and' \PAcharcnt <= \PAblocmax}%
1313 {%
1314 \StrPosition{\PATlettres}{\PAchar}[\pixcnt]%
1315 \xintifboolexpr{\pixcnt>0}%
1316 {%
1317 \itemtomacro\LCPA[\pixcnt]\pixcol%
1318 \ifboolKV[pixelarttkz]{BordCases}%
1319 {\draw[fill=\pixcol] ({\PAcharcnt-0.5},{-\line+0.5}) rectangle++(1,-1) ;}%
1320 {\filldraw[\pixcol] ({\PAcharcnt-0.5},{-\line+0.5}) rectangle++(1,-1) ;}%
1321 }%
1322 {}%
1323 }%
1324 {}%
1325 }%
1326 }%
1327 }%
1328 {%
1329 \ifboolKV[pixelarttkz]{Symb}%
1330 {%affichage du pixelart versions chiffres si besoin
1331 \setsepchar{,}%
1332 \readlist*\LCNA\PATchiffres%
1333 \foreach \line in {\PAfirstline,...,\PAlastline}{%
1334 \DTLgetvalue{\csvline}{#3}{\line}{1}%
1335 \setsepchar{,}%
1336 \readlist*\tmpcsvline\csvline%
1337 \foreachitem\PAchar\in\tmpcsvline{%
1338 \xintifboolexpr{ \PAcharcnt >= \PAblocmin 'and' \PAcharcnt <= \PAblocmax}%
1339 {%
1340 \StrPosition{\PATlettres}{\PAchar}[\pixpos]%
1341 \xintifboolexpr{\pixpos>0}%
1342 {%
1343 \itemtomacro\LCNA[\pixpos]\pixchf%
1344 \draw ({\PAcharcnt-0.5},{-\line+0.5}) rectangle++(1,-1) node[inner sep=0,midway,font=\PATtaille] {\TraiteListeSymbPixelArt{\pixchf}} ;%
1345 }%
1346 {}%
1347 }%
1348 {}%
1349 }%
1350 }%
1351 }%
1352 {%affichage du pixelart versions lettres ou chiffres simples (<=9) / display of letters/symbols PixelArt
1353 \foreach \line in {\PAfirstline,...,\PAlastline}{%
1354 \DTLgetvalue{\csvline}{#3}{\line}{1}%
1355 \setsepchar{,}%
1356 \readlist*\tmpcsvline\csvline%
1357 \foreachitem\PAchar\in\tmpcsvline{%
1358 \xintifboolexpr{ \PAcharcnt >= \PAblocmin 'and' \PAcharcnt <= \PAblocmax}%
1359 {%
1360 \IfSubStr{\PATlettres}{\PAchar}%
1361 {%
1362 \draw ({\PAcharcnt-0.5},{-\line+0.5}) rectangle++(1,-1) node[inner sep=0,midway,font=\PATtaille] {\PAchar};%
1363 }%
1364 {}%
1365 }%
1366 {}%
1367 }%
1368 }%
1369 }%
1370 }%
1371 \end{tikzpicture}%
1372 }
1373
1374 %====l3 version, if needed
1375 \if@lthree
1376 \RequirePackage{pixelarttikz-l3}
1377 \fi
1378
1379 \endinput