Difference between revisions of "psFile(API)"

From EosPedia
Jump to: navigation, search
(Draw)
 
(3 intermediate revisions by the same user not shown)
Line 216: Line 216:
 
== API ==
 
== API ==
 
=== Initialize ===
 
=== Initialize ===
psfileInformationps->info->prologInfoをメモリ確保して新規Createし,psfileps->fptを新規Createします.<br>
+
Create new ps file Information '''ps->info->prologInfo''' allocating memory, and create new ps file '''ps->fpt'''.<br>
また,以降で使用するPostScriptの略記Commandもここで定義しています.
+
In addition, define short [[PostScript]] commands to use these [[API]].
 
  extern void psFileInit(psFile* ps, psParaTypeInteger mode);
 
  extern void psFileInit(psFile* ps, psParaTypeInteger mode);
  
=== file読み出し ===
+
=== File Read ===
filefptを読み出し,psへ格納します.
+
Read a file '''fpt''', and store to '''ps'''.
 
  extern void psFileRead(psFile* ps, FILE* fpt, long mode);
 
  extern void psFileRead(psFile* ps, FILE* fpt, long mode);
  
=== Header・フッタ・トレイラのWrite ===
+
=== Write Header, Footer, Trailer ===
psfileps->fptにHeaderをWriteます.(ラベル: ps->info.label, ページNo.: ps->info.page)
+
Write header to ps file '''ps->fpt'''. (Label: '''ps->info.label''', Page No.: '''ps->info.page''')
mode=0の場合は左下部から各1cmずつ右上の位置を,そうでない場合は左下部の位置を原点とします.
+
If mode=0, set the origin to a point at side of each 1 cm right top  from the left bottom end. Otherwise, set the origin to the left bottom end point.
 
  extern void psFilePageStart(psFile* ps, psParaTypeInteger mode);
 
  extern void psFilePageStart(psFile* ps, psParaTypeInteger mode);
psfileps->fptにフッタをWriteます.
+
Write footer to ps file '''ps->fpt'''.
 
  extern void psFilePageEnd(psFile* ps, psParaTypeInteger mode);
 
  extern void psFilePageEnd(psFile* ps, psParaTypeInteger mode);
psfileps->fptにトレイラを追加します.
+
Write trailer to ps file '''ps->fpt'''.
 
  extern void psFileEnd(psFile* ps);
 
  extern void psFileEnd(psFile* ps);
  
=== data判定 ===
+
=== Check data ===
文字列sがHeaderの場合は1を,そうでない場合は0を返します.
+
If string '''s''' is Header, return 1. Otherwise, return 0.
 
  extern long psFileIsStartPage(psFile* ps, char* s);
 
  extern long psFileIsStartPage(psFile* ps, char* s);
文字列sがフッタの場合は1を,そうでない場合は0を返します.
+
If string '''s''' is Footer, return 1. Otherwise, return 0.
 
  extern long psFileIsEndPage(psFile* ps, char* s);
 
  extern long psFileIsEndPage(psFile* ps, char* s);
  
=== 描画 ===
+
=== Draw ===
基本的にこれらの[[API]]は引数psImageInfoの([[#描画Setting]])を使用したSettingで描画します.<br>
+
Basically, these [[API]] draw with setting by argument '''psImageInfo''' or ([[#Drawing Setting]]).<br>
<br>
+
  
==== 画像data ====
+
==== Image data ====
画像dataim.imageをpsfileps->fptへWriteます.<br>
+
Write an image data '''im.image''' to a ps file '''ps->fpt'''.<br>
フラグ(imのメンバ)によって画像の種類をSettingできます.
+
You can select an image format by the flag ('''im''''s member).
 
  extern void psFileImage            (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImage            (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
<table border="1">
 
<table border="1">
 
<tr>  
 
<tr>  
<th>imのフラグ</th>  
+
<th>'''im''''s flag</th>  
 
<th>Description</th>  
 
<th>Description</th>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>flagRGBColor</td>  
 
<td>flagRGBColor</td>  
<td>RGB形式で書き込む</td>  
+
<td>RGB format</td>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>flagRGBGradientColor</td>  
 
<td>flagRGBGradientColor</td>  
<td>RGB(グラデーション)形式で書き込む</td>  
+
<td>RGB(gradient) format</td>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>flagHSBColor</td>  
 
<td>flagHSBColor</td>  
<td>HSB形式で書き込む(未対応)</td>  
+
<td>HSB format (Not implemented)</td>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>flagHSBGradientColor</td>  
 
<td>flagHSBGradientColor</td>  
<td>HSB(グラデーション)形式で書き込む(未対応)</td>  
+
<td>HSB(gradient) format(Not implemented)</td>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>Otherwise</td>  
 
<td>Otherwise</td>  
<td>モノクロ256階調形式で書き込む</td>  
+
<td>monochrome 256 gradation format</td>  
 
</tr>  
 
</tr>  
 
</table>
 
</table>
各フラグは上の方が優先され,重複はしない.<br>
+
Flag at upper side takes priority, and they can't be combined.<br>
 
<br>
 
<br>
  
==== ====
+
==== Circle ====
im.image内の正のdataを半径[pt]とした円をcoordinates(im.width, imheight)[pt]まで描画します.
+
Draw circles whose radius[pt] is the positive data in '''im.image'''. (range: (im.width, imheight)[pt])
 
  extern void psFileImageByCircles  (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageByCircles  (psFile* ps, psImageInfo im, psParaTypeInteger mode);
psに中心(cx, cy)[pt],半径r[pt]の円を描画します.modeにより円のタイプが選択できます.
+
Draw a circle to '''ps'''. The centre is ('''cx''', '''cy''')[pt], and the radius is '''r'''[pt]. Then, you can select a type of circle by using '''mode'''.
 
  extern void psFileCircleCreate(psFile* ps, float cx, float cy, float r, long mode);
 
  extern void psFileCircleCreate(psFile* ps, float cx, float cy, float r, long mode);
 
<table border="1">
 
<table border="1">
 
<tr>  
 
<tr>  
 
<th>mode</th>  
 
<th>mode</th>  
<th></th>  
+
<th>value</th>  
<th>円のタイプ</th>  
+
<th>type of circle</th>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>PS_LINE_CIRCLE_MODE</td>  
 
<td>PS_LINE_CIRCLE_MODE</td>  
 
<td>0</td>  
 
<td>0</td>  
<td>塗りつぶしなし</td>  
+
<td>Line circle</td>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>PS_FILL_WHITE_CIRCLE_MODE</td>  
 
<td>PS_FILL_WHITE_CIRCLE_MODE</td>  
 
<td>1</td>  
 
<td>1</td>  
<td>白で塗りつぶす</td>  
+
<td>Fill white circle</td>  
 
</tr>  
 
</tr>  
 
<tr>  
 
<tr>  
 
<td>PS_FILL_BLACK_CIRCLE_MODE</td>  
 
<td>PS_FILL_BLACK_CIRCLE_MODE</td>  
 
<td>2</td>  
 
<td>2</td>  
<td>黒で塗りつぶす</td>  
+
<td>Fill black circle</td>  
 
</tr>  
 
</tr>  
 
</table>
 
</table>
 
<br>
 
<br>
  
==== ====
+
==== Line ====
psに描画する線のWidthlineWidthをSettingします.
+
Set '''lineWidth''' to '''ps'''.
 
  extern void psFileLineWidthSet    (psFile* ps, float lineWidth);
 
  extern void psFileLineWidthSet    (psFile* ps, float lineWidth);
psに線(x1, y1) -> (x2, y2)を描画します.
+
Draw a line (x1, y1) -> (x2, y2) to '''ps'''.
 
  extern void psFileLineDraw(psFile* ps, float x1,float y1,float x2,float y2);
 
  extern void psFileLineDraw(psFile* ps, float x1,float y1,float x2,float y2);
  
==== 樹形図 ====
+
==== Dendrogram ====
psに2つの点をつなぐ樹形図を描画します.
+
Draw a dendrogram which connects 2 points, to '''ps'''.
width: 2点間の距離(Width), heightN: 要素Nに引く線の長さ(高さ)(N=1, 2), (x, y): 上段に引く線の中点
+
'''width''': Distance between 2 points, heightN: Length of line from point N(N=1, 2), (x, y): Center point on upper line
 
  extern void psFileDendgramLineDraw(psFile* ps, float width,float height1, float height2, float x, float y);
 
  extern void psFileDendgramLineDraw(psFile* ps, float width,float height1, float height2, float x, float y);
  
==== 文字列 ====
+
==== String ====
psに表示する文字列のフォントfontname,サイズfontsizeをSettingします.
+
Set '''fontname''', '''fontsize''' for '''ps'''.
 
  extern void psFileStringStatusSet(psFile* ps, char* fontname, double fontsize);
 
  extern void psFileStringStatusSet(psFile* ps, char* fontname, double fontsize);
psに表示する文字列のフォント・サイズをデフォルトSettingします.
+
Set default font setting for '''ps'''.
 
  extern void psFileStringDefaultStatusSet(psFile* ps);
 
  extern void psFileStringDefaultStatusSet(psFile* ps);
psに文字列messageをcoordinates(x, y)[pt]に表示します.
+
Write '''message''' at the coordinates(x, y)[pt] to '''ps'''.
 
  extern void psFileString (psFile* ps, char* message, double x, double y, psParaTypeInteger mode);
 
  extern void psFileString (psFile* ps, char* message, double x, double y, psParaTypeInteger mode);
  
==== 境界線 ====
+
==== Contour ====
psに画像im.floatimageの境界線を描画します.
+
Draw a contour line of '''im.floatimage''' to '''ps'''.
 
  extern void psFileContour(psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileContour(psFile* ps, psImageInfo im, psParaTypeInteger mode);
  
==== 中心マーカ ====
+
==== Center marker ====
psに中心マーカを描画します.
+
Draw a center marker to '''ps'''.
 
  extern void psFileImageCentre      (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageCentre      (psFile* ps, psImageInfo im, psParaTypeInteger mode);
  
==== スケール ====
+
==== Scale ====
psにスケールを描画します.mode=psImageScaleModeBottomLeftの場合は左下部に,mode=psImageScaleModeCenterの場合は左中部に描画します.
+
Draw a scale to '''ps'''. If mode=psImageScaleModeBottomLeft, draw at left bottom. if  mode=psImageScaleModeCenter, draw at left center.
 
  extern void psFileImageScale      (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageScale      (psFile* ps, psImageInfo im, psParaTypeInteger mode);
  
==== 描画Setting ====
+
==== Drawing Setting ====
文字及び点のスケールを(im.scaleX, im.scaleY)[pt],原点を(im.translateX, im.translateY)[inch]とします.
+
About string and drawing, set the scale as ('''im.scaleX''', '''im.scaleY''')[pt], and set the origin as ('''im.translateX''', '''im.translateY''')[inch].
 
  extern void psFileImageSpaceSet    (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageSpaceSet    (psFile* ps, psImageInfo im, psParaTypeInteger mode);
文字及び点のスケール,原点を元に戻します.
+
About string and drawing, restore the scale and the origin.
 
  extern void psFileImageSpaceRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageSpaceRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);
文字及び点の回転角度im.angleをSettingします.
+
About string and drawing, set the rotation angle as '''im.angle'''.
 
  extern void psFileImageSpaceRotateSet    (psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageSpaceRotateSet    (psFile* ps, psImageInfo im, psParaTypeInteger mode);
文字及び点の回転角度を元に戻します.
+
About string and drawing, restore the rotation angle.
 
  extern void psFileImageSpaceRotateRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
  extern void psFileImageSpaceRotateRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);
 
<br>
 
<br>
これらの[[API]]は基本的に同じ~Setと~Restoreで処理を挟んで使用します.このとき,挟まれた処理にのみ~SetでのSettingが反映されます.<br>
+
Basically, these [[API]] uses the process sandwiching between ~Set and ~Restore. Then, Then, the only sandwiched process is affected by ~Set.<br>
 
<br>
 
<br>
使用Example
+
Example
 
<pre>
 
<pre>
 
psFileImageSpaceSet( Setting1 )
 
psFileImageSpaceSet( Setting1 )
(処理1)
+
(Process1)
psFileImageSpaceRotateSet( 角度Setting1 )
+
psFileImageSpaceRotateSet( AngleSetting1 )
(処理2)
+
(Process2)
 
psFileImageSpaceSet( Setting2 )
 
psFileImageSpaceSet( Setting2 )
(処理3)
+
(Process3)
 
psFileImageSpaceRestore( ... )
 
psFileImageSpaceRestore( ... )
(処理4)
+
(Process4)
 
psFileImageSpaceRotateRestore( ... )
 
psFileImageSpaceRotateRestore( ... )
(処理5)
+
(Process5)
 
psFileImageSpaceRestore( ... )
 
psFileImageSpaceRestore( ... )
 
</pre>
 
</pre>
このExampleで,(Setting1)の有効範囲は(処理1) ~ (処理5),(角度Setting1)の有効範囲は(処理2) ~ (処理4),(Setting2)の有効範囲は(処理3)となっています.但し,(処理3)のスケール・原点については(Setting2)の方が(Setting1)よりも後にSettingされているので,こちらが反映されます.<br>
+
On this example, the effect range of (Setting1) is (Process1) ~ (Process5). Next, the effect range of (Angle Setting1) is (Process2) ~ (Process4). Finally, the effect range of (Setting2) is (Process3). However, the scaleand origin of (Process3) is affected by (Setting2), because it is set after (Setting1).<br>
 
<br>
 
<br>

Latest revision as of 05:34, 9 October 2014

Objects/DataExpress/psFile is API for PostScript file.

constant

Define of ps file

#define MAX_STRING_LENGTH 256
                            
#define PS_FILE_STATUS_ERROR     (0)
#define PS_FILE_STATUS_OK        (1)
#define PROLOG_STRING_NUM    (11)
#define PROLOG_VERSION        (0)
#define PROLOG_TITLE          (1)
#define PROLOG_CREATOR        (2)
#define PROLOG_CREATION_DATE  (3)
#define PROLOG_FOR            (4)
#define PROLOG_BOUND_BOX      (5)
#define PROLOG_PAGES          (6)
#define PROLOG_DOC_FONTS      (7)
#define PROLOG_END_DOC        (8)
#define PROLOG_END_PRO        (9)

Draw Center marker

Size

#define PS_IMAGE_CENTRE_LINE_WIDTH  (0.1)
#define PS_IMAGE_CENTRE_MARK_LENGTH (0.01)

Draw Scale

Position

typedef enum psImageScaleMode {
    psImageScaleModeBottomLeft = 1,
    psImageScaleModeCenter     = 2
} psImageScaleMode;

Size

#define PS_IMAGE_SCALE_LINE_WIDTH0 (0.2)
#define PS_IMAGE_SCALE_LINE_WIDTH1 (0.1)
#define PS_IMAGE_SCALE_LINE_LENGTH0 (10.0)
#define PS_IMAGE_SCALE_LINE_LENGTH1 (5.0)
#define PS_IMAGE_SCALE_LINE_LENGTH2 (3.0)
#define PS_IMAGE_SCALE_LINE_LENGTH3 (2.0)
#define PS_IMAGE_SCALE_LINE_LENGTH4 (1.0)
#define PS_IMAGE_SCALE_LINE_LENGTH00 (-10.0)
#define PS_IMAGE_SCALE_LINE_LENGTH10 (-5.0)
#define PS_IMAGE_SCALE_LINE_LENGTH20 (-3.0)
#define PS_IMAGE_SCALE_LINE_LENGTH30 (-2.0)
#define PS_IMAGE_SCALE_LINE_LENGTH40 (-1.0)

Draw Contour Mode

#define psContourMode_DifferentLineWidthContour (0x01)
#define psContourMode_SameLineWidthContour      (0x02)

Draw Circle

Type

#define PS_LINE_CIRCLE_MODE (0)
#define PS_FILL_WHITE_CIRCLE_MODE (1)
#define PS_FILL_BLACK_CIRCLE_MODE (2)

Plot

#define PS_PLOT_MODE_AXIS (0x000000ff)
#define PS_PLOT_MODE_AXIS_X_AXIS_POS (0x00000001) /* 0: Down 1: Up */
#define PS_PLOT_MODE_AXIS_Y_AXIS_POS (0x00000002) /* 0: Left 1: Write */
#define PS_PLOT_MODE_AXIS (0x000000ff)
#define PS_PLOT_SCALE_X_AXIS_Y_POSITION_DOWN ( -5.0)
#define PS_PLOT_SCALE_X_AXIS_Y_POSITION_UP   (105.0)
#define PS_PLOT_SCALE_X_AXIS_LENGTH     (1.0)

struct

Management data

Manage ps file data by using list.

typedef struct psFile {
	FILE* fpt;
	psInfo info;
	long headEnd;
	psPageInfo* current;
	psPageInfo* top;
	psPageInfo* end;
	long byte;
} psFile;
typedef long   psParaTypeInteger;
typedef double psParaTypeReal;

struct of Drawing Setting

typedef struct psImageInfo {
	/* For Image Space */
	psParaTypeReal scaleX;
	psParaTypeReal scaleY;
	psParaTypeReal translateX;
	psParaTypeReal translateY;
	psParaTypeReal angle;

	/* Image Size */
	psParaTypeInteger width;
	psParaTypeInteger height;
	psParaTypeInteger section;
	/* For Contour */
	psParaTypeInteger bps;
	psParaTypeInteger nContour;
	psParaTypeReal* contourLevel;
	/* For Density Image */
	unsigned char* image;
	/* For Contour */
	float* floatImage;
	psParaTypeReal contourLineColorChange;
	psParaTypeReal contourLineWidthStart;
	psParaTypeReal contourLineWidthStep;

	/* For 3D Contour */
	psParaTypeReal eyeX; /* Eye Position */
	psParaTypeReal eyeY;
	psParaTypeReal eyeZ;
	psParaTypeReal pointX; /* Projection Surface Position */
	psParaTypeReal pointY; /* Surface Normal: (position - eye) */
	psParaTypeReal pointZ;

	/* For Colour */
	psParaTypeInteger flagRGBColor;	
	psParaTypeInteger flagRGBGradientColor;	
	psParaTypeReal Red;
	psParaTypeReal Green;
	psParaTypeReal Blue;
	psParaTypeReal RedFirst;
	psParaTypeReal GreenFirst;
	psParaTypeReal BlueFirst;
	psParaTypeReal RedLast;
	psParaTypeReal GreenLast;
	psParaTypeReal BlueLast;
	psParaTypeInteger flagHSBColor;	
	psParaTypeInteger flagHSBGradientColor;	
	psParaTypeReal Hue;
	psParaTypeReal Saturation;
	psParaTypeReal Brightness;
	psParaTypeReal HueFirst;
	psParaTypeReal SaturationFirst;
	psParaTypeReal BrightnessFirst;
	psParaTypeReal HueLast;
	psParaTypeReal SaturationLast;
	psParaTypeReal BrightnessLast;

	/* For Line Colour */
	psParaTypeInteger flagLineRGBColor;	
	psParaTypeInteger flagLineRGBGradientColor;	
	psParaTypeReal LineRed;
	psParaTypeReal LineGreen;
	psParaTypeReal LineBlue;
	psParaTypeReal LineRedFirst;
	psParaTypeReal LineGreenFirst;
	psParaTypeReal LineBlueFirst;
	psParaTypeReal LineRedLast;
	psParaTypeReal LineGreenLast;
	psParaTypeReal LineBlueLast;
	psParaTypeInteger flagLineHSBColor;	
	psParaTypeInteger flagLineHSBGradientColor;	
	psParaTypeReal LineHue;
	psParaTypeReal LineSaturation;
	psParaTypeReal LineBrightness;
	psParaTypeReal LineHueFirst;
	psParaTypeReal LineSaturationFirst;
	psParaTypeReal LineBrightnessFirst;
	psParaTypeReal LineHueLast;
	psParaTypeReal LineSaturationLast;
	psParaTypeReal LineBrightnessLast;

	/* For Circle */
	psParaTypeReal CircleRadius;
	long dummy;
} psImageInfo;

ps file Information

typedef struct psInfo {
    psParaTypeInteger prologInfoNum;
    char**            prologInfo;
	char              label[MAX_STRING_LENGTH];
    psParaTypeInteger page;
    psParaTypeInteger status;
} psInfo;

Page Information

typedef struct psPageInfo psPageInfo;
struct psPageInfo {
	psParaTypeInteger page;
	psParaTypeInteger byte;
	long start;
	long end;
	psPageInfo* next;
};

Plot

typedef struct psPlotInfo {
    psParaTypeReal scaleX;
    psParaTypeReal scaleY;
    psParaTypeReal translateX;
    psParaTypeReal translateY;

    psParaTypeReal dX;
    psParaTypeReal dXValue;
    psParaTypeReal minX;
    psParaTypeReal centreX;
    psParaTypeReal maxX;
    char*          labelX;

    psParaTypeReal dY;
    psParaTypeReal dYValue;
    psParaTypeReal minY;
    psParaTypeReal centreY;
    psParaTypeReal maxY;
    char*          labelY;

    psParaTypeInteger nData;
    psParaTypeReal *data;
} psPlotInfo;

API

Initialize

Create new ps file Information ps->info->prologInfo allocating memory, and create new ps file ps->fpt.
In addition, define short PostScript commands to use these API.

extern void psFileInit(psFile* ps, psParaTypeInteger mode);

File Read

Read a file fpt, and store to ps.

extern void psFileRead(psFile* ps, FILE* fpt, long mode);

Write Header, Footer, Trailer

Write header to ps file ps->fpt. (Label: ps->info.label, Page No.: ps->info.page) If mode=0, set the origin to a point at side of each 1 cm right top from the left bottom end. Otherwise, set the origin to the left bottom end point.

extern void psFilePageStart(psFile* ps, psParaTypeInteger mode);

Write footer to ps file ps->fpt.

extern void psFilePageEnd(psFile* ps, psParaTypeInteger mode);

Write trailer to ps file ps->fpt.

extern void psFileEnd(psFile* ps);

Check data

If string s is Header, return 1. Otherwise, return 0.

extern long psFileIsStartPage(psFile* ps, char* s);

If string s is Footer, return 1. Otherwise, return 0.

extern long psFileIsEndPage(psFile* ps, char* s);

Draw

Basically, these API draw with setting by argument psImageInfo or (#Drawing Setting).

Image data

Write an image data im.image to a ps file ps->fpt.
You can select an image format by the flag (im's member).

extern void psFileImage            (psFile* ps, psImageInfo im, psParaTypeInteger mode);
im's flag Description
flagRGBColor RGB format
flagRGBGradientColor RGB(gradient) format
flagHSBColor HSB format (Not implemented)
flagHSBGradientColor HSB(gradient) format(Not implemented)
Otherwise monochrome 256 gradation format

Flag at upper side takes priority, and they can't be combined.

Circle

Draw circles whose radius[pt] is the positive data in im.image. (range: (im.width, imheight)[pt])

extern void psFileImageByCircles   (psFile* ps, psImageInfo im, psParaTypeInteger mode);

Draw a circle to ps. The centre is (cx, cy)[pt], and the radius is r[pt]. Then, you can select a type of circle by using mode.

extern void psFileCircleCreate(psFile* ps, float cx, float cy, float r, long mode);
mode value type of circle
PS_LINE_CIRCLE_MODE 0 Line circle
PS_FILL_WHITE_CIRCLE_MODE 1 Fill white circle
PS_FILL_BLACK_CIRCLE_MODE 2 Fill black circle


Line

Set lineWidth to ps.

extern void psFileLineWidthSet     (psFile* ps, float lineWidth);

Draw a line (x1, y1) -> (x2, y2) to ps.

extern void psFileLineDraw(psFile* ps, float x1,float y1,float x2,float y2);

Dendrogram

Draw a dendrogram which connects 2 points, to ps. width: Distance between 2 points, heightN: Length of line from point N(N=1, 2), (x, y): Center point on upper line

extern void psFileDendgramLineDraw(psFile* ps, float width,float height1, float height2, float x, float y);

String

Set fontname, fontsize for ps.

extern void psFileStringStatusSet(psFile* ps, char* fontname, double fontsize);

Set default font setting for ps.

extern void psFileStringDefaultStatusSet(psFile* ps);

Write message at the coordinates(x, y)[pt] to ps.

extern void psFileString (psFile* ps, char* message, double x, double y, psParaTypeInteger mode);

Contour

Draw a contour line of im.floatimage to ps.

extern void psFileContour(psFile* ps, psImageInfo im, psParaTypeInteger mode);

Center marker

Draw a center marker to ps.

extern void psFileImageCentre      (psFile* ps, psImageInfo im, psParaTypeInteger mode);

Scale

Draw a scale to ps. If mode=psImageScaleModeBottomLeft, draw at left bottom. if mode=psImageScaleModeCenter, draw at left center.

extern void psFileImageScale       (psFile* ps, psImageInfo im, psParaTypeInteger mode);

Drawing Setting

About string and drawing, set the scale as (im.scaleX, im.scaleY)[pt], and set the origin as (im.translateX, im.translateY)[inch].

extern void psFileImageSpaceSet    (psFile* ps, psImageInfo im, psParaTypeInteger mode);

About string and drawing, restore the scale and the origin.

extern void psFileImageSpaceRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);

About string and drawing, set the rotation angle as im.angle.

extern void psFileImageSpaceRotateSet    (psFile* ps, psImageInfo im, psParaTypeInteger mode);

About string and drawing, restore the rotation angle.

extern void psFileImageSpaceRotateRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);


Basically, these API uses the process sandwiching between ~Set and ~Restore. Then, Then, the only sandwiched process is affected by ~Set.

Example

psFileImageSpaceSet( Setting1 )
	(Process1)
	psFileImageSpaceRotateSet( AngleSetting1 )
		(Process2)
		psFileImageSpaceSet( Setting2 )
			(Process3)
		psFileImageSpaceRestore( ... )
		(Process4)
	psFileImageSpaceRotateRestore( ... )
	(Process5)
psFileImageSpaceRestore( ... )

On this example, the effect range of (Setting1) is (Process1) ~ (Process5). Next, the effect range of (Angle Setting1) is (Process2) ~ (Process4). Finally, the effect range of (Setting2) is (Process3). However, the scaleand origin of (Process3) is affected by (Setting2), because it is set after (Setting1).