Skip to content

Commit dbb2050

Browse files
Merge pull request #17 from schwicke/main
Support off-screen hardcopies with scaling
2 parents c0ece03 + 3fbb798 commit dbb2050

18 files changed

Lines changed: 2606 additions & 2188 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ where X is a floating point number between 0. (fully transparent) and 1. (fully
5757
## Migration notes and extensions
5858
Some notes on differences with respect to other implementations.
5959

60+
### Workstation numbers
61+
Workstation numbers can be in the range from 0 to 99.
62+
6063
### Workstation types
6164
* 0 PWST_OUTPUT_TRUE Output only on GL display
6265
* 1 PWST_OUTIN_TRUE Input/Output on GL display
@@ -65,9 +68,9 @@ Some notes on differences with respect to other implementations.
6568
* 4 PWST_HCOPY_TRUE Hardcopy to file as TGA
6669
* 5 PWST_HCOPY_TRUE_DB Hardcopy to file as TGA
6770
* 6 PWST_HCOPY_TRUE_RGB_PNG Hardcopy to file as PNG RGB only
68-
* 7 PWST_HCOPY_TRUE_RGB_PNG_DB Hardcopy to file as PNG RGB only
71+
* 7 PWST_HCOPY_TRUE_RGB_PNG_DB Hardcopy to file as PNG RGB only, same as 6
6972
* 8 PWST_HCOPY_TRUE_RGBA_PNG Hardcopy to file as PNG with Alpha channel
70-
* 9 PWST_HCOPY_TRUE_RGBA_PNG_DB Hardcopy to file as PNG with Alpha channel
73+
* 9 PWST_HCOPY_TRUE_RGBA_PNG_DB Hardcopy to file as PNG with Alpha channel, same as 6
7174

7275
Notes:
7376
* There is no support for PostScript at the moment.
@@ -99,6 +102,7 @@ Openphigs behaviour on echo modes is summarized below.
99102
* low label
100103
* high label
101104
These should be encoded
105+
102106
Extensions:
103107
* echo mode 2:
104108
* as echo mode 1 but places the window on top of the main window

phigs.def

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Example Parameters for workstation 1
2+
Enabled switches: %XX, Comment by replacing the % by some other character
3+
4+
Global flags:
5+
%gs 1 Use shaders (1) or not (0)
6+
%pc 1 print configuration. Set to 0 to disable.
7+
8+
Per workstation configurations
9+
10+
%wk 1 workstation for rendering
11+
%wf fort.10 default output file name for hardcopies
12+
%wn OpenPHIGS workstation name
13+
%wi PHIGS workstation icon name
14+
%wp 0.0 1.0 0.0 1. position
15+
%wg 512 512 0 0 1 Window width height px py border
16+
%bg 0. 0. 0. Background color R G B
17+
%hs 4.
18+
19+
Workstation example for output
20+
%wk 99 Workstation for hardcopy
21+
%wg 512 512 0 0 1 Window width height px py border
22+
%hs 8. scale factor for hardcopy

src/include/phigs/phconf.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@ extern "C" {
2828

2929
static int max_text = 30;
3030
typedef struct {
31-
int wkid;
32-
char window_title[30];
31+
int wkid; /* workstation ID */
32+
char window_title[30]; /* Window title */
3333
char window_icon[30];
34-
char filename[512];
34+
char filename[512]; /* Output filename for hard copies */
3535
int set_window_pos;
3636
Plimit vpos;
3737
Pcolr_rep background_color;
3838
unsigned int display_width;
3939
unsigned int display_height;
4040
unsigned int border_width;
4141
int xpos, ypos;
42+
float hcsf; /* hard copy scale factor */
4243
} Pophconf;
4344

4445
/* configuration file name */

src/include/phigs/phgargs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ typedef struct _Phg_args_open_ws {
182182
unsigned int width, height, border_width;
183183
int x, y;
184184
Plimit limits;
185+
float hcsf;
185186
} Phg_args_open_ws;
186187

187188
typedef struct {

src/include/phigs/private/wsxP.h

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,29 @@ int phg_wsx_setup_tool(
5252
Wst *wst
5353
);
5454

55+
/*******************************************************************************
56+
* phg_wsx_setup_tool_nodisp
57+
*
58+
* DESCR: Create window
59+
* RETURNS: TRUE or FALSE
60+
*/
61+
62+
int phg_wsx_setup_tool_nodisp(
63+
Ws *ws,
64+
Phg_args_conn_info *conn_info,
65+
Phg_args_open_ws *args
66+
);
67+
68+
/*******************************************************************************
69+
* phg_wsx_cleanup_fb
70+
*
71+
* DESCR: Release window
72+
* RETURNS: N/A
73+
*/
74+
void phg_wsx_cleanup_fb(
75+
Ws *ws
76+
);
77+
5578
/*******************************************************************************
5679
* phg_wsx_release_window
5780
*
@@ -86,6 +109,22 @@ Display* phg_wsx_open_gl_display(
86109
Pint *err_ind
87110
);
88111

112+
/*******************************************************************************
113+
* phg_wsx_set_best_args
114+
*
115+
* DESCR: Find best matching visual
116+
* RETURNS: status as true or false
117+
* Fills args array
118+
*/
119+
120+
int phg_wsx_set_best_args(
121+
Ws *ws,
122+
Wst *wst,
123+
int* args,
124+
int* rargc,
125+
int* err_ind
126+
);
127+
89128
/*******************************************************************************
90129
* phg_wsx_find_best_visual
91130
*
@@ -194,4 +233,3 @@ int phg_wstx_init(
194233
#endif /* __cplusplus */
195234

196235
#endif /* _wsxP_h */
197-

src/include/phigs/psl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ SOFTWARE.
5656
extern "C" {
5757
#endif
5858

59-
#define MAX_NO_OPEN_WS 20
60-
#define MAX_NO_OPEN_ARFILES 20
59+
#define MAX_NO_OPEN_WS 100
60+
#define MAX_NO_OPEN_ARFILES 100
6161

6262
typedef struct {
6363
Pint used; /* Mark if workstation is used */

src/include/phigs/ws.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,13 @@ typedef struct _Ws {
240240
Widget valuator_shell;
241241
Widget valuator_box;
242242
Widget valuator_frame;
243+
GLXFBConfig *fbc;
244+
GLuint fbuf, depthbuf, colorbuf;
245+
GLint old_viewport[4];
243246

244247
/* Output LUN for some work station types, e.g. to print out stuff here */
245-
Pint lun;
248+
Pint lun;
249+
Pfloat hcsf;
246250
/* File name */
247251
char filename[512];
248252
void (*close)(

0 commit comments

Comments
 (0)