summaryrefslogtreecommitdiff
path: root/Master/tlpkg/dviout/GRAPHIC/PBM
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2008-09-26 09:17:26 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2008-09-26 09:17:26 +0000
commit69cdb80977fc59e47c24a680fc0c61a3eac0c097 (patch)
treeca111e9049a1785bf8507161dce88a2233268760 /Master/tlpkg/dviout/GRAPHIC/PBM
parentd3a140feea19858912cc2de406e176ae8ce6c392 (diff)
dviout moved to tlpkg/dviout; dviout.vbs changed accordingly.
git-svn-id: svn://tug.org/texlive/trunk@10733 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/dviout/GRAPHIC/PBM')
-rw-r--r--Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.doc167
-rw-r--r--Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.sty478
2 files changed, 645 insertions, 0 deletions
diff --git a/Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.doc b/Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.doc
new file mode 100644
index 00000000000..073b583d975
--- /dev/null
+++ b/Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.doc
@@ -0,0 +1,167 @@
+      pbmf.sty について
+
+                             Oct. 25, 1993 八雲
+
+
+ これは、PBMファイル読み込み機能付きdviout/dviprtで 、PBM形式のビットマップ
+データをLaTeX文書に取り込むためのマクロです。
+ (このマクロは、風間さん&磯崎さん作の(ecl)epsf.styを元にして作りました。)
+
+【機能】
+
+  指定されたサイズの枠をあけて、PBMファイルを取り込みます。
+ (Ver.0.5d から、monochrome GIFファイル取り込み用マクロも追加されました。)
+
+【必要な設定】
+
+  scaleオプション用に、プリンタの解像度を\pbmhdpiと\pbmvdpi に設定する必要
+ があります。 \pbmhdpiが水平方向、\pbmvdpiが垂直方向の解像度で、単位はdpiで
+ す。自分の使っているプリンタの解像度に設定して下さい。
+  デフォルト値の設定は、pbmf.styの51,52行目で行っています。
+
+ \pbmhdpi=360%<---- プリンタ水平方向解像度のデフォルト値
+ \pbmvdpi=360%<---- プリンタ垂直方向解像度のデフォルト値
+
+【使用方法】
+
+  file=の後にraw PBM形式のファイル名を書きます。
+
+ 正しい例1:\pbmfile{file=foo.pbm}
+ ^^^^^^^
+ ファイル名
+
+  出力サイズを指定するオプションとして、width,height,scale,hscale,vscaleの
+ 5種類が使えます。
+  基本的に(ecl)epsf.styでの\epsfile{file=...}の代わりに\pbmfile{file=...}
+ を使うというだけで、オプションのサイズ指定方法は(ecl)epsf.styと同じです。
+
+ (1)width,heightオプション
+
+  width=,height=を使った場合、cmやptなどの単位で、出力画像の幅と高さを指定
+ できます。widthまたはheightの片方のみ指定した場合は、元の画像の縦横比から
+ 残りのサイズが決定されます。例えば、元の画像が200x100の場合に、width=5cmと
+ だけ指定された場合は幅5cm、高さ2.5cmの画像が出力されます。
+
+ 正しい例2:\pbmfile{file=foo.pbm,width=3cm}
+ ^^^^^^^ ^^^^^^^^^
+ ファイル名 サイズ指定オプション
+
+ 正しい例3:\pbmfile{file=foo.pbm,width=100pt,height=70pt}
+
+ 【注意】オプション指定の前に空白を入れてはいけません。
+     正常に処理されない可能性が高いです。
+
+ 悪い例:\pbmfile{file=foo.pbm, width=5cm, height=3.5cm}
+ ^空白 ^空白
+
+ (2)scaleオプション
+
+  scale=を使った場合、元の画像に対する倍率で出力画像のサイズを指定できます。
+ 例えば、元の画像が640x400の場合に、scale=2と指定した場合は幅1280ドット、高
+ さ800ドットの画像が出力されます。また、hscale=とvscale=は、幅と高さの倍率を
+ 独立に設定したい場合に使用します。
+
+ 正しい例4:\pbmfile{file=foo.pbm,scale=2}
+ 正しい例5:\pbmfile{file=foo.pbm,hscale=1.5,vscale=1.2}
+
+ (3)文字列等を画像の上に上書きする方法
+
+  (ecl)epsf.styでの\epsfatに対応するものとして\pbmfat、\pbmfon、及び
+ \ovpbmfon が用意されています。これらを使うことで、画像の中に適当な枠を空け
+ て文字列等を上書きすることができます。\pbmfatは透過形、\pbmfonと\ovpbmfon
+ は非透過形です。\pbmfonは四角い枠を、\ovpbmfonは角の丸い四角い枠を空けます。
+  \pbmfonと\ovpbmfonはdviout/prtのtpic specialsを用いて実現していますので、
+ "-tpic"オプションがオンになっていないと使用できません。
+
+  \epsfatを使ったことのある方は、位置指定に注意してください。\epsfatでは原
+ 画像上の座標で指定しますが、\pbmfat,\pbmfon,\ovpbmfon では拡大縮小された出
+ 力画像上の座標で指定します。
+
+ 例6:\pbmfile[\pbmfat(1cm,1.5cm){サンプル画像1}]{file=foo1.pbm}
+ 例7:\pbmfile[\pbmfon(1cm,1.5cm){サンプル画像2}]{file=foo2.pbm,scale=2}
+ 例8:\pbmfile[\ovpbmfon(10mm,12mm){サンプル画像}]{file=foo.pbm}
+ ^^^^^^^^^ ^^^^^^^^^^^^
+ 位置指定  上書きする文字列
+
+ (4)mono GIF形式のデータを取り込む場合
+
+  monochrome GIFの場合は、\giffile{file=...}を使って下さい。ただし、GIFの場
+ 合、scale、vscale、hscaleオプションを使うためには、orgsizeというオプション
+ で元の画像の幅と高さを設定する必要があります。
+  一方、orgsizeが設定されていない場合は、widthとheightの両方必要です。
+  \epsfileや\pbmfileの様に片方を省略することはできません。
+
+ 正しい例9:\giffile{file=foo.gif,orgsize=640x400,width=4cm}
+ 正しい例10:\giffile{file=foo.gif,orgsize=400x400,scale=2}
+ 正しい例11:\giffile{file=foo.gif,width=4cm,height=3cm}
+
+
+【使用例】
+
+ [例12]:foo.pbmというPBMファイルを読み込んで、幅を5cmに指定して出力する。
+ (この場合、高さは縦横比から自動的に計算されます)
+
+ \documentstyle[12pt,pbmf]{jarticle}
+ \begin{document}
+ This is test image.
+ \frame{\pbmfile{file=foo.pbm,width=5cm}}
+ Test image.
+ \end{document}
+
+
+ [例13]:foo.pbmというPBMファイルを読み込んで、2倍に拡大して出力する。
+ (例えばPBMデータが150x100の場合、300x200dotsでプリンタに出力されます)
+
+ \documentstyle[pbmf]{jarticle}
+ \begin{document}
+ This is test image.
+ \pbmfile{file=foo.pbm,scale=2}
+ Test image.
+ \end{document}
+
+
+ [例14]:foo.pbmというPBMファイルを読み込み、画像の中に"Hello!" という文
+ 字列を上書きして出力する。その位置は、画像の左下から右に2cm、上に1cmの所に
+ なります。
+
+ \documentstyle[pbmf]{jarticle}
+ \begin{document}
+ This is test image.
+ \pbmfile[\pbmfon(2cm,1cm){\fbox{\large Hello!}}]{file=foo.pbm}
+ Test image.
+ \end{document}
+
+
+ [例15]:foo.pbmというPBMファイルを読み込み、画像の中に"Hello!" という文
+ 字列を角の丸い枠を空けて上書きする。枠線の太さを0.6pt、角の丸みの半径を3mm
+ にしています。(pbmf.styのデフォルトは各々0.4pt,2mmになっています)
+
+ \documentstyle[pbmf]{jarticle}
+ \ovrulewidth=0.6pt
+ \ovradius=3mm
+ \begin{document}
+ This is test image.
+ \pbmfile[\ovpbmfon(2cm,1cm){\large Hello!}]{file=foo.pbm}
+ Test image.
+ \end{document}
+
+
+【問題点】
+
+  pbmf.styはPBM形式を完全にサポートしているわけではありません(;_;)。
+ 以下の様なフォーマットのPBMファイルは正常に処理されます(pbmplusライブラリ
+ で他の画像形式からPBMに変換したファイルやGhostScriptのpbmraw出力は、この形
+ 式のはずなので、正常に処理されると思います)。
+
+ P 4 0x0a : 3 byte, 最初の "P4" は、ID
+ #<string> 0x0a : コメント行
+ ......... : (任意バイト x 任意行)
+ <width_by_dots> 0x20 <height_by_dots> 0x0a : 横と縦のドットサイズ
+ ........ : binary image-data
+
+ <width_by_dots>, <height_by_dots> は、通常の 10進数です。
+
+
+  raw PBMの正式なフォーマットでは、P4, <width_by_dots>, <height_by_dots>
+ の次の 1 byte として、0x20, 0x0a, 0x0d, 0x09のいずれかが認められていますが、
+ pbmf.styでは上記フォーマット以外は正常に処理されないと思って下さい。
diff --git a/Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.sty b/Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.sty
new file mode 100644
index 00000000000..3696f6cedae
--- /dev/null
+++ b/Master/tlpkg/dviout/GRAPHIC/PBM/pbmf.sty
@@ -0,0 +1,478 @@
+% PBM macro for DVIOUT/DVIPRT version 0.5e
+% based on eclepsf.sty by Kazuhiro Kazama and modified by Hideki ISOZAKI
+% and psfig.tex by Trevor J. Darrell.
+%
+% All software, documentation, and related files in this distribution of
+% psfig/tex are Copyright (c) 1987 Trevor J. Darrell
+%
+% Permission is granted for use and non-profit distribution of psfig/tex
+% providing that this notice be clearly maintained, but the right to
+% distribute any portion of psfig/tex for profit or as part of any commercial
+% product is specifically reserved for the author.
+%
+%
+% ☆scaleオプション指定での基準サイズ(scale=1での出力)
+%   \realscaletrue時、PBMデータ1dotをプリンタ出力の1dotとして出力
+%   \realscalefalse時、PBMデータ1dotを 1pt x 1pt の点として出力
+%
+% ☆\realscaletrue時用に、プリンタの解像度を\pbmhdpiと\pbmvdpiで設定します。
+%   Ex. \pbmhdpi=300\pbmvdpi=300
+%
+% \pbmfile
+% usage : \pbmfile{file=foo.pbm,width=5cm,height=3.5cm}
+% usage : \pbmfile{file=foo.pbm,width=100pt,height=70pt}
+% usage : \pbmfile{file=foo.pbm,scale=2}
+% usage : \pbmfile{file=foo.pbm,hscale=1.5,vscale=1.2}
+% ^^ ^^
+%                オプション間に、空白を入れないで下さい。
+%
+% \pbmfat
+% usage : \pbmfile[\pbmfat(10mm,12mm){テスト}]{file=foo.pbm}
+%
+% \pbmfon
+% usage : \pbmfile[\pbmfon(10mm,12mm){テスト}]{file=foo.pbm}
+%
+% \ovpbmfon
+% usage : \pbmfile[\ovpbmfon(10mm,12mm){テスト}]{file=foo.pbm}
+% ^^^^^^^^^
+% 座標指定
+%
+%
+% \giffile
+%
+% ・orgsizeオプションを使う場合
+% usage : \giffile{file=foo.gif,orgsize=640x400,scale=2}
+% usage : \giffile{file=foo.gif,orgsize=200x200,hscale=3,vscale=2}
+%
+% ・使わない場合、scaleオプションは使用不可。width=とheight=は省略不可
+% usage : \giffile{file=foo.gif,width=5cm,height=3.5cm}
+% usage : \giffile{file=foo.gif,width=100pt,height=70pt}
+%
+% Oct. 25, 1993 by Yakumo
+%
+\endlinechar=-1
+\typeout{PBM macro ver. 0.5e - Released Oct. 25, 1993}
+\newcount\pbmhdpi
+\newcount\pbmvdpi
+\pbmhdpi=360%<---- プリンタ水平方向解像度のデフォルト値
+\pbmvdpi=360%<---- プリンタ垂直方向解像度のデフォルト値
+\newif\ifrealscale
+\realscaletrue
+\newif\ifset@vscale
+\newif\ifset@hscale
+\set@vscalefalse\set@hscalefalse
+\newif\ifset@orgsize
+\set@orgsizefalse
+\newdimen\@pbmhsize
+\newdimen\@pbmvsize
+\newcount\@bmarga
+\newcount\@bmargb
+\newcount\@bmsum
+\newcount\@bmrema
+\newcount\@bmremb
+\newcount\@bmctmpa
+\newcount\@bmctmpb
+\newcount\@bmctmpc
+\newdimen\@bmdarg
+\newif\ifcontinue
+
+\def\@setpbmfile#1{
+ \def\@pbmfile{#1}
+ \pbmbb@search
+}
+\def\@setpbmheight#1{
+ \@bmdarg=#1\relax
+ \edef\@pbmheight{\number\@bmdarg}
+}
+\def\@setpbmwidth#1{
+ \@bmdarg=#1\relax
+ \edef\@pbmwidth{\number\@bmdarg}
+}
+\def\@setpbmscale#1{
+ \def\@pbmhscale{#1}
+ \def\@pbmvscale{#1}
+ \set@vscaletrue\set@hscaletrue
+}
+\def\@setpbmhscale#1{
+ \def\@pbmhscale{#1}
+ \set@hscaletrue
+}
+\def\@setpbmvscale#1{
+ \def\@pbmvscale{#1}
+ \set@vscaletrue
+}
+\def\parse@pbm@parms#1{
+ \def\@bbw{0}\def\@bbh{0}
+ \def\@pbmhscale{1}\def\@pbmvscale{1}
+ \def\@pbmheight{0}\def\@pbmwidth{0}
+ \@for\@pbmopt:=#1\do
+ {\expandafter\@bmsetparms\@pbmopt,}}
+
+\def\@bmsetparms#1=#2,{\@nameuse{@setpbm#1}{#2}}
+%
+% \pbmin@compute performs #1 * (#2 / #3)
+% then leaves the result in @result
+%
+\def\@divmod#1#2{
+ \@bmctmpa=#1\relax
+ \divide\@bmctmpa by#2\relax
+ \edef\@quotient{\number\@bmctmpa\relax}
+ \multiply\@bmctmpa by#2\relax
+ \@bmctmpb=#1\relax
+ \advance\@bmctmpb by -\@bmctmpa
+ \edef\@remaindar{\number\@bmctmpb}}
+%
+\def\pbmin@compute#1#2#3{
+ \ifnum#3>\z@
+ \@divmod{#1}{#3}
+ \@bmsum=\@quotient
+ \multiply\@bmsum by#2\relax
+ \@bmrema=\@remaindar\relax
+ \ifnum\@bmrema>\z@
+ \@divmod{#2}{#3}
+ \@bmctmpc=\@quotient
+ \multiply\@bmctmpc by\@bmrema
+ \advance\@bmsum by\@bmctmpc
+ \@bmremb=\@remaindar\relax
+ \ifnum\@bmremb>\z@
+ \ifnum#3<32769
+ \multiply\@bmrema by\@bmremb
+ \divide\@bmrema by#3\relax
+ \advance\@bmsum by\@bmrema
+ \else
+ \edef\bm@digit{1}
+ \@bmarga=0\relax
+ \loop
+ \edef\bm@digit{\bm@digit0}
+ \@divmod{\the\@bmremb0}{#3}
+ \@bmremb=\@remaindar\relax
+ \@bmargb=\@bmrema
+ \multiply\@bmargb by\@quotient
+ \advance\@bmargb by\@bmarga
+ \@divmod{\@bmargb}{\bm@digit}
+ \advance\@bmsum by\@quotient
+ \@bmarga=\@remaindar0\relax
+ \ifnum\bm@digit<\@bmrema
+ \repeat
+ \fi
+ \fi
+ \fi
+ \else
+ \errmessage{pbm: Illegal parameter}
+ \fi
+ \edef\@result{\number\@bmsum}
+}
+\def\bmcompute@handw{
+ \ifnum\@pbmheight=\z@
+ \ifnum\@pbmwidth=\z@
+ \@bmdarg=\@bbh sp \@bmdarg=\@pbmvscale\@bmdarg
+ \edef\@pbmheight{\number\@bmdarg}
+ \@bmdarg=\@bbw sp \@bmdarg=\@pbmhscale\@bmdarg
+ \edef\@pbmwidth{\number\@bmdarg}
+ \multiply\@pbmhsize by\@pbmhscale
+ \multiply\@pbmvsize by\@pbmvscale
+ \else
+ \pbmin@compute{\number\@pbmwidth}{\number\@pbmvsize}{\number\@pbmhsize}
+ \edef\@pbmheight{\@result}
+ \fi
+ \else
+ \ifnum\@pbmwidth=\z@
+ \pbmin@compute{\number\@pbmheight}{\number\@pbmhsize}{\number\@pbmvsize}
+ \edef\@pbmwidth{\@result}
+ \fi
+ \fi
+ \ifnum\@pbmheight<\z@
+ \errmessage{pbm: Illegal height}
+ \fi
+ \ifnum\@pbmwidth<\z@
+ \errmessage{pbm: Illegal width}
+ \fi
+}
+
+\def\pbmfile{\@ifnextchar[{\@pbmfile}{\@pbmfile[]}}
+\def\@pbmfile[#1]#2{{
+ \parse@pbm@parms{#2}
+ \bmcompute@handw
+ {\@bmarga=\@pbmwidth \divide\@bmarga by 186468\relax
+ \@bmargb=\@pbmheight \divide\@bmargb by 186468\relax
+ \message{becomes \the\@bmarga mm x \the\@bmargb mm}}
+ \@bmarga=\@pbmheight \divide\@bmarga by 65536\relax
+ \edef\@bmvsize{\number\@bmarga}
+ \@bmarga=\@pbmwidth \divide\@bmarga by 65536\relax
+ \edef\@bmhsize{\number\@bmarga}
+ \leavevmode
+ \hbox to \@pbmwidth sp{
+ \vrule\@width\z@\@height\@pbmheight sp\@depth\z@
+ \raise\@pbmheight sp
+ \hbox to\z@{
+ \ifrealscale
+ \special{pbmfile=\@pbmfile\space
+ \ifset@hscale hsize=\number\@pbmhsize dot/\the\pbmhdpi dpi
+ \else hsize=\@bmhsize\fi\space
+ \ifset@vscale vsize=\number\@pbmvsize dot/\the\pbmvdpi dpi
+ \else vsize=\@bmvsize\fi\space
+ }
+ \else
+ \special{pbmfile=\@pbmfile\space
+ \ifset@hscale hscale=\@pbmhscale
+ \else hsize=\@bmhsize\fi\space
+ \ifset@vscale vscale=\@pbmvscale
+ \else vsize=\@bmvsize\fi\space
+ }
+ \fi
+ }
+ \vrule\@width\z@\@height\@pbmheight sp \@depth\z@
+ \hbox to\z@{#1}\hfil
+ }
+}}
+
+\newread\pbm@stream
+\catcode`\#=11\relax
+\def\pbmbb@search{\continuetrue
+ \typeout{analyzing \@pbmfile}
+ \openin\pbm@stream=\@pbmfile\relax
+ \ifeof\pbm@stream\errmessage{pbm: \@pbmfile\space not found}\fi
+ \read\pbm@stream to \pbm@line
+ \expandafter\id@pbmplus\pbm@line.
+ \ifnum4=\@magic \message{PBM(P4-type) }
+ \else \ifnum1=\@magic \errmessage{pbm: P1-type not supported}
+ \else \errmessage{pbm: \@pbmfile\space is not PBM file}\fi\fi
+ \loop
+ \read\pbm@stream to \pbm@line
+ \if\expandafter\next@char\pbm@line\end@getbb #\else\continuefalse\fi
+ \ifeof\pbm@stream\errmessage{pbm: \@pbmfile\space has no data}\fi
+ \ifcontinue \repeat
+ \expandafter\pbm@getbb\pbm@line.
+ \closein\pbm@stream
+}
+\catcode`\#=6\relax
+\def\next@char#1#2\end@getbb{#1}
+\def\id@pbmplus#1#2.{\edef\@magic{\if#1P\next@char#2\end@getbb\else0\fi}}
+%
+%
+\def\pbm@getbb#1 #2.{
+ \@bmdarg=#1pt\ifrealscale\divide\@bmdarg by \pbmhdpi\@bmdarg=72.27\@bmdarg\fi
+ \edef\@bbw{\number\@bmdarg}\@pbmhsize=#1sp
+ \@bmdarg=#2pt\ifrealscale\divide\@bmdarg by \pbmvdpi\@bmdarg=72.27\@bmdarg\fi
+ \edef\@bbh{\number\@bmdarg}\@pbmvsize=#2sp
+ \message{original: #1 x #2}
+}
+%
+% You can put anything on the picture using \pbmfat , \pbmfon , \ovpbmfon
+%
+\def\pbmfat(#1,#2)#3{\@killglue{
+ \smash{\raise#2\hbox to \z@{\kern#1 \relax#3\hss}}}\ignorespaces}
+%
+\newbox\@strbox
+%
+\def\pbmfon(#1,#2)#3{
+ \setbox\@strbox=\hbox{#3}
+ \@bmctmpa=\number\wd\@strbox
+ \@bmctmpb=\number\ht\@strbox
+ \@bmctmpc=\number\dp\@strbox
+ \advance\@bmctmpc by\@bmctmpb
+ \divide\@bmctmpc by 4736\relax
+ \divide\@bmctmpa by 4736\relax
+ \pbmfat(#1,#2){
+ \raise\@bmctmpb sp\hbox to\z@{
+ \special{pn 0}\special{sh 0}
+ \special{pa 0 0}\special{pa \the\@bmctmpa\space 0}
+ \special{pa \the\@bmctmpa\space \the\@bmctmpc}\special{pa 0 \the\@bmctmpc}
+ \special{pa 0 0}
+ \special{ip}}#3
+ }
+}
+%
+\newdimen\ovrulewidth
+\newdimen\ovradius
+\ovrulewidth=0.4pt
+\ovradius=2mm
+\def\hornlength{5}
+%
+\def\ovpbmfon{\@ifnextchar({\@ovpbmfon{}}{\@ovpbmfon}}
+\def\@ovpbmfon#1(#2,#3)#4{
+ \setbox\@strbox=\hbox{#4}
+ \@bmctmpa=\number\wd\@strbox
+ \@bmctmpb=\number\ht\@strbox
+ \@bmctmpc=\number\dp\@strbox
+ \@bmremb=\number\ovrulewidth
+ \@bmarga=\number\ovradius
+ \divide\@bmarga by 4736\relax
+ \edef\CoRadius{\the\@bmarga}
+ \divide\@bmarga by 2\relax
+ \edef\CoBase{\the\@bmarga}
+ \@bmdarg=\ovradius
+ \advance\@bmdarg by\@bmremb sp
+ \@bmarga=\number\@bmdarg
+ \advance\@bmctmpc by\@bmctmpb
+ \advance\@bmctmpb by\@bmarga
+ \divide\@bmctmpc by 4736\relax
+ \divide\@bmctmpa by 4736\relax
+ \divide\@bmarga by 4736\relax
+ \divide\@bmremb by 4736\relax
+ \advance\@bmctmpa by\@bmarga
+ \@bmargb=\@bmctmpa
+ \advance\@bmargb by\@bmarga
+ \advance\@bmctmpc by\@bmarga
+ \@bmrema=\@bmctmpc
+ \advance\@bmrema by\@bmarga
+ \advance\@bmargb by-\@bmremb
+ \advance\@bmrema by-\@bmremb
+ \if#1\@empty\else
+ \@bmsum=\@bmarga
+ \divide\@bmsum by 10\relax
+ \multiply\@bmsum by\hornlength
+ \edef\@hornlg{\the\@bmsum}
+ \if#1a\@bmsum=\@bmremb
+ \advance\@bmsum by -\@hornlg\relax
+ \edef\@hornx{\the\@bmsum}
+ \else\if#1b\@bmsum=\@bmargb
+ \advance\@bmsum by \@hornlg\relax
+ \edef\@hornx{\the\@bmsum}
+ \@bmsum=\@bmremb
+ \advance\@bmsum by -\@hornlg\relax
+ \edef\@horny{\the\@bmsum}
+ \else\if#1c\@bmsum=\@bmargb
+ \advance\@bmsum by \@hornlg\relax
+ \edef\@hornx{\the\@bmsum}
+ \@bmsum=\@bmrema
+ \advance\@bmsum by \@hornlg\relax
+ \edef\@horny{\the\@bmsum}
+ \else\if#1d\@bmsum=\@bmremb
+ \advance\@bmsum by -\@hornlg\relax
+ \edef\@hornx{\the\@bmsum}
+ \@bmsum=\@bmrema
+ \advance\@bmsum by \@hornlg\relax
+ \edef\@horny{\the\@bmsum}
+ \else\multiply\@bmsum by 3\relax
+ \edef\@hornlg{\the\@bmsum}
+ \if#1A\pbm@horn\@bmctmpa\@bmremb{-\@hornlg}
+ \else\if#1B\pbm@horn\@bmctmpc\@bmargb{\@hornlg}
+ \else\if#1C\pbm@horn\@bmctmpa\@bmrema{\@hornlg}
+ \else\if#1D\pbm@horn\@bmctmpc\@bmremb{-\@hornlg}
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \pbmfat(#2,#3){
+ \raise\@bmctmpb sp\hbox to\z@{
+ \special{pn \the\@bmremb}\special{sh 0}
+ \special{pa \the\@bmarga\space \the\@bmremb}
+ \if#1A\special{pa \@horni\space \the\@bmremb}
+ \special{pa \@hornx\space \@horny}
+ \special{pa \@hornii\space \the\@bmremb}\fi
+ \special{pa \the\@bmctmpa\space \the\@bmremb}
+ \if#1b\special{pa \@hornx\space \@horny}\fi
+ \special{pa \the\@bmargb\space \the\@bmarga}
+ \if#1B\special{pa \the\@bmargb\space \@horni}
+ \special{pa \@horny\space \@hornx}
+ \special{pa \the\@bmargb\space \@hornii}\fi
+ \special{pa \the\@bmargb\space \the\@bmctmpc}
+ \if#1c\special{pa \@hornx\space \@horny}\fi
+ \special{pa \the\@bmctmpa\space \the\@bmrema}
+ \if#1C\special{pa \@hornii\space \the\@bmrema}
+ \special{pa \@hornx\space \@horny}
+ \special{pa \@horni\space \the\@bmrema}\fi
+ \special{pa \the\@bmarga\space \the\@bmrema}
+ \if#1d\special{pa \@hornx\space \@horny}\fi
+ \special{pa \the\@bmremb\space \the\@bmctmpc}
+ \if#1D\special{pa \the\@bmremb\space \@hornii}
+ \special{pa \@horny\space \@hornx}
+ \special{pa \the\@bmremb\space \@horni}\fi
+ \special{pa \the\@bmremb\space \the\@bmarga}
+ \if#1a\special{pa \@hornx\space \@hornx}\fi
+ \special{pa \the\@bmarga\space \the\@bmremb}
+ \ifnum\@bmremb>0\special{fp}\else\special{ip}\fi
+ \if#1a\else\special{sh 0}
+ \special{ia \the\@bmarga\space \the\@bmarga\space
+ \CoRadius\space \CoRadius\space 0.0 6.28319}
+ \ifnum\@bmremb>0\special{ar \the\@bmarga\space \the\@bmarga\space
+ \CoRadius\space \CoRadius\space 3.14159 4.71239}\fi\fi
+ \if#1b\else\special{sh 0}
+ \special{ia \the\@bmctmpa\space \the\@bmarga\space
+ \CoRadius\space \CoRadius\space 0.0 6.28319}
+ \ifnum\@bmremb>0\special{ar \the\@bmctmpa\space \the\@bmarga\space
+ \CoRadius\space \CoRadius\space 4.71239 6.28319}\fi\fi
+ \if#1c\else\special{sh 0}
+ \special{ia \the\@bmctmpa\space \the\@bmctmpc\space
+ \CoRadius\space \CoRadius\space 0.0 6.28319}
+ \ifnum\@bmremb>0\special{ar \the\@bmctmpa\space \the\@bmctmpc\space
+ \CoRadius\space \CoRadius\space 0.0 1.5708}\fi\fi
+ \if#1d\else\special{sh 0}
+ \special{ia \the\@bmarga\space \the\@bmctmpc\space
+ \CoRadius\space \CoRadius\space 0.0 6.28319}
+ \ifnum\@bmremb>0\special{ar \the\@bmarga\space \the\@bmctmpc\space
+ \CoRadius\space \CoRadius\space 1.5708 3.14159}\fi\fi
+ }\hbox to\z@{\kern\the\@bmdarg\relax #4\hss}
+ }
+}
+\def\pbm@horn#1#2#3{
+ \@bmsum=#1\relax
+ \advance\@bmsum by \@bmarga
+ \divide\@bmsum by 2\relax
+ \advance\@bmsum by -\CoBase\relax
+ \edef\@horni{\the\@bmsum}
+ \advance\@bmsum by \CoBase\relax
+ \edef\@hornx{\the\@bmsum}
+ \advance\@bmsum by \CoBase\relax
+ \edef\@hornii{\the\@bmsum}
+ \@bmsum=#2\relax
+ \advance\@bmsum by #3\relax
+ \edef\@horny{\the\@bmsum}
+}
+%
+% GIF macros
+%
+\def\@setpbmorgsize#1{
+ \gif@search#1.
+ \set@orgsizetrue
+}
+\def\gif@search#1x#2.{\pbm@getbb#1 #2.}
+\def\giffile{\@ifnextchar[{\@giffile}{\@giffile[]}}
+\def\@giffile[#1]#2{{
+ \def\@setpbmfile##1{\def\@pbmfile{##1}}
+ \typeout{input GIF file}
+ \parse@pbm@parms{#2}
+ \ifset@orgsize
+ \bmcompute@handw
+ {\@bmarga=\@pbmwidth \divide\@bmarga by 186468\relax
+ \@bmargb=\@pbmheight \divide\@bmargb by 186468\relax
+ \message{becomes \the\@bmarga mm x \the\@bmargb mm}}
+ \else
+ \ifset@hscale\errmessage{gif(\@pbmfile): You must set orgsize option}\fi
+ \ifset@vscale\errmessage{gif(\@pbmfile): You must set orgsize option}\fi
+ \ifnum\@pbmheight<1\errmessage{gif(\@pbmfile): You should set the height}\fi
+ \ifnum\@pbmwidth<1\errmessage{gif(\@pbmfile): You should set the width}\fi
+ \fi
+ \@bmarga=\@pbmheight \divide\@bmarga by 65536\relax
+ \edef\@bmvsize{\number\@bmarga}
+ \@bmarga=\@pbmwidth \divide\@bmarga by 65536\relax
+ \edef\@bmhsize{\number\@bmarga}
+ \leavevmode
+ \hbox to \@pbmwidth sp{
+ \vrule\@width\z@\@height\@pbmheight sp\@depth\z@
+ \raise\@pbmheight sp
+ \hbox to\z@{
+ \ifrealscale
+ \special{giffile=\@pbmfile\space
+ \ifset@hscale hsize=\number\@pbmhsize dot/\the\pbmhdpi dpi
+ \else hsize=\@bmhsize\fi\space
+ \ifset@vscale vsize=\number\@pbmvsize dot/\the\pbmvdpi dpi
+ \else vsize=\@bmvsize\fi\space
+ }
+ \else
+ \special{pbmfile=\@pbmfile\space
+ \ifset@hscale hscale=\@pbmhscale
+ \else hsize=\@bmhsize\fi\space
+ \ifset@vscale vscale=\@pbmvscale
+ \else vsize=\@bmvsize\fi\space
+ }
+ \fi
+ }
+ \vrule\@width\z@\@height\@pbmheight sp \@depth\z@
+ \hbox to\z@{#1}\hfil
+ }
+}}
+\def\giffat{\pbmfat}
+\def\giffon{\pbmfon}
+\def\ovgiffon{\ovpbmfon}
+%
+\endlinechar=13\relax
+\endinput