summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/graphicxsp/examples/grxsp_tst_aeb.tex
blob: 718b24e71c5be6f1cb20a444c59f6546d78af31d (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
\documentclass{article}
\usepackage[designiv,usetemplates]{web}
\usepackage{graphicxsp}


\title{\textsf{GraphicxSP}\texorpdfstring{\\}{:} Demonstration File}
\author{D. P. Story}
\university{Acro\negthinspace\TeX.Net}
\email{dpstory@acrotex.net}
\subject{Form XObjects and BP, EP and SP operators, transparency}
\keywords{Distiller, Form XObjects, BP, EP, and SP operators,transparency}

\newcommand{\cs}[1]{\texttt{\char`\\#1}}

\special{!userdict begin
    /Draw_Ellipse {
        /m matrix currentmatrix def
        4 2 roll translate scale
        0 0 1 0 360 arc
        closepath
        m setmatrix
    } def end
}

\embedEPS[hiresbb,transparencyGroup]{AdobeDon}{graphics/AdobeDon} % /K true
\embedEPS[hiresbb,transparencyGroup]{Airplane}{graphics/000_0151}
\embedEPS[hiresbb]{AdobeDon_full}{graphics/AdobeDon_full}
\embedEPS[transparencyGroup]{ex}{graphics/example}

\parindent0pt

\template[name=Airplane,transparency={/ca .3}]{000_0151}

\begin{document}

\maketitle

The package, tentatively named \textsf{graphicxsp} and which is
still under development, attempts to use the PostScript operators
\textbf{BP}, \textbf{EP} and \textbf{SP} to embed graphics in the
document once, then use and re-use them by emitting the \textbf{SP}
operator. Though this document was created using \textsf{AeB Pro},
the package only requires the \textsf{graphicx} and \textsf{eso-pic}
packages.

\medskip
We begin by embedding out graphics in the preamble of the document
using the \cs{embedEPS} command. The command takes one optional
argument and two required. We can not only use these graphics over
again, the package does support transparency as well, as this file
also demonstrates.
\begin{small}
\begin{verbatim}
\embedEPS[hiresbb,transparencyGroup]{AdobeDon}{AdobeDon}
\embedEPS[hiresbb,transparencyGroup]{Airplane}{000_0151}
\embedEPS[hiresbb]{AdobeDon_full}{AdobeDon_full}
\embedEPS[transparencyGroup]{ex}{example}
\end{verbatim}
\end{small}

I'll use the \texttt{Airplane} photo as a background. The EPS file
of this photo is 550KB, and we will use it multiple times. We
declared \texttt{Airplane} to be a \texttt{transparencyGroup}, which
means we can now set the transparency of the background.
\begin{small}
\begin{verbatim}
\template[name=Airplane,transparency={/ca .3/BM/Normal}]{000_0151}
\end{verbatim}
\end{small}


The package attempts to blend in with the \textsf{graphicx} package, and uses
the \cs{includegraphics} command, with a few extra optional key-value
pairs.
\begin{small}%
\begin{verbatim}
\insertEPS[width=1.5in]{AdobeDon}
\includegraphics*[name=AdobeDon,angle=45,
    width=1.5in,bb=30 50 150 100]{AdobeDon}
\end{verbatim}
\end{small}%



\begin{center}
\insertEPS[width=1.5in]{AdobeDon}
\includegraphics*[name=AdobeDon,width=1.5in,angle=45,bb=30 50 150 100]{AdobeDon}
\end{center}
The second command is in the form of \cs{includegraphics}, the first
one, \cs{embedEPS}, is a shortened version. After embedding, the file name is no longer used,
only the symbolic name.

\newpage

Let's have some fun with two of these images.

\vspace*{.5in}

\begin{center}\previewtrue
\begin{minipage}{.5\linewidth}
\begin{center}
\makebox[0pt][l]{\rotatebox[origin=lb]{180}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{150}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{135}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{120}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{90}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{60}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{45}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{30}{\smash{\insertEPS[width=1in]{Airplane}}}}%
\makebox[0pt][l]{\insertEPS[width=1in]{Airplane}}%
\end{center}
\end{minipage}\hfill%
\begin{minipage}{.5\linewidth}
\begin{center}
\makebox[0pt][l]{\rotatebox[origin=lb]{180}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{150}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{135}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{120}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{90}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{60}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{45}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\rotatebox[origin=lb]{30}{\smash{\insertEPS[width=1in]{AdobeDon}}}}%
\makebox[0pt][l]{\insertEPS[width=1in]{AdobeDon}}%
\end{center}
\end{minipage}
\end{center}

\vspace{1in}

Wow! That would normally take up gobs of file space. This file is about 180 KB.

\newpage

\def\mypreSP#1{%
    newpath
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    Draw_Ellipse
    clip
    newpath
}
\def\mypostSP#1{%
    gsave
    [ /ca .6 /CA .3 /BM/Screen /SetTransparency pdfmark
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    Draw_Ellipse
    0.4 0.7 1 setrgbcolor
    fill
    grestore
    gsave
    [ /CA .5 /BM /Normal /SetTransparency pdfmark
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    Draw_Ellipse
    40 setlinewidth
    0.4 0.7 1 setrgbcolor
    stroke
    grestore
}

\medskip
Let's try some clipping with some transparency settings.

\medskip
\begin{minipage}{1.6in}
\begin{center}
\includegraphics[name=AdobeDon_full,width=1.5in,
    presp={\mypreSP{AdobeDon_full}},
    postsp={\mypostSP{AdobeDon_full}}]{AdobeDon_full}
\end{center}
\end{minipage}\hfill
\begin{minipage}{\linewidth-1.6in}\scriptsize
\begin{verbatim}
\includegraphics[name=AdobeDon_full,width=1.5in,
    presp={\mypreSP{AdobeDon_full}},
    postsp={\mypostSP{AdobeDon_full}}]{AdobeDon_full}
\end{verbatim}
{\normalsize where}
\begin{verbatim}
\def\mypreSP#1{%
    newpath
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    Draw_Ellipse clip newpath
}
\def\mypostSP#1{%
    gsave
    [ /ca .6 /CA .3 /BM/Screen /SetTransparency pdfmark
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    Draw_Ellipse 0.4 0.7 1 setrgbcolor fill
    grestore gsave
    [ /CA .5 /BM /Normal /SetTransparency pdfmark
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    \widthOf{#1} 2 div \heightOf{#1} 2 div
    Draw_Ellipse 40 setlinewidth
    0.4 0.7 1 setrgbcolor stroke
    grestore
}
\end{verbatim}
\end{minipage}
Demonstrating some transparent special effects. Swave!

\newpage

\null\vfil
\begin{center}
\texttt{AdobeDon} and \texttt{AdobeDon} with 50\% opacity\\[1ex]
\insertEPS[width=1.5in]{AdobeDon} \insertEPS[width=1.5in,transparency={/ca .5 /BM/Normal}]{AdobeDon}
\end{center}

\newpage

\null\vfil

\begin{center}\previewtrue
\textsf{\textbf{MathLab Graphics}}\\[1ex]
\insertEPS[width=1in]{ex}  \insertEPS[width=1in,clip]{ex} \insertEPS[width=1in,transparency={/ca .3}]{ex}\\
\end{center}
The bounding box for this graphic is
\texttt{[\llxOf{ex}\space\llyOf{ex}\space\urxOf{ex}\space\uryOf{ex}]}.
The figure in the middle has been clipped using its bounding box (the \texttt{clip} option
of \cs{includegraphics/\cs{insertEPS}}), the
one on the right has 30\% opacity and has not been clipped.
\end{document}

\margins{.25in}{.25in}{24pt}{.25in} % left,right,top, bottom
\screensize{5.4in*\real{0.75}}{5in} % height, width