%%
%% This is file `adjgrfx.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% adjustbox.dtx  (with options: `adjgrfx')
%% 
%% Copyright (C) 2011 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.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 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 adjustbox.dtx and adjustbox.ins
%% and the derived files adjustbox.sty, adjcalc.sty, adjpgf.def and
%% adjgrfx.sty.
%% 
\ProvidesPackage{adjgrfx}[2011/07/28 v0.1 Patches to graphicx used by adjustbox]
\RequirePackage{graphicx}
%%^^A  \width, \height, \totalheight, \depth  =  size current at option execution (changes after every option) (initial: natural size)
%%^^A  \Width, \Height, \Totalheight, \Depth  =  requested size of image (height/totalheight and width) (initial: natural size)
%%^^A  \WIDTH, \HEIGHT, \TOTALHEIGHT, \DEPTH  =  natural size of image
%%
%%
\newcommand*\Gin@adj@adddim{%
    \let\height\Gin@nat@height
    \let\width\Gin@nat@width
    \let\totalheight\height
    \let\depth\z@
    \let\adjbox@HEIGHT\HEIGHT
    \let\adjbox@WIDTH\WIDTH
    \let\adjbox@TOTALHEIGHT\TOTALHEIGHT
    \let\adjbox@DEPTH\DEPTH
    \global\let\HEIGHT\Gin@nat@height
    \global\let\WIDTH\Gin@nat@width
    \global\let\TOTALHEIGHT\HEIGHT
    \global\let\DEPTH\z@
    \let\adjbox@Height\Height
    \let\adjbox@Width\Width
    \let\adjbox@Totalheight\Totalheight
    \let\adjbox@Depth\Depth
    \global\let\Height\Gin@nat@height
    \global\let\Width\Gin@nat@width
    \global\let\Totalheight\Height
    \global\let\Depth\z@
    \edef\adjbox@restore@dims{%
        \global\adjbox@nat@height\the\adjbox@nat@height\relax
        \global\adjbox@nat@width \the\adjbox@nat@width\relax
        \global\adjbox@req@height\the\adjbox@req@height\relax
        \global\adjbox@req@width \the\adjbox@req@width\relax
    }%
}
\newcommand*\Gin@adj@remdim{%
    \global\let\HEIGHT\adjbox@HEIGHT
    \global\let\WIDTH\adjbox@WIDTH
    \global\let\TOTALHEIGHT\adjbox@TOTALHEIGHT
    \global\let\DEPTH\adjbox@DEPTH
    \global\let\Height\adjbox@Height
    \global\let\Width\adjbox@Width
    \global\let\Totalheight\adjbox@Totalheight
    \global\let\Depth\adjbox@Depth
    \adjbox@restore@dims
}
\newdimen\adjbox@nat@width
\newdimen\adjbox@nat@height
\newdimen\adjbox@req@width
\newdimen\adjbox@req@height
\newcommand*\Gin@adj@keepdim{%
    \global\adjbox@nat@height\Gin@nat@height
    \global\adjbox@nat@width \Gin@nat@width
    \global\adjbox@req@height\Gin@req@height
    \global\adjbox@req@width \Gin@req@width
    \global\let\HEIGHT\adjbox@nat@height
    \global\let\WIDTH\adjbox@nat@width
    \global\let\TOTALHEIGHT\adjbox@nat@height
    \global\let\DEPTH\z@
    \global\let\Height\adjbox@req@height
    \global\let\Width\adjbox@req@width
    \global\let\Totalheight\adjbox@req@height
    \global\let\Depth\z@
}
\def\Gin@ii[#1]#2{%
    \def\@tempa{[}\def\@tempb{#2}%
    \ifx\@tempa\@tempb
      \def\@tempa{\Gin@iii[#1][}%
      \expandafter\@tempa
    \else
     \begingroup
       \Gin@adj@adddim
       \@tempswafalse
       \toks@{\Ginclude@graphics{#2}}%
       \setkeys{Gin}{#1}%
       \Gin@esetsize
       \the\toks@
       \Gin@adj@remdim
     \endgroup
     \fi}
\def\Gin@iii[#1,#2][#3,#4]#5{%
  \begingroup
  \Gin@adj@adddim
  \Gin@bboxtrue
  \Gin@defaultbp\Gin@llx{#1}%
  \Gin@defaultbp\Gin@lly{#2}%
  \Gin@defaultbp\Gin@urx{#3}%
  \Gin@defaultbp\Gin@ury{#4}%
  \Ginclude@graphics{#5}%
  \Gin@adj@remdim
  \endgroup}
\def\Gin@setfile#1#2#3{%
  \ifx\\#2\\\Gread@false\fi
  \ifGin@bbox\else
    \ifGread@
      \csname Gread@%
         \expandafter\ifx\csname Gread@#1\endcsname\relax
           eps%
         \else
           #1%
         \fi
      \endcsname{\Gin@base#2}%
    \else
      \Gin@nosize{#3}%
    \fi
  \fi
  \Gin@viewport@code
  \Gin@nat@height\Gin@ury bp%
  \advance\Gin@nat@height-\Gin@lly bp%
  \Gin@nat@width\Gin@urx bp%
  \advance\Gin@nat@width-\Gin@llx bp%
  \Gin@req@sizes
  \Gin@adj@keepdim
  \expandafter\ifx\csname Ginclude@#1\endcsname\relax
    \Gin@drafttrue
    \expandafter\ifx\csname Gread@#1\endcsname\relax
      \@latex@error{Can not include graphics of type: #1}\@ehc
      \global\expandafter\let\csname Gread@#1\endcsname\@empty
    \fi
  \fi
  \leavevmode
  \ifGin@draft
      \hb@xt@\Gin@req@width{%
        \vrule\hss
        \vbox to \Gin@req@height{%
           \hrule \@width \Gin@req@width
           \vss
           \edef\@tempa{#3}%
           \rlap{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}%
           \vss
           \hrule}%
        \hss\vrule}%
  \else
    \@addtofilelist{#3}%
    \ProvidesFile{#3}[Graphic file (type #1)]%
    \setbox\z@\hbox{\csname Ginclude@#1\endcsname{#3}}%
    \dp\z@\z@
    \ht\z@\Gin@req@height
    \wd\z@\Gin@req@width
  \box\z@
  \fi}
\endinput
%%
%% End of file `adjgrfx.sty'.
