%% %% This is file `pxpic.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% pxpic.dtx (with options: `pkg') %% %% -------------------------------------------------------------- %% pxpic -- draw pixel pictures %% E-mail: jspratte@yahoo.de %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% %% Copyright (C) 2021-2023 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or %% (at your option) any later version. The latest version of this license is in %% the file: %% %% http://www.latex-project.org/lppl.txt %% %% This work is "maintained" (as per LPPL maintenance status) by %% Jonathan P. Spratte. %% %% This work consists of the file pxpic.dtx %% and the derived files pxpic.pdf %% pxpic.sty %% \ProvidesPackage{pxpic}[2023-08-16 v1.5 draw pixel pictures] \RequirePackage{xcolor} \RequirePackage{expkv} \@ifdefinable\pxpicHT{\newdimen\pxpicHT} \@ifdefinable\pxpicWD{\newdimen\pxpicWD} \pxpicHT=\p@ \pxpicWD=\pxpicHT \@ifdefinable\pxpic@kern{\newdimen\pxpic@kern} \pxpic@kern=\z@ \def\pxpic@@kern#1{\kern#1\pxpic@kern} \@ifdefinable\pxpic@inner@box{\let\pxpic@inner@box\vbox} \@ifdefinable\pxpic@after@inner@box{\let\pxpic@after@inner@box\@empty} \protected\ekvdef{pxpic}{size} {\pxpicHT=\dimexpr#1\relax\pxpicWD=\pxpicHT} \protected\ekvdef{pxpic}{ht}{\pxpicHT=\dimexpr#1\relax} \protected\ekvdef{pxpic}{wd}{\pxpicWD=\dimexpr#1\relax} \protected\ekvdef{pxpic}{gap-hack}{\pxpic@kern=\dimexpr#1\relax} \protected\ekvdef{pxpic}{skip}{\ekvdefNoVal{pxpic@px}{#1}{\pxskip}} \protected\ekvdef{pxpic}{colors}{\ekvparse\pxpic@err@noval\pxpic@setcolor{#1}} \ekvletkv{pxpic}{colours}{pxpic}{colors} \protected\ekvdef{pxpic}{mode} {% \@ifundefined{pxpic@parse@px@#1}% {\pxpic@err@unknown@mode{#1}}% {% \expandafter\let\expandafter\pxpic@parse@px \csname pxpic@parse@px@#1\endcsname }% } \protected\ekvdef{pxpic}{color-list} {% \@ifundefined{pxpic@colorlist@#1}% {\pxpic@err@unknown@colorlist{#1}}% {\csname pxpic@colorlist@#1\endcsname}% } \ekvletkv{pxpic}{colour-list}{pxpic}{color-list} \protected\ekvdefNoVal{pxpic}{b} {% \let\pxpic@inner@box\vbox \let\pxpic@after@inner@box\@empty } \protected\ekvdefNoVal{pxpic}{c} {% \def\pxpic@inner@box{\setbox0=\vbox}% \def\pxpic@after@inner@box{\lower.5\ht0\box0}% } \protected\ekvdefNoVal{pxpic}{t} {% \let\pxpic@inner@box\vtop \let\pxpic@after@inner@box\@empty } \ekvdef{pxpic}{expansion} {% \@ifundefined{pxpic@expansion@#1}% {\pxpic@err@unknown@expansion{#1}}% {\csname pxpic@expansion@#1\endcsname}% } \ekvdefNoVal{pxpic}{expansion}{\pxpic@expansion@full} \ekvletkv {pxpic}{exp}{pxpic}{expansion} \ekvletkvNoVal{pxpic}{exp}{pxpic}{expansion} \protected\def\pxpic@expansion@none{\let\pxpic@expansion\@firstofone} \protected\def\pxpic@expansion@full{\let\pxpic@expansion\expanded} \pxpic@expansion@none \ekvdef{pxpic}{lines} {% \@ifundefined{pxpic@@parse@#1}% {\pxpic@err@unknown@lines{#1}}% {\csname pxpic@@parse@#1\endcsname}% } \ekvdef{pxpic}{file} {% \@ifundefined{pxpic@file@#1}% {\pxpic@err@unknown@file{#1}}% {\csname pxpic@file@#1\endcsname}% } \ekvdefNoVal{pxpic}{file}{\pxpic@file@true} \ExplSyntaxOn \protected\def\pxpic@file@true { \def\pxpic@@file@or@list ##1 { \file_get:nnNTF ##1 {} \l_tmpa_tl { \ekv@exparg { \expandafter\pxpic@parse\pxpic@expansion } { \expandafter { \l_tmpa_tl } } } { \pxpic@err@file@not@found ##1 } } } \ExplSyntaxOff \protected\def\pxpic@file@false {\def\pxpic@@file@or@list{\expandafter\pxpic@parse\pxpic@expansion}} \pxpic@file@false \@ifdefinable\pxpic{\protected\def\pxpic{\hbox\bgroup\pxpic@}} \newcommand\pxpic@[2][] {% \pxpicsetup{#1}% \pxpic@inner@box {% \let\px\pxpic@px \let\pxskip\pxpic@skip \ifdim\pxpic@kern=\z@ \let\pxpic@@kern\@gobble \else \advance\pxpicHT\pxpic@kern \advance\pxpicWD\pxpic@kern \fi \baselineskip=\pxpicHT \kern\pxpic@kern \pxpic@@file@or@list{{#2}}% }% \pxpic@after@inner@box \egroup } \ekvsetdef\pxpicsetup{pxpic} \ekvcompile\pxpiclogo@settings#1{pxpic} { size=#1,gap-hack=\z@,b,mode=px,colours={o=[HTML]{9F393D},g=black!75},skip=. ,lines=group } \newcommand*\pxpiclogo[1][.13ex] {% \begingroup \leavevmode \pxpiclogo@settings{#1}% \lower3.2\pxpicHT\pxpic { {............................................g} {...........................................gggg} {.oooo.......................gggg...........ggg} {.ooooo...oo......oo...oo....ggggg...gg......g..........g} {.ooooooooooo...ooooo..oooo..ggggggggggg...ggggg...ggggggg} {..ooooo..oooo.ooooooooooo....ggggg..gggg.ggggggg.ggggggggg} {...oooo..oooo....ooooo........gggg..gggg...gggg..gggg.ggg} {...oooo..oooo.....oooo........gggg..gggg...gggg..gggg} {.oooooo..oooo.....ooooo.....gggggg..gggg...gggg..gggg} {oooooooooooo...ooooooooo...gggggggggggg....gggg..ggggggggg} {o.oooooooo....ooooo.oooooo.g.gggggggg......ggggg..ggggggg} {...ooo.o......o.oo...oo.......ggg.g.........gg......ggg} {...ooo........................ggg} {...ooo........................ggg} {....o..........................g} }% \endgroup } \newcommand\pxpicforget[1] {\expandafter\let\csname\ekv@name{pxpic@px}{#1}N\endcsname\pxpic@undef} \protected\long\def\pxpicnewmode#1#2% {\expandafter\newcommand\csname pxpic@parse@px@#1\endcsname[1]{#2}} \protected\long\def\pxpicsetmode#1#2% {\long\expandafter\def\csname pxpic@parse@px@#1\endcsname##1{#2}} \protected\def\pxpicnewcolorlist#1% {% \@ifundefined{pxpic@colorlist@#1}% {\pxpicsetcolorlist{#1}}% {\pxpic@err@defined@colorlist{#1}\@gobble}% } \protected\def\pxpicsetcolorlist#1% {\expandafter\pxpic@setcolorlist\csname pxpic@colorlist@#1\endcsname} \protected\long\def\pxpic@setcolorlist#1#2% {% \edef#1{\ekvparse\pxpic@experr@noval\pxpic@setcolor@colorlist{#2}}% \begingroup\edef#1{\endgroup\protected\def\unexpanded{#1}{#1}}% #1% } \protected\def\pxpicaddcolorlist#1% {% \@ifundefined{pxpic@colorlist@#1}% {\pxpic@err@unknown@colorlist{#1}\@gobble}% {\expandafter\pxpic@addcolorlist\csname pxpic@colorlist@#1\endcsname}% } \protected\long\def\pxpic@addcolorlist#1#2% {% \begingroup \edef\pxpic@tmp {\ekvparse\pxpic@experr@noval\pxpic@setcolor@colorlist{#2}}% \edef\pxpic@tmp {% \endgroup \protected\def\unexpanded{#1}{\unexpanded\expandafter{#1}\pxpic@tmp}% }% \pxpic@tmp } \long\def\pxpic@ifend#1\pxpic@end{} \let\pxpic@ifempty\ekv@ifempty \long\def\pxpic@ifbracket#1\pxpic@end[#2]\pxpic@end{\pxpic@ifempty{#2}} \newcommand*\pxpic@openbrace{\expandafter{\iffalse}\fi} \protected\def\pxpic@parse@setarg#1#2% {% \long\def\pxpic@@parse##1#1% {% \pxpic@ifend##1\pxpic@done\pxpic@end \pxpic@@kern-% \hbox{\pxpic@@kern+\pxpic@parseline##1#2\pxpic@end#2}% \pxpic@@parse }% \long\def\pxpic@parseline##1#2% {% \pxpic@ifend##1\pxpic@linedone\pxpic@end \pxpic@@kern-% \pxpic@parse@px{##1}% \pxpic@parseline }% } \protected\def\pxpic@@parse@group {% \long\def\pxpic@parse##1{\pxpic@@parse##1\pxpic@end}% \pxpic@parse@setarg{}{}% } \ExplSyntaxOn \cs_new_protected:Npn \pxpic@@parse@space #1 { \protected\def\pxpic@@parse@space { \protected\long\def\pxpic@parse ####1 { \tl_trim_spaces_apply:nN {####1} \pxpic@parse@aux #1 \pxpic@end #1 } \pxpic@parse@setarg {#1} {} } \protected\def\pxpic@@parse@csv { \protected\long\def\pxpic@parse ####1 { \tl_trim_spaces_apply:nN {####1} \pxpic@parse@aux #1 \pxpic@end #1 } \pxpic@parse@setarg {#1} { , } } } \ExplSyntaxOff \long\def\pxpic@parse@aux#1{\pxpic@@parse#1} \pxpic@@parse@space{ } \pxpic@@parse@group \long\def\pxpic@done\pxpic@end\pxpic@@kern-\hbox#1\pxpic@@parse{} \long\def\pxpic@linedone \pxpic@end\pxpic@@kern-\pxpic@parse@px#1\pxpic@parseline {} \newcommand\pxpic@parse@px@px[1] {% \ekvifdefinedNoVal{pxpic@px}{#1}% {\csname\ekv@name{pxpic@px}{#1}N\endcsname}% {% \pxpic@err@unknown@px{#1}% \pxskip }% } \let\pxpic@parse@px\pxpic@parse@px@px \newcommand\pxpic@parse@px@named[1] {% \pxpic@ifempty{#1}% {\pxskip}% {{\@declaredcolor{#1}\px}}% } \def\pxpic@tmp#1% {% \pxpicnewmode{#1}% {% \pxpic@ifempty{##1}% {\pxskip}% {{\@undeclaredcolor[#1]{##1}\px}}% }% } \pxpic@tmp{rgb} \pxpic@tmp{cmy} \pxpic@tmp{cmyk} \pxpic@tmp{hsb} \pxpic@tmp{Hsb} \pxpic@tmp{tHsb} \pxpic@tmp{gray} \pxpic@tmp{RGB} \pxpic@tmp{HTML} \pxpic@tmp{HSB} \pxpic@tmp{Gray} \pxpic@tmp{wave} \let\pxpic@tmp\pxpic@undef \newcommand\pxpic@px{\vrule height\pxpicHT width\pxpicWD depth\z@} \newcommand\pxpic@skip{\kern\pxpicWD} \newcommand\pxpic@setcolor[2] {% \pxpic@ifbracket\pxpic@end#2.\pxpic@end[]\pxpic@end \pxpic@setcolor@a\pxpic@setcolor@b {#1}{#2}% } \newcommand\pxpic@setcolor@a[2] {% \expandafter\def\csname\ekv@name{pxpic@px}{#1}N\endcsname {{\@declaredcolor{#2}\px}}% } \newcommand\pxpic@setcolor@b[2] {% \expandafter\def\csname\ekv@name{pxpic@px}{#1}N\endcsname {{\@undeclaredcolor#2\px}}% } \newcommand\pxpic@setcolor@colorlist[2] {% \unexpanded\iffalse{\fi \pxpic@ifbracket\pxpic@end#2.\pxpic@end[]\pxpic@end {\expandafter\expandafter\expandafter\pxpic@openbrace\pxpic@setcolor@a}% {\expandafter\expandafter\expandafter\pxpic@openbrace\pxpic@setcolor@b}% {#1}{#2}% }% } \newcommand\pxpic@err@noval[1] {\PackageError{pxpic}{Missing colour definition for name `\detokenize{#1}'}{}} \newcommand\pxpic@err@unknown@px[1] {\PackageError{pxpic}{Unknown pixel `\detokenize{#1}'. Skipping}{}} \newcommand\pxpic@err@unknown@mode[1] {\PackageError{pxpic}{Unknown mode `#1'}{}} \newcommand\pxpic@err@unknown@colorlist[1] {\PackageError{pxpic}{Unknown colour list `#1'}{}} \newcommand\pxpic@err@defined@colorlist[1] {\PackageError{pxpic}{Colour list `#1' already defined}{}} \newcommand\pxpic@err@unknown@expansion[1] {\PackageError{pxpic}{Unknown expansion mode `#1'}{}} \newcommand\pxpic@err@unknown@lines[1] {\PackageError{pxpic}{Unknown lines mode `#1'}{}} \newcommand\pxpic@err@unknown@file[1] {\PackageError{pxpic}{Unknown file value `#1'}{}} \newcommand\pxpic@err@file@not@found[1] {\PackageError{pxpic}{Couldn't find file #1}{}} \def\pxpic@experr#1% {% \long\def\pxpic@experr##1% {% \expandafter\expandafter\expandafter \pxpic@ifend \@firstofone{#1##1.}% \pxpic@end }% } \begingroup\expandafter\endgroup \expandafter\pxpic@experr\csname pxpic Error:\endcsname \newcommand\pxpic@experr@noval[1] {\pxpic@experr{Missing colour definition for `#1'}} %% %% %% End of file `pxpic.sty'.