\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