%%
%% 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 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}[2021-01-16 v1.2 draw pixel pictures]
\RequirePackage{xcolor}
\RequirePackage{expkv}
\@ifdefinable\pxpicHT{\newdimen\pxpicHT}
\@ifdefinable\pxpicWD{\newdimen\pxpicWD}
\pxpicHT1pt
\pxpicWD\pxpicHT
\@ifdefinable\pxpic@kern{\newdimen\pxpic@kern}
\pxpic@kern\z@
\protected\ekvdef{pxpic}{size}
  {\pxpicHT\dimexpr#1\relax\pxpicWD\dimexpr#1\relax}
\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}
\@ifdefinable\pxpic{\protected\def\pxpic{\hbox\bgroup\pxpic@}}
\newcommand\pxpic@[2][]
  {%
    \vbox
      {%
        \pxpicsetup{#1}%
        \let\px\pxpic@px
        \let\pxskip\pxpic@skip
        \advance\pxpicHT\pxpic@kern
        \advance\pxpicWD\pxpic@kern
        \baselineskip\pxpicHT
        \kern\pxpic@kern
        \pxpic@parse#2\pxpic@end
      }%
    \egroup
  }
\ekvsetdef\pxpicsetup{pxpic}
\newcommand*\pxpiclogo[1][.13ex]
  {%
    \begingroup
      \pxpicHT\dimexpr#1\relax
      \pxpicWD\pxpicHT
      \pxpic@kern\z@
      \leavevmode
      \lower3.2\pxpicHT\pxpic
        [mode=px,colours={o=[HTML]{9F393D},g=black!75},skip=.]
        {
          {............................................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\pxpicsetcolorlist@\csname pxpic@colorlist@#1\endcsname}
\protected\long\def\pxpicsetcolorlist@#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\pxpicaddcolorlist@\csname pxpic@colorlist@#1\endcsname}%
  }
\protected\long\def\pxpicaddcolorlist@#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}
\newcommand\pxpic@parse[1]
  {%
    \pxpic@ifend#1\pxpic@done\pxpic@end
    \kern-\pxpic@kern
    \hbox{\kern\pxpic@kern\pxpic@parseline#1\pxpic@end}%
    \pxpic@parse
  }
\long\def\pxpic@done\pxpic@end\kern-\pxpic@kern\hbox#1\pxpic@parse{}
\newcommand\pxpic@parseline[1]
  {%
    \pxpic@ifend#1\pxpic@linedone\pxpic@end
    \kern-\pxpic@kern
    \pxpic@parse@px{#1}%
    \pxpic@parseline
  }
\long\def\pxpic@linedone
    \pxpic@end\kern-\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{\hskip\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}{}}
\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'.
