Difference between revisions of "psFile(API)"
(Created page with "Objects/DataExpress/'''psFile''' is API for ps file. == constant == #define MAX_STRING_LENGTH 256 #define PS_FILE_STATUS_ERROR (0) #d...") |
(→Draw) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Objects/DataExpress/'''psFile''' is API for [[ | + | Objects/DataExpress/'''psFile''' is [[API]] for [[PostScript]] file. |
== constant == | == constant == | ||
+ | === Define of ps file === | ||
#define MAX_STRING_LENGTH 256 | #define MAX_STRING_LENGTH 256 | ||
Line 20: | Line 21: | ||
#define PROLOG_END_PRO (9) | #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 { | typedef enum psImageScaleMode { | ||
psImageScaleModeBottomLeft = 1, | psImageScaleModeBottomLeft = 1, | ||
Line 25: | Line 33: | ||
} psImageScaleMode; | } psImageScaleMode; | ||
− | + | Size | |
− | + | ||
− | + | ||
#define PS_IMAGE_SCALE_LINE_WIDTH0 (0.2) | #define PS_IMAGE_SCALE_LINE_WIDTH0 (0.2) | ||
#define PS_IMAGE_SCALE_LINE_WIDTH1 (0.1) | #define PS_IMAGE_SCALE_LINE_WIDTH1 (0.1) | ||
Line 41: | Line 47: | ||
#define PS_IMAGE_SCALE_LINE_LENGTH40 (-1.0) | #define PS_IMAGE_SCALE_LINE_LENGTH40 (-1.0) | ||
+ | === Draw Contour Mode === | ||
#define psContourMode_DifferentLineWidthContour (0x01) | #define psContourMode_DifferentLineWidthContour (0x01) | ||
#define psContourMode_SameLineWidthContour (0x02) | #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 (0x000000ff) | ||
#define PS_PLOT_MODE_AXIS_X_AXIS_POS (0x00000001) /* 0: Down 1: Up */ | #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_Y_AXIS_POS (0x00000002) /* 0: Left 1: Write */ | ||
#define PS_PLOT_MODE_AXIS (0x000000ff) | #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_DOWN ( -5.0) | ||
Line 58: | Line 68: | ||
== struct == | == struct == | ||
− | + | === Management data === | |
− | + | Manage ps file data by using list. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
typedef struct psFile { | typedef struct psFile { | ||
FILE* fpt; | FILE* fpt; | ||
Line 89: | Line 80: | ||
} psFile; | } psFile; | ||
+ | typedef long psParaTypeInteger; | ||
+ | typedef double psParaTypeReal; | ||
+ | |||
+ | === struct of Drawing Setting === | ||
typedef struct psImageInfo { | typedef struct psImageInfo { | ||
/* For Image Space */ | /* For Image Space */ | ||
Line 174: | Line 169: | ||
} psImageInfo; | } 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 { | typedef struct psPlotInfo { | ||
psParaTypeReal scaleX; | psParaTypeReal scaleX; | ||
Line 199: | Line 215: | ||
== API == | == API == | ||
− | === | + | === Initialize === |
+ | Create new ps file Information '''ps->info->prologInfo''' allocating memory, and create new ps file '''ps->fpt'''.<br> | ||
+ | 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 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); | extern void psFilePageStart(psFile* ps, psParaTypeInteger mode); | ||
+ | Write footer to ps file '''ps->fpt'''. | ||
extern void psFilePageEnd(psFile* ps, psParaTypeInteger mode); | extern void psFilePageEnd(psFile* ps, psParaTypeInteger mode); | ||
− | + | Write trailer to ps file '''ps->fpt'''. | |
− | + | ||
extern void psFileEnd(psFile* ps); | 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]]).<br> | ||
+ | |||
+ | ==== Image data ==== | ||
+ | Write an image data '''im.image''' to a ps file '''ps->fpt'''.<br> | ||
+ | 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"> | ||
+ | <tr> | ||
+ | <th>'''im''''s flag</th> | ||
+ | <th>Description</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>flagRGBColor</td> | ||
+ | <td>RGB format</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>flagRGBGradientColor</td> | ||
+ | <td>RGB(gradient) format</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>flagHSBColor</td> | ||
+ | <td>HSB format (Not implemented)</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>flagHSBGradientColor</td> | ||
+ | <td>HSB(gradient) format(Not implemented)</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>Otherwise</td> | ||
+ | <td>monochrome 256 gradation format</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | Flag at upper side takes priority, and they can't be combined.<br> | ||
+ | <br> | ||
+ | |||
+ | ==== 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); | 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); | |
− | extern void | + | <table border="1"> |
− | + | <tr> | |
− | + | <th>mode</th> | |
− | + | <th>value</th> | |
+ | <th>type of circle</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>PS_LINE_CIRCLE_MODE</td> | ||
+ | <td>0</td> | ||
+ | <td>Line circle</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>PS_FILL_WHITE_CIRCLE_MODE</td> | ||
+ | <td>1</td> | ||
+ | <td>Fill white circle</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>PS_FILL_BLACK_CIRCLE_MODE</td> | ||
+ | <td>2</td> | ||
+ | <td>Fill black circle</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | <br> | ||
− | === | + | ==== Line ==== |
+ | Set '''lineWidth''' to '''ps'''. | ||
extern void psFileLineWidthSet (psFile* ps, float lineWidth); | 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); | 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); | 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); | extern void psFileStringStatusSet(psFile* ps, char* fontname, double fontsize); | ||
+ | Set default font setting for '''ps'''. | ||
extern void psFileStringDefaultStatusSet(psFile* 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); | 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); | extern void psFileContour(psFile* ps, psImageInfo im, psParaTypeInteger mode); | ||
− | === | + | ==== Center marker ==== |
− | extern void | + | Draw a center marker to '''ps'''. |
+ | extern void psFileImageCentre (psFile* ps, psImageInfo im, psParaTypeInteger mode); | ||
− | === | + | ==== Scale ==== |
− | extern void | + | 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 ==== |
− | extern | + | About string and drawing, set the scale as ('''im.scaleX''', '''im.scaleY''')[pt], and set the origin as ('''im.translateX''', '''im.translateY''')[inch]. |
− | extern | + | 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); | ||
+ | <br> | ||
+ | Basically, these [[API]] uses the process sandwiching between ~Set and ~Restore. Then, Then, the only sandwiched process is affected by ~Set.<br> | ||
+ | <br> | ||
+ | Example | ||
+ | <pre> | ||
+ | psFileImageSpaceSet( Setting1 ) | ||
+ | (Process1) | ||
+ | psFileImageSpaceRotateSet( AngleSetting1 ) | ||
+ | (Process2) | ||
+ | psFileImageSpaceSet( Setting2 ) | ||
+ | (Process3) | ||
+ | psFileImageSpaceRestore( ... ) | ||
+ | (Process4) | ||
+ | psFileImageSpaceRotateRestore( ... ) | ||
+ | (Process5) | ||
+ | psFileImageSpaceRestore( ... ) | ||
+ | </pre> | ||
+ | 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> |
Latest revision as of 05:34, 9 October 2014
Objects/DataExpress/psFile is API for PostScript file.
Contents
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 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).