%% Copyright (C) 2011-2018 by Martin Scharrer <martin@scharrer-online.de>
%% ----------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
%% This work consists of the files trimclip.dtx, adjustbox.ins
%% and the derived files trimclip.sty,
%% tc-dvips.def, tc-pdftex.def, tc-pgf.def and tc-xetex.def.
%% Further author information are located in the .def files.
%%
\ProvidesFile{tc-dvips.def}[2018/04/08 v2.1 Clipping driver for dvips]
\def\@cliptoboxdim#1{%
    \setbox#1=\hbox{%
        \adjcalc@settobp\WIDTH{\wd#1}%
        \adjcalc@settobp\DEPTH{\dp#1}%
        \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
        \special{%
            ps:
              /mtrxc matrix currentmatrix def
              currentpoint gsave
              translate
              Resolution 72 div VResolution 72 div
              scale
              newpath
              0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
              newpath
              mtrxc setmatrix
        }%
        \hbox to 0pt{\copy#1\hss}%
        \special{ps: grestore }%
        \hskip\wd#1%
    }%
}
\def\@clipcornersofbox#1#2#3#4#5{%
    \setbox#1=\hbox{%
        \adjcalc@settobp\DEPTHmRADIUSBL\@tempdima
        \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
        \adjcalc@settobp\HEIGHT{-\ht#1}%
        \adjcalc@settobp\DEPTH{\dp#1}%
        \adjcalc@settobp\WIDTH{\wd#1}%
        \adjcalc@settobp\RADIUSTL{#2}%
        \adjcalc@settobp\RADIUSTR{#3}%
        \adjcalc@settobp\RADIUSBR{#4}%
        \adjcalc@settobp\RADIUSBL{#5}%
        \adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
        \adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
        \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}%
        \adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#4}%
        \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}%
        \adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#5}%
        \special{%
            ps:
              /mtrxc matrix currentmatrix def
              currentpoint gsave
              translate
              Resolution 72 div VResolution 72 div
              scale
              newpath
              %0 \DEPTH neg translate
              %0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
              0 \RADIUSTLmHEIGHT\space moveto
              \RADIUSTL\space \RADIUSTLmHEIGHT\space \RADIUSTL\space 180 -90 arc
              \WIDTHmRADIUSTR\space \HEIGHT\space lineto
              \WIDTHmRADIUSTR\space \RADIUSTRmHEIGHT\space \RADIUSTR\space -90 0 arc
              \WIDTH\space \DEPTHmRADIUSBR\space lineto
              \WIDTHmRADIUSBR\space \DEPTHmRADIUSBR\space \RADIUSBR\space 0 90 arc
              \RADIUSBL\space \DEPTH\space lineto
              \RADIUSBL\space \DEPTHmRADIUSBL\space \RADIUSBL\space -270 -180 arc
              closepath
              %gsave 0.5 0 0 setrgbcolor stroke grestore
              clip
              newpath
              mtrxc setmatrix
        }%
        \hbox to 0pt{\copy#1\hss}%
        \special{ps: grestore }%
        \hskip \wd#1%
    }%
}
\def\@rndframearoundbox#1#2#3#4#5{%
    \setbox#1=\hbox{%
        \adjsetlength\@tempdima{\fboxsep+.5\fboxrule}%
        \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
        \adjcalc@settobp\TOTALHEIGHT{-\ht#1-\dp#1}%
        \adjcalc@settobp\HEIGHT{-\ht#1}%
        \adjcalc@settobp\DEPTH{\dp#1}%
        \adjcalc@settobp\WIDTH{\wd#1}%
        \adjcalc@settobp\RADIUSTL{#2}%
        \adjcalc@settobp\RADIUSTR{#3}%
        \adjcalc@settobp\RADIUSBR{#4}%
        \adjcalc@settobp\RADIUSBL{#5}%
        \adjcalc@settobp\RADIUSTLmHEIGHT{#2-\ht#1}%
        \adjcalc@settobp\RADIUSTRmHEIGHT{#3-\ht#1}%
        \adjcalc@settobp\WIDTHmRADIUSTR{\wd#1-#3}%
        \adjcalc@settobp\DEPTHmRADIUSBR{\dp#1-#4}%
        \adjcalc@settobp\WIDTHmRADIUSBR{\wd#1-#4}%
        \adjcalc@settobp\DEPTHmRADIUSBL{\dp#1-#5}%
        \adjcalc@settobp\LINEWIDTH{\fboxrule}%
        %
        \hbox to 0pt{\copy#1\hss}%
        \hbox to 0pt{%
            \color@setgroup
            \adjbox@rndframe@color
            \special{%
                ps:
                /mtrxc matrix currentmatrix def
                currentpoint gsave
                translate
                Resolution 72 div VResolution 72 div
                scale
                newpath
                %0 \DEPTH neg translate
                %0 \DEPTH \WIDTH \TOTALHEIGHT rectclip
                0 \RADIUSTLmHEIGHT moveto
                \RADIUSTL \RADIUSTLmHEIGHT \RADIUSTL 180 -90 arc
                \WIDTHmRADIUSTR \HEIGHT lineto
                \WIDTHmRADIUSTR \RADIUSTRmHEIGHT \RADIUSTR -90 0 arc
                \WIDTH \DEPTHmRADIUSBR lineto
                \WIDTHmRADIUSBR \DEPTHmRADIUSBR \RADIUSBR 0 90 arc
                \RADIUSBL \DEPTH lineto
                \RADIUSBL \DEPTHmRADIUSBL \RADIUSBL -270 -180 arc
                closepath
                \LINEWIDTH setlinewidth
                stroke
                newpath
                mtrxc setmatrix
                grestore
            }%
            \color@endgroup
        }%
        \hskip \wd#1%
    }%
    \adjsetlength\@tempdima{.5\fboxrule}%
    \@marginbox#1\@tempdima\@tempdima\@tempdima\@tempdima%
}
\endinput
%%
%% End of file `tc-dvips.def'.
