diff options
author | Karl Berry <karl@freefriends.org> | 2023-10-12 20:26:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-10-12 20:26:03 +0000 |
commit | d534eb4ed11898bfab600b750cea1981577863d8 (patch) | |
tree | b8971c2020cc23fa34820ca69f8c24272b4f211e /Master/texmf-dist/tex/latex/pixelarttikz | |
parent | 0cdedcb767ac4e40d1a3339198bebf747b7841b8 (diff) |
pixelarttikz (12oct23)
git-svn-id: svn://tug.org/texlive/trunk@68520 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pixelarttikz')
-rw-r--r-- | Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty b/Master/texmf-dist/tex/latex/pixelarttikz/PixelArtTikz.sty index e56b33d479b..e05a66fb5ab 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}[2023/09/04 v0.1.1 PixelArts with csv and TikZ] +\ProvidesPackage{PixelArtTikz}[2023/10/12 v0.1.2 PixelArts with csv and TikZ] +% 0.1.2 Mini pixerlart % 0.1.1 Small bugfix with color % 0.1.0 Version initiale @@ -311,4 +312,85 @@ \end{tikzpicture}% }% +%----mini pixelart +\newlength{\minipaunit} +\defKV[miniPA]{Unite=\setlength{\minipaunit}{#1}} +\setKVdefault[miniPA]{Bord=false,Unite=0.25em} + +\NewDocumentCommand\DessineCarrePA{ m m m }{%1=nblig,%2=nbcol,%3=color + \xdef\tmpcol{teal}% + \IfStrEq{#3}{R}{\xdef\tmpcol{red}}{}% + \IfStrEq{#3}{V}{\xdef\tmpcol{green}}{}% + \IfStrEq{#3}{B}{\xdef\tmpcol{blue}}{}% + \IfStrEq{#3}{J}{\xdef\tmpcol{yellow}}{}% + \IfStrEq{#3}{N}{\xdef\tmpcol{black}}{}% + \IfStrEq{#3}{G}{\xdef\tmpcol{gray}}{}% + \IfStrEq{#3}{.}{\xdef\tmpcol{white}}{}% + \IfStrEq{#3}{M}{\xdef\tmpcol{brown}}{}% + \IfStrEq{#3}{O}{\xdef\tmpcol{orange}}{}% + \IfStrEq{#3}{P}{\xdef\tmpcol{violet}}{}% + \ifboolKV[miniPA]{Bord}% + {\draw[line width=0.075\minipaunit,draw=black,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}% + {\draw[line width=0.075\minipaunit,draw=\tmpcol,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}% +} + +\NewDocumentCommand\MiniPixelArt{ O{} m D<>{} }{% + \restoreKV[miniPA]% + \setKV[miniPA]{#1}% + \setsepchar{,}% + \readlist*\tmpdata{#2}% + \xdef\tmpnblgn{\tmpdatalen}% + \itemtomacro\tmpdata[1]\tmpdatacola% + \StrLen{\tmpdatacola}[\tmpnbcol]% + \begin{tikzpicture}[x=\minipaunit,y=\minipaunit,#3] + \foreach \i in {1,...,\tmpnblgn}{% + \itemtomacro\tmpdata[\i]\tmplgn% + \foreach \j in {1,...,\tmpnbcol}{% + \StrChar{\tmplgn}{\j}[\tmpchar]% + \DessineCarrePA{\j}{\i}{\tmpchar}% + }% + }% + \end{tikzpicture}% +} + +\defKV[miniPAen]{Unit=\setlength{\minipaunit}{#1}} +\setKVdefault[miniPAen]{Border=false,Unit=0.25em} + +\NewDocumentCommand\DrawSquarePA{ m m m }{%1=nblig,%2=nbcol,%3=color + \xdef\tmpcol{teal}% + \IfStrEq{#3}{R}{\xdef\tmpcol{red}}{}% + \IfStrEq{#3}{G}{\xdef\tmpcol{green}}{}% + \IfStrEq{#3}{C}{\xdef\tmpcol{blue}}{}% + \IfStrEq{#3}{Y}{\xdef\tmpcol{yellow}}{}% + \IfStrEq{#3}{B}{\xdef\tmpcol{black}}{}% + \IfStrEq{#3}{L}{\xdef\tmpcol{gray}}{}% + \IfStrEq{#3}{.}{\xdef\tmpcol{white}}{}% + \IfStrEq{#3}{M}{\xdef\tmpcol{brown}}{}% + \IfStrEq{#3}{O}{\xdef\tmpcol{orange}}{}% + \IfStrEq{#3}{P}{\xdef\tmpcol{violet}}{}% + \ifboolKV[miniPAen]{Border}% + {\draw[line width=0.075\minipaunit,draw=black,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}% + {\draw[line width=0.075\minipaunit,draw=\tmpcol,fill=\tmpcol] ({\j},{-\i}) rectangle++ (1,-1) ;}% +} + +\NewDocumentCommand\MiniPixlArt{ O{} m D<>{} }{% + \restoreKV[miniPAen]% + \setKV[miniPAen]{#1}% + \setsepchar{,}% + \readlist*\tmpdata{#2}% + \xdef\tmpnblgn{\tmpdatalen}% + \itemtomacro\tmpdata[1]\tmpdatacola% + \StrLen{\tmpdatacola}[\tmpnbcol]% + \begin{tikzpicture}[x=\minipaunit,y=\minipaunit,#3] + \foreach \i in {1,...,\tmpnblgn}{% + \itemtomacro\tmpdata[\i]\tmplgn% + \foreach \j in {1,...,\tmpnbcol}{% + \StrChar{\tmplgn}{\j}[\tmpchar]% + \DrawSquarePA{\j}{\i}{\tmpchar}% + }% + }% + \end{tikzpicture}% +} + + \endinput
\ No newline at end of file |