Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4

- name: dependencies
run: brew reinstall gcc; brew install --cask xquartz; brew install mesa-glu glfw3 tcsh glew openmotif libXaw
run: brew reinstall gcc; brew install --cask xquartz; brew install mesa-glu glfw3 tcsh glew openmotif libXaw gl2ps

- name: clean
run: make clean
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4

- name: dependencies
run: sudo apt install cmake gcc gfortran libx11-dev libglu1-mesa-dev libmotif-dev tcsh libxaw7-dev libglew-dev libdlm-dev
run: sudo apt install cmake gcc gfortran libx11-dev libglu1-mesa-dev libmotif-dev tcsh libxaw7-dev libglew-dev libdlm-dev libgl2ps-dev

- name: clean
run: make clean
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ Workstation numbers can be in the range from 0 to 99.
* 1 PWST_OUTIN_TRUE Input/Output on GL display
* 2 PWST_OUTPUT_TRUE_DB Output only on GL, buffered
* 3 PWST_OUTIN_TRUE_DB Input/Output on GL display, buffered
* 4 PWST_HCOPY_TRUE Hardcopy to file as TGA
* 5 PWST_HCOPY_TRUE_DB Hardcopy to file as TGA
* 6 PWST_HCOPY_TRUE_RGB_PNG Hardcopy to file as PNG RGB only
* 7 PWST_HCOPY_TRUE_RGB_PNG_DB Hardcopy to file as PNG RGB only, same as 6
* 8 PWST_HCOPY_TRUE_RGBA_PNG Hardcopy to file as PNG with Alpha channel
* 9 PWST_HCOPY_TRUE_RGBA_PNG_DB Hardcopy to file as PNG with Alpha channel, same as 6
* 4 PWST_HCOPY_TRUE_TGA Hardcopy to file as TGA
* 5 PWST_HCOPY_TRUE_RGB_PNG Hardcopy to file as PNG RGB only
* 6 PWST_HCOPY_TRUE_RGBA_PNG Hardcopy to file as PNG with Alpha channel
* 7 PWST_HCOPY_TRUE_EPS Hardcopy to file as Encapsulated PostScript, no shaders
* 8 PWST_HCOPY_TRUE_PDF Hardcopy to file as PDF, no shaders
* 9 PWST_HCOPY_TRUE_SVG Hardcopy to file as SVG, no shaders

Notes:
* There is no support for PostScript at the moment.
Expand Down Expand Up @@ -136,12 +136,16 @@ Extensions:
### There is some support for transparency.
#### Fortran bindings
* PXNDEF(STRING NAME): set the configuration location and file name
* PXHCSF(INTEGER IWK, REAL VALUE): Set hardcopy scale factor for workstation ID WKID. Must be set before the workstation is being opened
* PXSHCSF(INTEGER IWK, REAL VALUE): Set hardcopy scale factor for workstation ID WKID. Must be set before the workstation is being opened.
* PXQHCSF(INTEGER IWK, REAL VALUE): Inquire the current scale factor for workstation ID WKID. The value is returned in the second argument.

* PSALCH(REAL VALUE): set ALPHA channel to Value. Value is between 0(fully transparent) and 1 (opaque). Added to the current structure.
* PSFNAME(INTEGER IWK, CHARACTER FNAME): set output file name for workstation ID IWK

#### C-bindings
* pxset_conf_file_name(char* path): set the configuration location and file name
* pxset_conf_hcsf(WKID, float value): Set hardcopy scale factor for workstation ID WKID. Must be set before the workstation is being opened
* pxset_conf_hcsf(WKID, Pfloat value): Set hardcopy scale factor for workstation ID WKID. Must be set before the workstation is being opened
* Pfloat pxinq_conf_hcsf(WKID): Inquire the current hardcopy scale factor for workstation ID WKID.

* pset_alpha_channel(float value): C-Binding for PSALCH. Added to the current structure.

Expand All @@ -150,3 +154,4 @@ Extensions:
* 0.0.2-1: Implement additional extend C and Fortran bindings for CERN specific purposes
* v0.1-1: Fixes for exotic hardware
* v0.2-1: Introduce scale factor for hardcopies
* v0.2-2: Introduce additional functions to manage the scale factor programmatically
43 changes: 40 additions & 3 deletions phigs.def
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,44 @@ Per workstation configurations
%bg 0. 0. 0. Background color R G B
%hs 4.

Workstation example for output
Workstation example for output as tga
%wk 99 Workstation for hardcopy
%wg 512 512 0 0 1 Window width height px py border
%hs 8. scale factor for hardcopy
%wg 1024 1024 0 0 1 Window width height px py border
%wp 0.0 1.0 0.0 1. position
%bg 0. 0. 0. Background color R G B
%hs 3. scale factor for hardcopy

Workstation example for output png
%wk 98 Workstation for hardcopy
%wg 1024 1024 0 0 1 Window width height px py border
%wp 0.0 1.0 0.0 1. position
%bg 0. 0. 0. Background color R G B
%hs 2. scale factor for hardcopy

Workstation example for output pnga
%wk 97 Workstation for hardcopy
%wg 1024 1024 0 0 1 Window width height px py border
%wp 0.0 1.0 0.0 1. position
%hs 1. scale factor for hardcopy
%bg 0. 0. 0. Background color R G B

Workstation example for output eps
%wk 96 Workstation for hardcopy
%wg 2480 3508 0 0 1 Window width height px py border
%wp 0.0 1.0 0.0 1. position
%hs 1. scale factor for hardcopy
%bg 0. 0. 0. Background color R G B

Workstation example for output pdf
%wk 95 Workstation for hardcopy
%wg 2480 3508 0 0 1 Window width height px py border
%wp 0.0 1.0 0.0 1. position
%hs 1. scale factor for hardcopy
%bg 0. 0. 0. Background color R G B

Workstation example for output svg
%wk 94 Workstation for hardcopy
%wg 2480 2480 0 0 1 Window width height px py border
%wp 0.0 1.0 0.0 1. position
%hs 1. scale factor for hardcopy
%bg 0. 0. 0. Background color R G B
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ else()
set (GL_INCLUDES ${Epoxy_INCLUDE_DIR})
endif()

# gl2ps
FIND_PATH(GL2PS_INCLUDE_DIR gl2ps.h)
FIND_LIBRARY(GL2PS_LIBRARY NAMES gl2ps)
add_definitions(-DGLEW)
set (GL_INCLUDES ${GL2PS_INCLUDE_DIR})

message(STATUS "GL Includes=${GL_INCLUDES}")
include_directories(${X11_INCLUDE_DIR} ${MOTIF_INCLUDE_DIR} ${GL_INCLUDES})

Expand Down Expand Up @@ -100,6 +106,7 @@ if (USE_GLEW)
${X11_LIBRARIES}
${GLEW_LIBRARIES}
${OPENGL_LIBRARIES}
${GL2PS_LIBRARY}
m
)
else()
Expand All @@ -115,6 +122,7 @@ else()
${X11_LIBRARIES}
${OPENGL_LIBRARIES}
${Epoxy_LIBRARY}
${GL2PS_LIBRARY}
m
)
endif()
Expand Down
105 changes: 59 additions & 46 deletions src/include/phigs/phigs.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ typedef enum {
PCAT_MI,
PCAT_TGA,
PCAT_PNG,
PCAT_PNGA
PCAT_PNGA,
PCAT_EPS,
PCAT_PDF,
PCAT_SVG
} Pws_cat;

typedef enum {
Expand Down Expand Up @@ -3997,9 +4000,9 @@ void pinq_light_src_rep(
* RETURNS: N/A
*/
void panno_text_rel3(
Ppoint3 *ref_point,
Pvec3 *offset,
char *text);
Ppoint3 *ref_point,
Pvec3 *offset,
char *text);


/*******************************************************************************
Expand All @@ -4020,8 +4023,8 @@ void panno_text_rel(
* RETURNS: N/A
*/
void pset_anno_char_ht(
Pfloat height
);
Pfloat height
);

/*******************************************************************************
* set_anno_align
Expand All @@ -4030,8 +4033,8 @@ void pset_anno_char_ht(
* RETURNS: N/A
*/
void pset_anno_align(
Ptext_align *text_align
);
Ptext_align *text_align
);

/*******************************************************************************
* set_anno_path
Expand All @@ -4040,8 +4043,8 @@ void pset_anno_align(
* RETURNS: N/A
*/
void pset_anno_path(
Ptext_path text_path
);
Ptext_path text_path
);

/*******************************************************************************
* GS element
Expand All @@ -4050,9 +4053,9 @@ void pset_anno_align(
* RETURNS: N/A
*/
void pgse(
Pgse_type gse_type,
Pgse_data * gse_data
);
Pgse_type gse_type,
Pgse_data * gse_data
);

/*******************************************************************************
* set highlighting color
Expand All @@ -4061,8 +4064,8 @@ void pgse(
* RETURNS: N/A
*/
void pxset_highlight_colr (
Pgcolr *colr
);
Pgcolr *colr
);

/*******************************************************************************
* set highlighting filter
Expand All @@ -4071,9 +4074,9 @@ void pxset_highlight_colr (
* RETURNS: N/A
*/
void pset_highl_filter (
Pint ws_id,
Pfilter *filter
);
Pint ws_id,
Pfilter *filter
);

/*******************************************************************************
* pset_model_clip_ind
Expand All @@ -4083,8 +4086,8 @@ void pset_highl_filter (
*/

void pset_model_clip_ind(
Pclip_ind clipi
);
Pclip_ind clipi
);

/*******************************************************************************
* pset_model_clip_vol3
Expand All @@ -4094,9 +4097,9 @@ void pset_model_clip_ind(
*/

void pset_model_clip_vol3 (
Pint op,
Phalf_space_list3 spacelist
);
Pint op,
Phalf_space_list3 spacelist
);

/*******************************************************************************
* predefine colors
Expand All @@ -4106,8 +4109,8 @@ void pset_model_clip_vol3 (
* Note: DELPHI extension
*/
void pxset_color_map(
Pint ws_id
);
Pint ws_id
);

/*******************************************************************************
* print invisibility filter
Expand All @@ -4117,8 +4120,8 @@ void pxset_color_map(
* Note: moved here from testing suite for debugging
*/
void print_invis_filter(
Pint ws_id
);
Pint ws_id
);

/*******************************************************************************
* set alpha channel
Expand All @@ -4128,8 +4131,8 @@ void print_invis_filter(
* Note: extending the standard
*/
void pset_alpha_channel(
Pfloat alpha
);
Pfloat alpha
);

/*******************************************************************************
* phigs message
Expand All @@ -4140,32 +4143,42 @@ void pset_alpha_channel(
*/

void pmessage(
Pint ws_id,
char* message
);
Pint ws_id,
char* message
);

/*******************************************************************************
* Extension: set config file name
* set config file name
*
* DESCR: set config file name
* RETURNS: N/A
* Note: extending the standard
*/
void pxset_conf_file_name(
char * name
);
/*******************************************************************************
* Extension: set hardcopy scale factor
*
* DESCR: set harcopy scale factor for workstation
* RETURNS: N/A
* Note: extending the standard
*/
char * name
);

/*******************************************************************************
*set hardcopy scale factor
*
* DESCR: set harcopy scale factor for workstation
* RETURNS: N/A
* Note: extending the standard
*/
void pxset_conf_hcsf(
Pint wkid,
Pfloat hcsf
);
Pint wkid,
Pfloat hcsf
);

/*******************************************************************************
* pxinq_conf_hcsf
*
* DESCR: inquire the hardcopy scale factor
* RETURNS: current hard copy scale factor for given workstation
*/
Pint pxinq_conf_hcsf(
Pint wkid
);

#ifdef __cplusplus
}
Expand Down
5 changes: 4 additions & 1 deletion src/include/phigs/ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ SOFTWARE.
#ifndef _ws_h
#define _ws_h

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <GL/glx.h>
Expand Down Expand Up @@ -243,12 +244,14 @@ typedef struct _Ws {
GLXFBConfig *fbc;
GLuint fbuf, depthbuf, colorbuf;
GLint old_viewport[4];
GLint program;

/* Output LUN for some work station types, e.g. to print out stuff here */
Pint lun;
Pfloat hcsf;
/* File name */
/* Output File name and descriptor*/
char filename[512];
FILE *fd;
void (*close)(
struct _Ws *ws
);
Expand Down
12 changes: 6 additions & 6 deletions src/include/phigs/ws_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ extern "C" {
#define PWST_OUTIN_TRUE 1
#define PWST_OUTPUT_TRUE_DB 2
#define PWST_OUTIN_TRUE_DB 3
#define PWST_HCOPY_TRUE 4
#define PWST_HCOPY_TRUE_DB 5
#define PWST_HCOPY_TRUE_RGB_PNG 6
#define PWST_HCOPY_TRUE_RGB_PNG_DB 7
#define PWST_HCOPY_TRUE_RGBA_PNG 8
#define PWST_HCOPY_TRUE_RGBA_PNG_DB 9
#define PWST_HCOPY_TRUE_TGA 4
#define PWST_HCOPY_TRUE_RGB_PNG 5
#define PWST_HCOPY_TRUE_RGBA_PNG 6
#define PWST_HCOPY_TRUE_EPS 7
#define PWST_HCOPY_TRUE_PDF 8
#define PWST_HCOPY_TRUE_SVG 9

/* Default tables */
#define WST_MIN_PREDEF_LINE_REPS 1
Expand Down
Loading
Loading