summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty')
-rw-r--r--Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty190
1 files changed, 188 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty b/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
index 882b1ecffa1..711b0e919ae 100644
--- a/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
+++ b/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty
@@ -2,7 +2,8 @@
% licence........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{PixelArtTikz}[2024/04/11 v0.1.3 PixelArts with csv and TikZ]
+\ProvidesPackage{PixelArtTikz}[2024/04/16 v0.1.4 PixelArts with csv and TikZ]
+% 0.1.4 Cylinder anamorphic pixelart
% 0.1.3 Split PA into grid
% 0.1.2 Mini pixerlart
% 0.1.1 Small bugfix with color
@@ -16,7 +17,6 @@
%------Packages utiles
\RequirePackage{tikz}
-\RequirePackage{xparse}
\RequirePackage{simplekv}
\RequirePackage{xintexpr}
\RequirePackage{xinttools}
@@ -847,5 +847,191 @@
\SetCell{bg=#2,fg=#1}#3
}
+%====ANAMORPHIC CYLINDER PixelArt [fr]
+\defKV[PixelArtCylinder]{
+ Largeur=\def\AAanamcyllarg{#1},%
+ Centre=\def\AAanamcylcenter{#1},%
+ Codes=\def\PATAAlettres{#1},%
+ Couleurs=\def\PATAAcouleurs{#1},%
+ Symboles=\def\PATAAchiffres{#1},%
+ Style=\def\PATAAtaille{#1}
+}
+\setKVdefault[PixelArtCylinder]{
+ Largeur=6,%
+ Centre=1.25,%
+ Symb=false,%
+ Correction=false,%
+ Style=\normalsize,%
+ Solution=false,%
+ Swap=false
+}
+\NewDocumentCommand\PixelArtTikzCylindre{ O{} m }{%
+ \restoreKV[PixelArtCylinder]%
+ \setKV[PixelArtCylinder]{#1}%
+ \csvreader{#2}{}{}%en test
+ \xdef\NbLigTot{\thecsvinputline}%
+ \xdef\NbColTot{\thecsvcolumncount}%
+ \xdef\CylindAng{\xintfloateval{round(180/\NbColTot,4)}}%\CylindNbsections~%
+ \xdef\CylindSect{\xintfloateval{round((\AAanamcyllarg-\AAanamcylcenter)/(\NbLigTot-1),4)}}%\CylindNbhauteurs%
+ \ifboolKV[PixelArtCylinder]{Solution}%
+ {%
+ \ifboolKV[PixelArtCylinder]{Swap}%
+ {\PixelArtTikz[#1,Correction,Unite=\CylindSect]{#2}}%
+ {\PixelArtTikz[#1,Correction,Unite=\CylindSect]<yscale=-1>{#2}}%
+ }%
+ {%
+ \begin{tikzpicture}[line join=round]
+ \csvloop{file=#2,no head,command={%
+ \foreach \l [count=\nnnn] in \csvline {%
+ \StrDel{\l}{ }[\l]%
+ \StrPosition{\PATAAlettres}{\l}[\pixcnt]%
+ \xintifboolexpr{\pixcnt>0}%
+ {%
+ \ifboolKV[PixelArtCylinder]{Correction}%
+ {%
+ \setsepchar{,}%
+ \readlist*\LCPA\PATAAcouleurs%
+ \itemtomacro\LCPA[\pixcnt]\pixcol%
+ \ifboolKV[PixelArtCylinder]{Swap}%
+ {%
+ \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}) ;%
+ }%
+ {%
+ \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}) ;%
+ }%
+ }%
+ {%
+ \ifboolKV[PixelArtCylinder]{Symb}%
+ {%
+ \setsepchar{,}%
+ \readlist*\LCNA\PATAAchiffres%
+ \StrPosition{\PATAAlettres}{\l}[\pixpos]%
+ \itemtomacro\LCNA[\pixpos]\pixchf%
+ \ifboolKV[PixelArtCylinder]{Swap}%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ }%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ }%
+ }%
+ {%
+ \ifboolKV[PixelArtCylinder]{Swap}%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
+ }%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
+ }%
+ }%
+ }%
+ }%
+ {}%
+ }%
+ }%
+ }%
+ %création de la grille en surimpression
+ \draw ({-\AAanamcyllarg},0)--({\AAanamcyllarg},0) arc (0:-180:\AAanamcyllarg) ;
+ \foreach \agl in {0,-\CylindAng,...,-180}{\draw (\agl:\AAanamcylcenter)--(\agl:\AAanamcyllarg) ;}
+ \foreach \sector in {0,\CylindSect,...,\xintfloateval{\AAanamcyllarg-\AAanamcylcenter}}{%
+ \draw ({\AAanamcylcenter+\sector},0) arc (0:-180:{\AAanamcylcenter+\sector}) ;
+ }%
+ \end{tikzpicture}%
+ }%
+}
+
+%====ANAMORPHIC CYLINDER PixelArt [en]
+\defKV[PixlArtCylinder]{
+ Width=\def\AAanamcyllarg{#1},%
+ Center=\def\AAanamcylcenter{#1},%
+ Codes=\def\PATAAlettres{#1},%
+ Colors=\def\PATAAcouleurs{#1},%
+ Symbols=\def\PATAAchiffres{#1},%
+ Style=\def\PATAAtaille{#1}
+}
+\setKVdefault[PixlArtCylinder]{
+ Width=6,%
+ Center=1.25,%
+ Symb=false,%
+ Correction=false,%
+ Style=\normalsize,%
+ Solution=false,%
+ Swap=false
+}
+\NewDocumentCommand\PixlArtTikzCylindric{ O{} m }{%
+ \restoreKV[PixlArtCylinder]%
+ \setKV[PixlArtCylinder]{#1}%
+ \csvreader{#2}{}{}%en test
+ \xdef\NbLigTot{\thecsvinputline}%
+ \xdef\NbColTot{\thecsvcolumncount}%
+ \xdef\CylindAng{\xintfloateval{round(180/\NbColTot,4)}}%\CylindNbsections~%
+ \xdef\CylindSect{\xintfloateval{round((\AAanamcyllarg-\AAanamcylcenter)/(\NbLigTot-1),4)}}%\CylindNbhauteurs%
+ \ifboolKV[PixlArtCylinder]{Solution}%
+ {%
+ \ifboolKV[PixlArtCylinder]{Swap}%
+ {\PixlArtTikz[#1,Correction,Unit=\CylindSect]{#2}}%
+ {\PixlArtTikz[#1,Correction,Unit=\CylindSect]<yscale=-1>{#2}}%
+ }%
+ {%
+ \begin{tikzpicture}[line join=round]
+ \csvloop{file=#2,no head,command={%
+ \foreach \l [count=\nnnn] in \csvline {%
+ \StrDel{\l}{ }[\l]%
+ \StrPosition{\PATAAlettres}{\l}[\pixcnt]%
+ \xintifboolexpr{\pixcnt>0}%
+ {%
+ \ifboolKV[PixlArtCylinder]{Correction}%
+ {%
+ \setsepchar{,}%
+ \readlist*\LCPA\PATAAcouleurs%
+ \itemtomacro\LCPA[\pixcnt]\pixcol%
+ \ifboolKV[PixlArtCylinder]{Swap}%
+ {%
+ \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}) ;%
+ }%
+ {%
+ \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}) ;%
+ }%
+ }%
+ {%
+ \ifboolKV[PixlArtCylinder]{Symb}%
+ {%
+ \setsepchar{,}%
+ \readlist*\LCNA\PATAAchiffres%
+ \StrPosition{\PATAAlettres}{\l}[\pixpos]%
+ \itemtomacro\LCNA[\pixpos]\pixchf%
+ \ifboolKV[PixlArtCylinder]{Swap}%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ }%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\pixchf};%
+ }%
+ }%
+ {%
+ \ifboolKV[PixlArtCylinder]{Swap}%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcyllarg+(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
+ }%
+ {%
+ \draw ({0.5*\CylindAng+(\nnnn-1)*\CylindAng}:{-\AAanamcylcenter-(\thecsvrow-0.5)*\CylindSect}) node[rotate={-90+0.5*\CylindAng+(\nnnn-1)*\CylindAng},font=\PATAAtaille] {\l};%
+ }%
+ }%
+ }%
+ }%
+ {}%
+ }%
+ }%
+ }%
+ %création de la grille en surimpression
+ \draw ({-\AAanamcyllarg},0)--({\AAanamcyllarg},0) arc (0:-180:\AAanamcyllarg) ;
+ \foreach \agl in {0,-\CylindAng,...,-180}{\draw (\agl:\AAanamcylcenter)--(\agl:\AAanamcyllarg) ;}
+ \foreach \sector in {0,\CylindSect,...,\xintfloateval{\AAanamcyllarg-\AAanamcylcenter}}{%
+ \draw ({\AAanamcylcenter+\sector},0) arc (0:-180:{\AAanamcylcenter+\sector}) ;
+ }%
+ \end{tikzpicture}%
+ }%
+}
+
\endinput \ No newline at end of file