2
* Grace - GRaphing, Advanced Computation and Exploration of data
4
* Home page: http://plasma-gate.weizmann.ac.il/Grace/
6
* Copyright (c) 1991-1995 Paul J Turner, Portland, OR
7
* Copyright (c) 1996-2000 Grace Development Team
9
* Maintained by Evgeny Stambulchik <fnevgeny@plasma-gate.weizmann.ac.il>
14
* This program is free software; you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation; either version 2 of the License, or
17
* (at your option) any later version.
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31
* declarations for devices
39
/* default dimensions of the canvas */
40
#define DEFAULT_PAGE_WIDTH 600
41
#define DEFAULT_PAGE_HEIGHT 600
43
#define MM_PER_INCH 25.4
44
#define CM_PER_INCH (MM_PER_INCH/10)
46
/* hardcopy or terminal device */
47
/* device output can be redirected to file/printer(both) */
50
#define DEVICE_PRINT 2
52
/* Page orientation */
53
#define PAGE_ORIENT_LANDSCAPE 0
54
#define PAGE_ORIENT_PORTRAIT 1
56
/* Standard formats */
71
char *name; /* name of device */
72
int (*init)(void); /* function to initialize device */
73
int (*parser)(char *); /* function to parse device-specific commands */
74
void (*setup)(void); /* function (GUI interface) to setup device */
75
char *fext; /* filename extension */
76
int devfonts; /* device has its own fonts */
77
int fontaa; /* font antialiasing */
78
Page_geometry pg; /* device defaults */
79
void *data; /* device private data */
83
extern void (*devleavegraphics) (void);
85
/* device pixel routine */
86
extern void (*devdrawpixel) (VPoint vp);
87
/* device polyline routine */
88
extern void (*devdrawpolyline) (VPoint *vps, int n, int mode);
89
/* device polygon routine */
90
extern void (*devfillpolygon) (VPoint *vps, int nc);
91
/* device arc routine */
92
extern void (*devdrawarc) (VPoint vp1, VPoint vp2, int a1, int a2);
93
/* device fill arc routine */
94
extern void (*devfillarc) (VPoint vp1, VPoint vp2, int a1, int a2, int mode);
95
/* device pixmap drawing */
96
extern void (*devputpixmap) (VPoint vp, int width, int height, char *databits,
97
int pixmap_bpp, int bitmap_pad, int pixmap_type);
98
/* device text typesetting */
99
extern void (*devputtext) (VPoint vp, char *s, int len, int font,
100
TextMatrix *tm, int underline, int overline, int kerning);
102
/* update color map */
103
extern void (*devupdatecmap)(void);
106
int register_device(Device_entry device);
107
int select_device(int dindex);
108
int initgraphics (void);
110
Device_entry get_device_props(int device);
111
Device_entry get_curdevice_props(void);
113
char *get_device_name(int device);
115
void *get_curdevice_data(void);
116
void set_curdevice_data(void *data);
118
int set_device_props(int device, Device_entry dev);
119
void set_curdevice_props(Device_entry dev);
121
int is_valid_page_geometry(Page_geometry pg);
122
int set_page_geometry(Page_geometry pg);
123
Page_geometry get_page_geometry(void);
125
int set_page_dimensions(int wpp, int hpp, int rescale);
126
int get_device_page_dimensions(int dindex, int *wpp, int *hpp);
128
int get_device_by_name(char *dname);
130
int parse_device_options(int dindex, char *options);
132
int set_printer(int device);
133
int set_printer_by_name(char *dname);
134
void set_ptofile(int flag);
135
int get_ptofile(void);
137
int number_of_devices(void);
139
void get_page_viewport(double *vx, double *vy);
141
int terminal_device(void);
143
PageFormat get_page_format(int device);
145
/* some useful macros */
146
#define page_dpi ((get_page_geometry()).dpi)
148
#define page_width ((get_page_geometry()).width)
149
#define page_height ((get_page_geometry()).height)
151
#define page_width_in ((double) page_width/page_dpi)
152
#define page_height_in ((double) page_height/page_dpi)
154
#define page_width_mm (MM_PER_INCH*page_width_in)
155
#define page_height_mm (MM_PER_INCH*page_height_in)
157
#define page_width_cm (CM_PER_INCH*page_width_in)
158
#define page_height_cm (CM_PER_INCH*page_height_in)
160
#define page_width_pp (72*page_width_in)
161
#define page_height_pp (72*page_height_in)
163
#endif /* __DEVICE_H_ */