summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/adjustbox/adjgrfx.sty
blob: 8b0afff8ffad9fead97dfd243e78713ebf3755a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
\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'.