spBase
Loading...
Searching...
No Matches
spPSFile.h
Go to the documentation of this file.
1
4#ifndef __SPPSFILE_H
5#define __SPPSFILE_H
6
7#include <sp/spDefs.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define SP_PS_DEFAULT 0L
14#define SP_PS_MONO (1L<<1) /* monochrome output */
15#define SP_PS_LANDSCAPE (1L<<2) /* use langscape mode instead of portrait mode */
16#define SP_PS_EPS (1L<<3) /* EPS file */
17#define SP_PS_HALF_SIZE (1L<<4) /* use half size output. margin will not be half */
18#define SP_PS_SCREEN_COORDINATE (1L<<5) /* use screen coordinate instead of Cartesian coordinate */
19#define SP_PS_DOUBLE_SIDED (1L<<8) /* use double-sided printing */
20#define SP_PS_TUMBLE (1L<<9) /* tumble option for double-sided printing */
21
22typedef enum {
23 SP_PS_LINE_NONE = -1,
24 SP_PS_LINE_SOLID = 0,
25 SP_PS_LINE_DASH = 1,
26 SP_PS_LINE_DOT = 2,
27 SP_PS_LINE_DASH_DOT = 3,
28 SP_PS_LINE_DASH_DOT_DOT = 4,
29 SP_PS_LINE_BORDER = 10,
30 SP_PS_LINE_GRID = 11,
31} spPSLineType;
32
33typedef enum {
34 SP_PS_ALIGNMENT_BEGINNING = 0,
35 SP_PS_ALIGNMENT_CENTER = 1,
36 SP_PS_ALIGNMENT_END = 2,
37} spPSAlignment;
38
39typedef long spPSPolygonId;
40#define SP_PS_POLYGON_NONE 0L
41
42
43#define SP_PS_DEFAULT_CREATOR "spPSFile"
44#define SP_PS_DEFAULT_LANG "C"
45#define SP_PS_DEFAULT_FONT "Helvetica"
46#define SP_PS_DEFAULT_FONT_SIZE 14
47#define SP_PS_DEFAULT_MARGIN_MM 20 /* default margin is 20 mm (for left and bottom) */
48
49/* the following fonts are used when lang by spPSSetLang is
50 Japanese one such as "ja_JP.SJIS" and "ja_JP.eucJP" */
51#define SP_PS_DEFAULT_SJIS_FONT "Ryumin-Light-RKSJ-H"
52#define SP_PS_DEFAULT_SJIS_GOTHIC_FONT "GothicBBB-Medium-RKSJ-H"
53#define SP_PS_DEFAULT_EUCJP_FONT "Ryumin-Light-EUC-H"
54#define SP_PS_DEFAULT_EUCJP_GOTHIC_FONT "GothicBBB-Medium-EUC-H"
55#define SP_PS_DEFAULT_UTF8JP_FONT "Ryumin-Light-UniJIS-UTF8-H"
56#define SP_PS_DEFAULT_UTF8JP_GOTHIC_FONT "GothicBBB-Medium-UniJIS-UTF8-H"
57
58typedef struct _spPSFile spPSFile;
59
60#if defined(MACOS)
61#pragma import on
62#endif
63
64/* conversion between milli meter <--> point */
65extern double spPSMMToPoint(double mm);
66extern double spPSPointToMM(double point);
67
68/* width and height here do not include margins */
69extern spPSFile *spPSOpenFile(const char *filename, double client_width_mm, double client_height_mm, unsigned long options);
70extern spBool spPSCloseFile(spPSFile *psfile);
71
72/* following four functions must be called before drawing */
73extern spBool spPSSetNumCopies(spPSFile *psfile, int num_copies, spBool collate);
74extern spBool spPSSetScalingFactor(spPSFile *psfile, double xfactor, double yfactor);
75extern spBool spPSSetMargin(spPSFile *psfile, double left_margin_mm, double bottom_margin_mm);
76extern spBool spPSSetCreator(spPSFile *psfile, const char *creator);
77
78extern spBool spPSGetClientSize(spPSFile *psfile, int *width, int *height);
79extern spBool spPSGetPhisicalSize(spPSFile *psfile, double *client_width_mm, double *client_height_mm);
80extern spBool spPSStartDrawing(spPSFile *psfile);
81extern spBool spPSEndDrawing(spPSFile *psfile);
82extern spBool spPSForwardPage(spPSFile *psfile);
83
84extern spBool spPSSetLang(spPSFile *psfile, const char *lang);
85extern spBool spPSSetLineType(spPSFile *psfile, spPSLineType line_type);
86extern spBool spPSSetLineWidth(spPSFile *psfile, int width);
87extern spBool spPSSetRGBColor(spPSFile *psfile, double r, double g, double b);
88extern spBool spPSSetFontSize(spPSFile *psfile, int size);
89extern int spPSGetFontSize(spPSFile *psfile);
90extern spBool spPSSetFont(spPSFile *psfile, const char *font); /* font: XLFD */
91extern spBool spPSSetFontFamily(spPSFile *psfile, const char *font_family);
92extern const char *spPSGetFontFamily(spPSFile *psfile);
93extern spBool spPSSetStringAlignment(spPSFile *psfile, spPSAlignment alignment);
94extern spBool spPSSetStringRotation(spPSFile *psfile, int angle);
95
96extern spBool spPSMoveTo(spPSFile *psfile, int x, int y);
97extern spBool spPSDrawLineTo(spPSFile *psfile, int x, int y);
98extern spBool spPSDrawLine(spPSFile *psfile, int x1, int y1, int x2, int y2);
99extern spBool spPSDrawString(spPSFile *psfile, int x, int y, const char *string);
100
101/* screen coordinate case: (x, y) = upper left corner
102 cartesian coordinate case: (x, y) = lower left corder */
103extern spBool spPSFillRectangle(spPSFile *psfile, int x, int y, int width, int height);
104extern spBool spPSDrawRectangle(spPSFile *psfile, int x, int y, int width, int height);
105extern spBool spPSFillArc(spPSFile *psfile, int x, int y, int width, int height, double angle1, double angle2);
106extern spBool spPSDrawArc(spPSFile *psfile, int x, int y, int width, int height, double angle1, double angle2);
107
108extern spBool spPSStartPolygonPoint(spPSFile *psfile, int x, int y);
109extern spBool spPSAddPolygonPoint(spPSFile *psfile, int x, int y);
110extern spBool spPSAddPolygonRelativePoint(spPSFile *psfile, int dx, int dy);
111extern spPSPolygonId spPSEndPolygonPoint(spPSFile *psfile);
112extern spBool spPSFillPolygon(spPSFile *psfile, spPSPolygonId polygon_id, int dx, int dy);
113extern spBool spPSDrawPolygon(spPSFile *psfile, spPSPolygonId polygon_id, int dx, int dy);
114
115#if defined(MACOS)
116#pragma import off
117#endif
118
119#ifdef __cplusplus
120} /* Close scope of 'extern "C"' declaration */
121#endif
122
123#endif /* __SPPSFILE_H */
int spBool
Definition spDefs.h:248