% Copyright 2022 by Qrrbrbirlbel
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
\usepgflibrary{transformations.mirror}
\tikzset{
  mirror/.code={%
    \pgfutil@in@{--}{#1}%
    \ifpgfutil@in@
      \tikz@trans@mirror#1\@nil
    \else
      \tikz@scan@one@point\pgfqtransformmirror#1\relax
    \fi},
  ymirror/.code={\pgfutil@ifnextchar(\tikz@trans@ymirror@coordinate\tikz@trans@ymirror@simple#1\@nil},
  xmirror/.code={\pgfutil@ifnextchar(\tikz@trans@xmirror@coordinate\tikz@trans@xmirror@simple#1\@nil},
  mirror x/.code={%
    \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}%
    \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}},
  mirror y/.code={%
    \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}%
    \pgftransformmirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}},
  mirror/.value required,
  ymirror/.value required,
  xmirror/.value required,
  mirror x/.value required,
  mirror y/.value required}
\def\tikz@trans@mirror#1--#2\@nil{%
  \pgftransformmirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax}
                     {\tikz@scan@one@point\pgfutil@firstofone#2\relax}}
\def\tikz@trans@xmirror@simple#1\@nil{\pgftransformxmirror{#1}}
\def\tikz@trans@ymirror@simple#1\@nil{\pgftransformymirror{#1}}
\def\tikz@trans@xmirror@coordinate#1\@nil{%
  \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxmirror{+\the\pgf@x}}
\def\tikz@trans@ymirror@coordinate#1\@nil{%
  \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformymirror{+\the\pgf@y}}

\tikzset{
  Mirror/.code={%
    \pgfutil@in@{--}{#1}%
    \ifpgfutil@in@
      \tikz@trans@Mirror#1\@nil
    \else
      \tikz@scan@one@point\pgfqtransformMirror#1\relax
    \fi},
  yMirror/.code={\pgfutil@ifnextchar(\tikz@trans@yMirror@coordinate\tikz@trans@yMirror@simple#1\@nil},
  xMirror/.code={\pgfutil@ifnextchar(\tikz@trans@xMirror@coordinate\tikz@trans@xMirror@simple#1\@nil},
  Mirror x/.code={%
    \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}%
    \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{0}{1}}}},
  Mirror y/.code={%
    \pgfextract@process\tikz@temp{\tikz@scan@one@point\pgfutil@firstofone#1\relax}%
    \pgftransformMirror{\tikz@temp}{\pgfpointadd{\tikz@temp}{\pgfqpointxy{1}{0}}}},
  Mirror/.value required,
  yMirror/.value required,
  xMirror/.value required,
  Mirror x/.value required,
  Mirror y/.value required}
\def\tikz@trans@Mirror#1--#2\@nil{%
  \pgftransformMirror{\tikz@scan@one@point\pgfutil@firstofone#1\relax}
                     {\tikz@scan@one@point\pgfutil@firstofone#2\relax}}
\def\tikz@trans@xMirror@simple#1\@nil{\pgftransformxMirror{#1}}
\def\tikz@trans@yMirror@simple#1\@nil{\pgftransformyMirror{#1}}
\def\tikz@trans@xMirror@coordinate#1\@nil{%
  \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformxMirror{+\the\pgf@x}}
\def\tikz@trans@yMirror@coordinate#1\@nil{%
  \tikz@scan@one@point\pgfutil@firstofone#1\pgftransformyMirror{+\the\pgf@y}}
\endinput
