//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // "elib.h" // Encapsulatex PostScript 生成システム // Copyright(C) by Naoki Watanabe. // All rights reserved. // Last revised on Sep 7th, 1998. //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* #ifndef __ELIB_H_INCLUDE #define __ELIB_H_INCLUDE #include #include #ifndef _XLIB_H_ #define CoordModeOrigin 0 #define CoordModePrevious 1 typedef struct _XDisplay{} Display; typedef struct { short x, y; } XPoint; #endif // _XLIB_H_ // font_noのシンボル #ifndef EFLIB_FONT_SYMBOLS #define EFLIB_FONT_SYMBOLS #define TIMES_ROMAN 0 #define TIMES_ITALIC 1 #define TIMES_BOLD 2 #define TIMES_BOLDITALIC 3 #endif //EFLIB_FONT_SYMBOLS //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // EPS用GCの制御機構の定義 //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //---- Graphic Context 管理構造体 EPSGCValues struct EPSGCValues { int foreground; // foreground pixel [0--255] default 0 black int background; // background pixel [0--255] default 1 int font_no; // font No default 0 "Times-Roman" int font_size; // font size default 12 }; //---- Graphic Context 管理構造体へのポインタ EPSGC typedef EPSGCValues *EPSGC; //---- EPS 管理構造体 EPSIDValues struct EPSIDValues { FILE* fptr; EPSGC cugc; double DOT2PT; inline int Pt( int dot ){ // 0.125ptを単位にする return( int(dot*DOT2PT*8) ); } }; //---- EPS 管理構造体へのポインタ EPSID typedef EPSIDValues *EPSID; EPSGC ECreateEPSGC( Display*, EPSID, u_long, EPSGCValues* ); //---- EPSGCを生成して初期化する関数 ------------- // Display* には NULLを与えてください。何も意味はありません。 // この関数は EPSGCValues構造体をmallocして初期値に // 設定して、そのアドレスを EPSGC型として返します。 //------------------------------------------------ void EFreeEPSGC( Display*, EPSGC egc ); //---- EPSGCを解放する関数 ----------------------- // egcの指すEPSGCValues構造体のメモリ領域を解放します。 //------------------------------------------------ void ESetForeground( Display*, EPSGC egc, u_long _fg ); //---- EPSGCにForeground色を設定する関数 -------- // Xlibと同じようにpixel値を指定してください。 // 先にEDefineColor()でそのpixel値のRGB輝度を登録しておいてください。 //------------------------------------------------ void ESetFont( Display*, EPSGC egc, int _font_no, int _font_size ); //---- FIGGCに fontを設定する関数 ---------------- // _font_no には先に定義したfont_noのシンボルのdefine定数を指定。 //------------------------------------------------ //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* // EPS描画関数の定義 //=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //***** [注意] ここの関数群の長さの変数の単位は window dot です。***** EPSID ECreateFile( Display*, const char* fname, u_int win_width, u_int win_height, u_int eps_width, u_int eps_height ); //---- EPSを開けて初期化する関数 ----------------- // win_* にはXlibの窓を想定してのその大きさをdot単位で指定。 // eps_* にはEPSの大きさを mm単位で指定。 // 2者が相似でない場合には eps_widthが優先される。 //------------------------------------------------ void ECloseFile( Display*, EPSID eps ); //---- EPSを閉じる関数 --------------------------- void EDrawEPSGC( EPSID eps, EPSGC egc ); //---- EPSGCを出力する関数 ----------------------- void EDefineColor( EPSID eps, EPSGC egc, u_long pixel, u_short red, u_short green, u_short blue ); //---- 色を登録する関数 void EDrawPoint( Display*, EPSID eps, EPSGC egc, int _x, int _y ); //---- 点を描く関数 ------------------------------ void EDrawLine( Display*, EPSID eps, EPSGC egc, int _x1, int _y1, int _x2, int _y2 ); //---- 線分を描く関数 ---------------------------- void EDrawRectangle( Display*, EPSID eps, EPSGC egc, int _xo, int _yo, u_int _w, u_int _h ); void EFillRectangle( Display*, EPSID eps, EPSGC egc, int _xo, int _yo, u_int _w, u_int _h ); //---- 長方形を描く/塗る関数 --------------------- // 長方形の左上の座標と縦横の長さを指定します。 //------------------------------------------------ void EDrawLines( Display*, EPSID eps, EPSGC egc, XPoint _p[], int _np, int _mode ); void EDrawPolygon( Display*, EPSID eps, EPSGC egc, XPoint p[], int np, int mode ); void EFillPolygon( Display*, EPSID eps, EPSGC egc, XPoint _p[], int _np, int _shape, int _mode ); //---- 多角形を描く/塗る関数 --------------------- // XPoint型はXlibで定めるもの。_npは点の総数。 // 終点と始点が結ばれます。 // _shape は PolyConvexのみ。 // _modeは CoordModeOrigin, CoordModePrevious //------------------------------------------------ void EDrawArc( Display*, EPSID eps, EPSGC egc, int _xo, int _yo, u_int _width, u_int _height, int _ang1, int _ang2 ); void EFillArc( Display*, EPSID eps, EPSGC egc, int _xo, int _yo, u_int _width, u_int _height, int _ang1, int _ang2 ); //---- 円/楕円弧を描く/塗る関数 ------------------ // 楕円を納める長方形の左上の座標と縦横の長さを指定します。 // ang1, ang2は意味を持たず、真円、真楕円のみを描く //------------------------------------------------ void EDrawString( Display*, EPSID eps, EPSGC egc, int _x, int _y, const char* _str, int _len ); //---- 文字を描く関数(英数字のみ) ---------------- // この関数を呼ぶ前には一度 FSetFont 関数で // fontを指定しておかなければなりません。 //------------------------------------------------ #endif // __ELIB_H_INCLUDE