GR Reference

Defines

DLLEXPORT
GR_MAX_CONTEXT
GR_DEFAULT_MATH_FONT
GR_AXES_SIMPLE_AXES
GR_AXES_TWIN_AXES
GR_AXES_WITH_GRID

Typedefs

typedef struct cpubasedvolume_2pass_priv cpubasedvolume_2pass_priv_t
typedef struct hexbin_2pass_priv hexbin_2pass_priv_t
typedef double (*kernel_f)(const data_point3d_t*, const void*, const point3d_t*, const point3d_t*)
typedef double (*radius_f)(const data_point3d_t*, const void*)

Enums

enum projection_type_t

Values:

enumerator GR_PROJECTION_DEFAULT
enumerator GR_PROJECTION_ORTHOGRAPHIC
enumerator GR_PROJECTION_PERSPECTIVE
enum volume_border_calculation_t

Values:

enumerator GR_VOLUME_WITHOUT_BORDER
enumerator GR_VOLUME_WITH_BORDER
enum volume_rendering_model_t

Values:

enumerator GR_VOLUME_EMISSION
enumerator GR_VOLUME_ABSORPTION
enumerator GR_VOLUME_MIP
enum textx_option_t

Values:

enumerator GR_TEXT_USE_WC
enumerator GR_TEXT_ENABLE_INLINE_MATH
enum f2pass_option_t

Values:

enumerator GR_2PASS_CLEANUP
enumerator GR_2PASS_RENDER
enum scale_option_t

Values:

enumerator GR_OPTION_X_LOG
enumerator GR_OPTION_Y_LOG
enumerator GR_OPTION_Z_LOG
enumerator GR_OPTION_FLIP_X
enumerator GR_OPTION_FLIP_Y
enumerator GR_OPTION_FLIP_Z
enumerator GR_OPTION_X_LOG2
enumerator GR_OPTION_Y_LOG2
enumerator GR_OPTION_Z_LOG2
enumerator GR_OPTION_X_LN
enumerator GR_OPTION_Y_LN
enumerator GR_OPTION_Z_LN
enum linespec_t

Values:

enumerator GR_SPEC_LINE
enumerator GR_SPEC_MARKER
enumerator GR_SPEC_COLOR
enum surface_option_t

Values:

enumerator GR_OPTION_LINES
enumerator GR_OPTION_MESH
enumerator GR_OPTION_FILLED_MESH
enumerator GR_OPTION_Z_SHADED_MESH
enumerator GR_OPTION_COLORED_MESH
enumerator GR_OPTION_CELL_ARRAY
enumerator GR_OPTION_SHADED_MESH
enumerator GR_OPTION_3D_MESH
enum color_model_t

Values:

enumerator GR_MODEL_RGB
enumerator GR_MODEL_HSV
enum path_code_t

Values:

enumerator GR_STOP
enumerator GR_MOVETO
enumerator GR_LINETO
enumerator GR_CURVE3
enumerator GR_CURVE4
enumerator GR_CLOSEPOLY
enum xform_types_t

Values:

enumerator GR_XFORM_BOOLEAN
enumerator GR_XFORM_LINEAR
enumerator GR_XFORM_LOG
enumerator GR_XFORM_LOGLOG
enumerator GR_XFORM_CUBIC
enumerator GR_XFORM_EQUALIZED
enum interp2_method_t

Values:

enumerator GR_INTERP2_NEAREST
enumerator GR_INTERP2_LINEAR
enumerator GR_INTERP2_SPLINE
enumerator GR_INTERP2_CUBIC

Functions

void gr_initgr(void)
int gr_debug(void)
void gr_opengks(void)
void gr_closegks(void)
void gr_inqdspsize(double*, double*, int*, int*)

Get the current display size.

Depending on the current workstation type, the current display might be the primary screen (e.g. when using gksqt or GKSTerm) or a purely virtual display (e.g. when using Cairo). When a high DPI screen is used as the current display, width and height will be in logical pixels.

Parameters:
  • mwidth[out] Display width in meters

  • mheight[out] Display height in meters

  • width[out] Display width in pixels

  • height[out] Display height in pixels

void gr_openws(int, char*, int)

Open a graphical workstation.

Available workstation types:

Type

Description

5

Workstation Independent Segment Storage

41

Windows GDI

61 - 64

PostScript (b/w, color)

101, 102

Portable Document Format (plain, compressed)

210 - 213

X Windows

214

Sun Raster file (RF)

215, 218

Graphics Interchange Format (GIF87, GIF89)

216

Motif User Interface Language (UIL)

320

Windows Bitmap (BMP)

321

JPEG image file

322

Portable Network Graphics file (PNG)

323

Tagged Image File Format (TIFF)

371

Gtk

380

wxWidgets

381

Qt4

382

Scaleable Vector Graphics (SVG)

390

Windows Metafile

400

Quartz

410

Socket driver

415

0MQ driver

420

OpenGL

Parameters:
  • workstation_id[in] a workstation identifier

  • connection[in] a connection identifier

  • type[in] the desired workstation type

void gr_closews(int)

Close the specified workstation.

Parameters:

workstation_id[in] a workstation identifier

void gr_activatews(int)

Activate the specified workstation.

Parameters:

workstation_id[in] a workstation identifier

void gr_deactivatews(int)

Deactivate the specified workstation.

Parameters:

workstation_id[in] a workstation identifier

void gr_configurews(void)

Configure the specified workstation.

void gr_clearws(void)
void gr_updatews(void)
void gr_polyline(int, double*, double*)

Draw a polyline using the current line attributes, starting from the first data point and ending at the last data point.

The values for x and y are in world coordinates. The attributes that control the appearance of a polyline are linetype, linewidth and color index.

Parameters:
  • n[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

void gr_polymarker(int, double*, double*)

Draw marker symbols centered at the given data points.

The values for x and y are in world coordinates. The attributes that control the appearance of a polymarker are marker type, marker size scale factor and color index.

Parameters:
  • n[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

void gr_text(double, double, char*)

Draw a text at position x, y using the current text attributes.

The values for x and y are in normalized device coordinates. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.

Parameters:
  • x[in] The X coordinate of the starting position of the text string

  • y[in] The Y coordinate of the starting position of the text string

  • string[in] The text to be drawn

void gr_textx(double, double, char*, int)

Draw a text at position x, y using the given options and current text attributes.

The values for x and y specify the text position. If the GR_TEXT_USE_WC option is set, they are interpreted as world cordinates, otherwise as normalized device coordinates. The string may contain new line characters and inline math expressions ($…$). The latter are only taken into account, if the GR_TEXT_ENABLE_INLINE_MATH option is set. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.

Parameters:
  • x[in] The X coordinate of the starting position of the text string

  • y[in] The Y coordinate of the starting position of the text string

  • string[in] The text to be drawn

  • opts[in] Bit mask including text options (GR_TEXT_USE_WC, GR_TEXT_ENABLE_INLINE_MATH)

void gr_inqtext(double, double, char*, double*, double*)
void gr_inqtextx(double, double, char*, int, double*, double*)
void gr_fillarea(int, double*, double*)

Allows you to specify a polygonal shape of an area to be filled.

The attributes that control the appearance of fill areas are fill area interior style, fill area style index and fill area color index.

Parameters:
  • n[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

void gr_cellarray(double, double, double, double, int, int, int, int, int, int, int*)

Display rasterlike images in a device-independent manner. The cell array function partitions a rectangle given by two corner points into DIMX X DIMY cells, each of them colored individually by the corresponding color index of the given cell array.

The values for xmin, xmax, ymin and ymax are in world coordinates.

Parameters:
  • xmin[in] X coordinate of the lower left point of the rectangle

  • xmax[in] X coordinate of the upper right point of the rectangle

  • ymin[in] Y coordinate of the lower left point of the rectangle

  • ymax[in] Y coordinate of the upper right point of the rectangle

  • dimx[in] X dimension of the color index array

  • dimy[in] Y dimension of the color index array

  • scol[in] number of leading columns in the color index array

  • srow[in] number of leading rows in the color index array

  • ncol[in] total number of columns in the color index array

  • nrow[in] total number of rows in the color index array

  • color[in] color index array

void gr_nonuniformcellarray(double*, double*, int, int, int, int, int, int, int*)

Display a two dimensional color index array with nonuniform cell sizes.

These memory accesses must be valid:

  • x[scol-1] through x[scol+ncol-2+clamp(dimx,0,1)]

  • y[scol-1] through y[scol+ncol-2+clamp(dimy,0,1)]

  • color[scol-1+(srow-1)*ncol] through color[scol+ncol-2+(srow+nrow-2)*ncol]

If dimx/dimy is positive, x/y must contain dimx+1/dimy+1 elements. The elements are the coordinates of the cell-edges, where the i-th and i+1-th elements are the edges of the i-th cell in X/Y direction.

If dimx/dimy is negative, x/y must contain -dimx/-dimy elements. The elements are the coordinates of the cell-centers, where the i-th element is the center of the i-th cell in X/Y direction. The inner edges are placed halfway (in world coordinates) between the surrounding centers. The outer edges will be placed at the coordinates given by the first and last element respectively. However, they will still be considered centers for interpolating the edge-positions, which means the first and last cells will be half the size. Hence, -1 cannot be used as a dimension parameter, because the size of the only cell would be impossible to determine.

Assume you have a dimx by dimy color index array. To draw all cells of the color index array using edges use:

 gr_nonuniformcellarray(x, y, dimx, dimy, 1, 1, dimx, dimy, color)
To draw all cells of the color index array using centers use:
 gr_nonuniformcellarray(x, y, -dimx, -dimy, 1, 1, dimx, dimy, color)
scol and srow can be used to specify a (1-based) starting column and row in the color, x and y array. dimx and dimy specify the actual dimension of the arrays in the memory whereof ncol and nrow values are displayed.

Parameters:
  • x[in] ascending X coordinates of the cell edges in world coordinates

  • y[in] ascending Y coordinates of the cell edges in world coordinates

  • dimx[in] (possibly negated) X dimension of the color index array

  • dimy[in] (possibly negated) Y dimension of the color index array

  • scol[in] 1-based starting column of color index and x array

  • srow[in] 1-based starting row of color index and y array

  • ncol[in] number of columns displayed

  • nrow[in] number of rows displayed

  • color[in] color index array

void gr_polarcellarray(double, double, double, double, double, double, int, int, int, int, int, int, int*)

Display a two dimensional color index array mapped to a disk using polar coordinates.

The two dimensional color index array is mapped to the resulting image by interpreting the X-axis of the array as the angle and the Y-axis as the radius. The center point of the resulting disk is located at x_org, y_org and the radius of the disk is rmax.

To draw a contiguous array as a complete disk use:

gr_polarcellarray(x_org, y_org, 0, 360, 0, rmax, dimphi, dimr, 1, 1, dimphi, dimr, color)
The additional parameters to the function can be used to further control the mapping from polar to cartesian coordinates.

If rmin is greater than 0 the input data is mapped to a punctured disk (or annulus) with an inner radius of rmin and an outer radius rmax. If rmin is greater than rmax the Y-axis of the array is reversed.

The parameter phimin and phimax can be used to map the data to a sector of the (punctured) disk starting at phimin and ending at phimax. If phimin is greater than phimax the X-axis is reversed. The visible sector is the one starting in mathematically positive direction (counterclockwise) at the smaller angle and ending at the larger angle. An example of the four possible options can be found below:

phimin

phimax

Result

90

270

Left half visible, mapped counterclockwise

270

90

Left half visible, mapped clockwise

-90

90

Right half visible, mapped counterclockwise

90

-90

Right half visible, mapped clockwise

scol and srow can be used to specify a (1-based) starting column and row in the color array. ncol and nrow specify the actual dimension of the array in the memory whereof dimphi and dimr values are mapped to the disk.

Parameters:
  • x_org[in] X coordinate of the disk center in world coordinates

  • y_org[in] Y coordinate of the disk center in world coordinates

  • phimin[in] start angle of the disk sector in degrees

  • phimax[in] end angle of the disk sector in degrees

  • rmin[in] inner radius of the punctured disk in world coordinates

  • rmax[in] outer radius of the disk in world coordinates

  • dimphi[in] Phi (X) dimension of the color index array

  • dimr[in] R (Y) dimension of the color index array

  • scol[in] number of leading columns in the color index array

  • srow[in] number of leading rows in the color index array

  • ncol[in] total number of columns in the color index array

  • nrow[in] total number of rows in the color index array

  • color[in] color index array

void gr_nonuniformpolarcellarray(double, double, double*, double*, int, int, int, int, int, int, int*)

Display a two dimensional color index array mapped to a disk using polar coordinates with nonuniform cell sizes.

The mapping of the polar coordinates and the drawing is performed simialr to gr_polarcellarray with the difference that the individual cell sizes are specified allowing nonuniform sized cells.

These memory accesses must be valid:

  • phi[scol-1] through phi[scol+ncol-2+clamp(dimphi,0,1)]

  • r[srow-1] through r[srow+nrow-2+clamp(dimr,0,1)]

  • color[scol-1+(srow-1)*ncol] through color[scol+ncol-2+(srow+nrow-2)*ncol]`

If dimphi/dimr is positive, phi/r must contain dimphi+1/dimr+1 elements. The elements are used to calculate the cell-edges, where the i-th and i+1-th elements are used for the edges of the i-th cell in Phi/R direction.

If dimphi/dimr is negative, phi/r must contain -dimphi/-dimr elements. The elements are used to calculate the cell-centers, where the i-th element is used for the center of the i-th cell in Phi/R direction. The inner edges are placed halfway (in world coordinates) between the surrounding centers. The outer edges will be placed at the coordinates calculated for the center of the first and last cell respectively. However, they will still be considered centers for interpolating the edge-positions, which means the first and last cells will be half the size. Hence, -1 cannot be used as a dimension parameter, because the size of the only cell would be impossible to determine.

Assume you have a dimphi by dimr color index array. To draw all cells of the color index array using edges use:

 gr_nonuniformpolarcellarray(x_org, y_org, phi, r, dimphi, dimr, 1, 1, dimphi, dimr, color)
To draw all cells of the color index array using centers use:
 gr_nonuniformpolarcellarray(x_org, y_org, phi, r, -dimphi, -dimr, 1, 1, dimphi, dimr, color)
scol and srow can be used to specify a (1-based) starting column and row in the color, phi and r array. dimr and dimphi specify the actual dimension of the arrays in the memory whereof ncol and nrow values are displayed.

Parameters:
  • x_org[in] X coordinate of the disk center in world coordinates

  • y_org[in] Y coordinate of the disk center in world coordinates

  • phi[in] sorted array with the angles of the disk sectors in degrees

  • r[in] sorted array with the radii of the cells in world coordinates

  • dimphi[in] (possibly negated) Phi/X dimension of the color index array

  • dimr[in] (possibly negated) R/Y dimension of the color index array

  • scol[in] 1-based starting index of the angles and rows of the color index array

  • srow[in] 1-based starting index of the radii and columns of the color index array

  • ncol[in] number of angles/columns displayed

  • nrow[in] number of radii/rows displayed

  • color[in] color index array

void gr_gdp(int, double*, double*, int, int, int*)
void gr_spline(int, double*, double*, int, int)

Generate a cubic spline-fit, starting from the first data point and ending at the last data point.

The values for x and y are in world coordinates. The attributes that control the appearance of a spline-fit are linetype, linewidth and color index.

If method is > 0, then a generalized cross-validated smoothing spline is calculated. If method is 0, then an interpolating natural cubic spline is calculated. If method is < -1, then a cubic B-spline is calculated.

Parameters:
  • n[in] The number of points

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • m[in] The number of points in the polygon to be drawn (m > n)

  • method[in] The smoothing method

void gr_gridit(int, double*, double*, double*, int, int, double*, double*, double*)

Interpolate data from arbitrary points at points on a rectangular grid.

Parameters:
  • nd[in] The number of input points

  • xd[in] A pointer to the X coordinates of the input points

  • yd[in] A pointer to the Y coordinates of the input points

  • zd[in] A pointer to the values of the points

  • nx[in] The number of points in X direction for the output grid

  • ny[in] The number of points in Y direction for the output grid

  • x[out] A pointer to the points in X direction for the output grid

  • y[out] A pointer to the points in Y direction for the output grid

  • z[out] A pointer to the interpolated values on the nx x ny grid points

void gr_setlinetype(int)

Specify the line style for polylines.

The available line types are:

LINETYPE_SOLID

1

Solid line

LINETYPE_DASHED

2

Dashed line

LINETYPE_DOTTED

3

Dotted line

LINETYPE_DASHED_DOTTED

4

Dashed-dotted line

LINETYPE_DASH_2_DOT

-1

Sequence of one dash followed by two dots

LINETYPE_DASH_3_DOT

-2

Sequence of one dash followed by three dots

LINETYPE_LONG_DASH

-3

Sequence of long dashes

LINETYPE_LONG_SHORT_DASH

-4

Sequence of a long dash followed by a short dash

LINETYPE_SPACED_DASH

-5

Sequence of dashes double spaced

LINETYPE_SPACED_DOT

-6

Sequence of dots double spaced

LINETYPE_DOUBLE_DOT

-7

Sequence of pairs of dots

LINETYPE_TRIPLE_DOT

-8

Sequence of groups of three dots

Parameters:

type[in] The polyline line style

void gr_inqlinetype(int*)
void gr_setlinewidth(double)

Define the line width of subsequent polyline output primitives.

The line width is calculated as the nominal line width generated on the workstation multiplied by the line width scale factor. This value is mapped by the workstation to the nearest available line width. The default line width is 1.0, or 1 times the line width generated on the graphics device.

Parameters:

width[in] The polyline line width scale factor

void gr_inqlinewidth(double*)
void gr_setlinecolorind(int)

Define the color of subsequent polyline output primitives.

Parameters:

color[in] The polyline color index (COLOR < 1256)

void gr_inqlinecolorind(int*)
void gr_setmarkertype(int)

Specifiy the marker type for polymarkers.

The available marker types are:

MARKERTYPE_DOT

1

Smallest displayable dot

MARKERTYPE_PLUS

2

Plus sign

MARKERTYPE_ASTERISK

3

Asterisk

MARKERTYPE_CIRCLE

4

Hollow circle

MARKERTYPE_DIAGONAL_CROSS

5

Diagonal cross

MARKERTYPE_SOLID_CIRCLE

-1

Filled circle

MARKERTYPE_TRIANGLE_UP

-2

Hollow triangle pointing upward

MARKERTYPE_SOLID_TRI_UP

-3

Filled triangle pointing upward

MARKERTYPE_TRIANGLE_DOWN

-4

Hollow triangle pointing downward

MARKERTYPE_SOLID_TRI_DOWN

-5

Filled triangle pointing downward

MARKERTYPE_SQUARE

-6

Hollow square

MARKERTYPE_SOLID_SQUARE

-7

Filled square

MARKERTYPE_BOWTIE

-8

Hollow bowtie

MARKERTYPE_SOLID_BOWTIE

-9

Filled bowtie

MARKERTYPE_HGLASS

-10

Hollow hourglass

MARKERTYPE_SOLID_HGLASS

-11

Filled hourglass

MARKERTYPE_DIAMOND

-12

Hollow diamond

MARKERTYPE_SOLID_DIAMOND

-13

Filled Diamond

MARKERTYPE_STAR

-14

Hollow star

MARKERTYPE_SOLID_STAR

-15

Filled Star

MARKERTYPE_TRI_UP_DOWN

-16

Hollow triangles pointing up and down overlaid

MARKERTYPE_SOLID_TRI_RIGHT

-17

Filled triangle point right

MARKERTYPE_SOLID_TRI_LEFT

-18

Filled triangle pointing left

MARKERTYPE_HOLLOW PLUS

-19

Hollow plus sign

MARKERTYPE_SOLID PLUS

-20

Solid plus sign

MARKERTYPE_PENTAGON

-21

Pentagon

MARKERTYPE_HEXAGON

-22

Hexagon

MARKERTYPE_HEPTAGON

-23

Heptagon

MARKERTYPE_OCTAGON

-24

Octagon

MARKERTYPE_STAR_4

-25

4-pointed star

MARKERTYPE_STAR_5

-26

5-pointed star (pentagram)

MARKERTYPE_STAR_6

-27

6-pointed star (hexagram)

MARKERTYPE_STAR_7

-28

7-pointed star (heptagram)

MARKERTYPE_STAR_8

-29

8-pointed star (octagram)

MARKERTYPE_VLINE

-30

verical line

MARKERTYPE_HLINE

-31

horizontal line

MARKERTYPE_OMARK

-32

o-mark

Polymarkers appear centered over their specified coordinates.

Parameters:

type[in] The polymarker marker type

void gr_inqmarkertype(int*)
void gr_setmarkersize(double)

Specify the marker size for polymarkers.

The polymarker size is calculated as the nominal size generated on the graphics device multiplied by the marker size scale factor.

Parameters:

size[in] Scale factor applied to the nominal marker size

void gr_inqmarkersize(double*)

Inquire the marker size for polymarkers.

Parameters:

size[out] Scale factor applied to the nominal marker size

void gr_setmarkercolorind(int)

Define the color of subsequent polymarker output primitives.

Parameters:

color[in] The polymarker color index (COLOR < 1256)

void gr_inqmarkercolorind(int*)
void gr_settextfontprec(int, int)

Specify the text font and precision for subsequent text output primitives.

The available text fonts are:

FONT_TIMES_ROMAN

101

FONT_TIMES_ITALIC

102

FONT_TIMES_BOLD

103

FONT_TIMES_BOLDITALIC

104

FONT_HELVETICA

105

FONT_HELVETICA_OBLIQUE

106

FONT_HELVETICA_BOLD

107

FONT_HELVETICA_BOLDOBLIQUE

108

FONT_COURIER

109

FONT_COURIER_OBLIQUE

110

FONT_COURIER_BOLD

111

FONT_COURIER_BOLDOBLIQUE

112

FONT_SYMBOL

113

FONT_BOOKMAN_LIGHT

114

FONT_BOOKMAN_LIGHTITALIC

115

FONT_BOOKMAN_DEMI

116

FONT_BOOKMAN_DEMIITALIC

117

FONT_NEWCENTURYSCHLBK_ROMAN

118

FONT_NEWCENTURYSCHLBK_ITALIC

119

FONT_NEWCENTURYSCHLBK_BOLD

120

FONT_NEWCENTURYSCHLBK_BOLDITALIC

121

FONT_AVANTGARDE_BOOK

122

FONT_AVANTGARDE_BOOKOBLIQUE

123

FONT_AVANTGARDE_DEMI

124

FONT_AVANTGARDE_DEMIOBLIQUE

125

FONT_PALATINO_ROMAN

126

FONT_PALATINO_ITALIC

127

FONT_PALATINO_BOLD

128

FONT_PALATINO_BOLDITALIC

129

FONT_ZAPFCHANCERY_MEDIUMITALIC

130

FONT_ZAPFDINGBATS

131

FONT_COMPUTERMODERN

232

FONT_DEJAVUSANS

233

FONT_STIXTWOMATH

234

The available text precisions are:

TEXT_PRECISION_STRING

0

String precision (higher quality)

TEXT_PRECISION_CHAR

1

Character precision (medium quality)

TEXT_PRECISION_STROKE

2

Stroke precision (lower quality)

TEXT_PRECISION_OUTLINE

3

Outline precision (highest quality)

The appearance of a font depends on the text precision value specified. STRING, CHARACTER, STROKE or OUTLINE precision allows for a greater or lesser realization of the text primitives, for efficiency. STRING is the default precision for GR and produces the high quality output using either native font rendering or FreeType. OUTLINE uses the GR path rendering functions to draw individual glyphs and produces the highest quality output.

Parameters:
  • font[in] Text font (see tables)

  • precision[in] Text precision (see table below)

void gr_setcharexpan(double)

Set the current character expansion factor (width to height ratio).

This function defines the width of subsequent text output primitives. The expansion factor alters the width of the generated characters, but not their height. The default text expansion factor is 1, or one times the normal width-to-height ratio of the text.

Parameters:

factor[in] Text expansion factor applied to the nominal text width-to-height ratio

void gr_setcharspace(double)
void gr_settextcolorind(int)

Set the current text color index.

This function defines the color of subsequent text output primitives. GR uses the default foreground color (black=1) for the default text color index.

Parameters:

color[in] The text color index (COLOR < 1256)

void gr_inqtextcolorind(int*)

Gets the current text color index.

This function gets the color of text output primitives.

Parameters:

color[out] The text color index (COLOR < 1256)

void gr_setcharheight(double)

Set the current character height.

This function defines the height of subsequent text output primitives. Text height is defined as a percentage of the default window. GR uses the default text height of 0.027 (2.7% of the height of the default window).

Parameters:

height[in] Text height value

void gr_setwscharheight(double chh, double height)
void gr_inqcharheight(double*)

Gets the current character height..

This function gets the height of text output primitives. Text height is defined as a percentage of the default window. GR uses the default text height of 0.027 (2.7% of the height of the default window).

Parameters:

height[out] Text height value

void gr_setcharup(double, double)

Set the current character text angle up vector.

This function defines the vertical rotation of subsequent text output primitives. The text up vector is initially set to (0, 1), horizontal to the baseline.

Parameters:
  • ux[in] X coordinate of the text up vector

  • uy[in] Y coordinate of the text up vector

void gr_settextpath(int)

Define the current direction in which subsequent text will be drawn.

TEXT_PATH_RIGHT

0

left-to-right

TEXT_PATH_LEFT

1

right-to-left

TEXT_PATH_UP

2

downside-up

TEXT_PATH_DOWN

3

upside-down

Parameters:

path[in] Text path (see table)

void gr_settextalign(int, int)

Set the current horizontal and vertical alignment for text.

TEXT_HALIGN_NORMAL

0

TEXT_HALIGN_LEFT

1

Left justify

TEXT_HALIGN_CENTER

2

Center justify

TEXT_HALIGN_RIGHT

3

Right justify

TEXT_VALIGN_NORMAL

0

TEXT_VALIGN_TOP

1

Align with the top of the characters

TEXT_VALIGN_CAP

2

Aligned with the cap of the characters

TEXT_VALIGN_HALF

3

Aligned with the half line of the characters

TEXT_VALIGN_BASE

4

Aligned with the base line of the characters

TEXT_VALIGN_BOTTOM

5

Aligned with the bottom line of the characters

This function specifies how the characters in a text primitive will be aligned in horizontal and vertical space. The default text alignment indicates horizontal left alignment and vertical baseline alignment.

Parameters:
  • horizontal[in] Horizontal text alignment (see the table)

  • vertical[in] Vertical text alignment (see the table)

void gr_setfillintstyle(int)

Set the fill area interior style to be used for fill areas.

HOLLOW

0

No filling. Just draw the bounding polyline

SOLID

1

Fill the interior of the polygon using the fill color index

PATTERN

2

Fill the interior of the polygon using the style index as a pattern index

HATCH

3

Fill the interior of the polygon using the style index as a cross-hatched style

SOLID_WITH_BORDER

4

Fill the interior of the polygon using the fill color index and draw the bounding polyline

This function defines the interior style for subsequent fill area output primitives. The default interior style is HOLLOW.

Parameters:

style[in] The style of fill to be used

void gr_inqfillintstyle(int*)

Set the fill area interior style to be used for fill areas.

This function gets the currently set fill style.

Parameters:

style[out] The currently set fill style

void gr_setfillstyle(int)

Set the fill area interior style to be used for fill areas.

This function specifies an index when PATTERN fill or HATCH fill is requested by the gr_setfillintstyle function. If the interior style is set to PATTERN, the fill style index points to a device-independent pattern table. If interior style is set to HATCH the fill style index indicates different hatch styles. If HOLLOW or SOLID is specified for the interior style, the fill style index is unused.

Parameters:

index[in] The fill style index to be used

void gr_inqfillstyle(int*)

Get the fill area interior style to be used for fill areas.

This function gets the color index for PATTERN and HATCH fills.

Parameters:

index[out] The currently set fill style color index

void gr_setfillcolorind(int)

Sets the current fill area color index.

This function defines the color of subsequent fill area output primitives. GR uses the default foreground color (black=1) for the default fill area color index.

Parameters:

color[in] The fill area color index (COLOR < 1256)

void gr_inqfillcolorind(int*)

Gets the current fill area color index.

This function gets the color of fill area output primitives.

Parameters:

color[out] The fill area color index (COLOR < 1256)

void gr_setresizebehaviour(int)
void gr_inqresizebehaviour(int*)
void gr_setcolorrep(int, double, double, double)

Redefine an existing color index representation by specifying an RGB color triplet.

Parameters:
  • index[in] Color index in the range 0 to 1256

  • red[in] Red intensity in the range 0.0 to 1.0

  • green[in] Green intensity in the range 0.0 to 1.0

  • blue[in] Blue intensity in the range 0.0 to 1.0

void gr_setwindow(double, double, double, double)

Establishes a window, or rectangular subspace, of world coordinates to be plotted. If you desire log scaling or mirror-imaging of axes, use the gr_setscale function.

This function defines the rectangular portion of the World Coordinate space (WC) to be associated with the specified normalization transformation. The WC window and the Normalized Device Coordinates (NDC) viewport define the normalization transformation through which all output primitives are mapped. The WC window is mapped onto the rectangular NDC viewport which is, in turn, mapped onto the display surface of the open and active workstation, in device coordinates. By default, GR uses the range [0,1] x [0,1], in world coordinates, as the normalization transformation window.

Parameters:
  • xmin[in] The left horizontal coordinate of the window (xmin < xmax).

  • xmax[in] The right horizontal coordinate of the window (xmin < xmax).

  • ymin[in] The bottom vertical coordinate of the window (ymin < ymax).

  • ymax[in] The top vertical coordinate of the window (ymin < ymax).

void gr_inqwindow(double*, double*, double*, double*)
void gr_setviewport(double, double, double, double)

Establishes a rectangular subspace of normalized device coordinates.

This function defines the rectangular portion of the Normalized Device Coordinate (NDC) space to be associated with the specified normalization transformation. The NDC viewport and World Coordinate (WC) window define the normalization transformation through which all output primitives pass. The WC window is mapped onto the rectangular NDC viewport which is, in turn, mapped onto the display surface of the open and active workstation, in device coordinates.

Parameters:
  • xmin[in] The left horizontal coordinate of the viewport (0 <= xmin < xmax).

  • xmax[in] The right horizontal coordinate of the viewport (xmin < xmax <= 1).

  • ymin[in] The bottom vertical coordinate of the viewport (0 <= ymin < ymax).

  • ymax[in] The top vertical coordinate of the viewport (ymin < ymax <= 1).

void gr_inqviewport(double*, double*, double*, double*)
void gr_selntran(int)

Select a predefined transformation from world coordinates to normalized device coordinates.

0

Selects the identity transformation in which both the window and viewport have the range of 0 to 1

>= 1

Selects a normalization transformation as defined by setwindow and setviewport

Parameters:

transform[in] A normalization transformation number.

void gr_setclip(int)

Set the clipping indicator.

0

Clipping is off. Data outside of the window will be drawn.

1

Clipping is on. Data outside of the window will not be drawn.

This function enables or disables clipping of the image drawn in the current window. Clipping is defined as the removal of those portions of the graph that lie outside of the defined viewport. If clipping is on, GR does not draw generated output primitives past the viewport boundaries. If clipping is off, primitives may exceed the viewport boundaries, and they will be drawn to the edge of the workstation window. By default, clipping is on.

Parameters:

indicator[in] An indicator specifying whether clipping is on or off.

void gr_setwswindow(double, double, double, double)

Set the area of the NDC viewport that is to be drawn in the workstation window.

This function defines the rectangular area of the Normalized Device Coordinate space to be output to the device. By default, the workstation transformation will map the range [0,1] x [0,1] in NDC onto the largest square on the workstation’s display surface. The aspect ratio of the workstation window is maintained at 1 to 1.

Parameters:
  • xmin[in] The left horizontal coordinate of the workstation window (0 <= xmin < xmax).

  • xmax[in] The right horizontal coordinate of the workstation window (xmin < xmax <= 1).

  • ymin[in] The bottom vertical coordinate of the workstation window (0 <= ymin < ymax).

  • ymax[in] The top vertical coordinate of the workstation window (ymin < ymax <= 1).

void gr_setwsviewport(double, double, double, double)

Define the size of the workstation graphics window in meters.

This function places a workstation window on the display of the specified size in meters. This command allows the workstation window to be accurately sized for a display or hardcopy device, and is often useful for sizing graphs for desktop publishing applications.

Parameters:
  • xmin[in] The left horizontal coordinate of the workstation window.

  • xmax[in] The right horizontal coordinate of the workstation window.

  • ymin[in] The bottom vertical coordinate of the workstation window.

  • ymax[in] The top vertical coordinate of the workstation window.

void gr_createseg(int)
void gr_copysegws(int)
void gr_redrawsegws(void)
void gr_setsegtran(int, double, double, double, double, double, double, double)
void gr_closeseg(void)
void gr_samplelocator(double*, double*, int*)
void gr_emergencyclosegks(void)
void gr_updategks(void)
int gr_setspace(double, double, int, int)

Set the abstract Z-space used for mapping three-dimensional output primitives into the current world coordinate space.

This function establishes the limits of an abstract Z-axis and defines the angles for rotation and for the viewing angle (tilt) of a simulated three-dimensional graph, used for mapping corresponding output primitives into the current window. These settings are used for all subsequent three-dimensional output primitives until other values are specified. Angles of rotation and viewing angle must be specified between 0 and 90 degrees.

Parameters:
  • zmin[in] Minimum value for the Z-axis.

  • zmax[in] Maximum value for the Z-axis.

  • rotation[in] Angle for the rotation of the X axis, in degrees.

  • tilt[in] Viewing angle of the Z axis, in degrees.

void gr_inqspace(double*, double*, int*, int*)
int gr_setscale(int)

Set the type of transformation to be used for subsequent GR output primitives.

GR_OPTION_X_LOG

Logarithmic X-axis

GR_OPTION_Y_LOG

Logarithmic Y-axis

GR_OPTION_Z_LOG

Logarithmic Z-axis

GR_OPTION_FLIP_X

Flip X-axis

GR_OPTION_FLIP_Y

Flip Y-axis

GR_OPTION_FLIP_Z

Flip Z-axis

GR_OPTION_X_LOG2

log2 scaled X-axis

GR_OPTION_Y_LOG2

log2 scaled Y-axis

GR_OPTION_Z_LOG2

log2 scaled Z-axis

GR_OPTION_X_LN

ln scaled X-axis

GR_OPTION_Y_LN

ln scaled Y-axis

GR_OPTION_Z_LN

ln scaled Z-axis

This function defines the current transformation according to the given scale specification which may be or’ed together using any of the above options. GR uses these options for all subsequent output primitives until another value is provided. The scale options are used to transform points from an abstract logarithmic or semi-logarithmic coordinate system, which may be flipped along each axis, into the world coordinate system.

Note

When applying a logarithmic transformation to a specific axis, the system assumes that the axes limits are greater than zero.

Parameters:

options[in] Scale specification (see table)

void gr_inqscale(int*)
int gr_textext(double, double, char*)

Draw a text at position x, y using the current text attributes. Strings can be defined to create basic mathematical expressions and Greek letters.

The values for X and Y are in normalized device coordinates. The attributes that control the appearance of text are text font and precision, character expansion factor, character spacing, text color index, character height, character up vector, text path and text alignment.

The character string is interpreted to be a simple mathematical formula. The following notations apply:

Subscripts and superscripts: These are indicated by carets (‘^’) and underscores (‘_’). If the sub/superscript contains more than one character, it must be enclosed in curly braces (‘{}’).

Fractions are typeset with A ‘/’ B, where A stands for the numerator and B for the denominator.

To include a Greek letter you must specify the corresponding keyword after a backslash (’') character. The text translator produces uppercase or lowercase Greek letters depending on the case of the keyword.

Letter

Keyword

\(A\) \(\alpha\)

alpha

\(B\) \(\beta\)

beta

\(\Gamma\) \(\gamma\)

gamma

\(\Delta\) \(\delta\)

delta

\(E\) \(\epsilon\)

epsilon

\(Z\) \(\zeta\)

zeta

\(H\) \(\eta\)

eta

\(\Theta\) \(\theta\)

theta

\(I\) \(\iota\)

iota

\(K\) \(\kappa\)

kappa

\(\Lambda\) \(\lambda\)

lambda

\(M\) \(\mu\)

mu

\(N\) \(\nu\)

v

\(\Xi\) \(\xi\)

xi

\(O\) \(o\)

omicron

\(\Pi\) \(\pi\)

pi

\(P\) \(\rho\)

rho

\(\Sigma\) \(\sigma\)

sigma

\(T\) \(\tau\)

tau

\(\Upsilon\) \(\upsilon\)

upsilon

\(\Phi\) \(\phi\)

phi

\(X\) \(\chi\)

chi

\(\Psi\) \(\psi\)

psi

\(\Omega\) \(\omega\)

omega

For more sophisticated mathematical formulas, you should use the gr_mathtex function.

Note: ‘v’ is a replacement for ‘nu’ which would conflict with ‘

’ (newline)

Parameters:
  • x[in] The X coordinate of starting position of the text string

  • y[in] The Y coordinate of starting position of the text string

  • string[in] The text to be drawn

void gr_inqtextext(double, double, char*, double*, double*)
void gr_setscientificformat(int)

Specify the format to be used when scientific notation is used.

The available options are:

SCIENTIFIC_FORMAT_OPTION_E

1

SCIENTIFIC_FORMAT_OPTION_TEXTEX

2

SCIENTIFIC_FORMAT_OPTION_MATHTEX

3

Parameters:

format_option[in] Scientific format

void gr_axes(double, double, double, double, int, int, double)

Draw X and Y coordinate axes with linearly and/or logarithmically spaced tick marks.

Tick marks are positioned along each axis so that major tick marks fall on the axes origin (whether visible or not). Major tick marks are labeled with the corresponding data values. Axes are drawn according to the scale of the window. Axes and tick marks are drawn using solid lines; line color and width can be modified using the gr_setlinetype and gr_setlinewidth functions. Axes are drawn according to the linear or logarithmic transformation established by the gr_setscale function.

Parameters:
  • x_tick[in] The interval between minor tick marks on the X axis.

  • y_tick[in] The interval between minor tick marks on the Y axis.

  • x_org[in] The world coordinate of the origin (point of intersection) of the X axis.

  • y_org[in] The world coordinate of the origin (point of intersection) of the Y axis.

  • major_x[in] Unitless integer value specifying the number of minor tick intervals between major tick marks on the X axis. Values of 0 or 1 imply no minor ticks. Negative values specify no labels will be drawn for the associated axis.

  • major_y[in] Unitless integer value specifying the number of minor tick intervals between major tick marks on the Y axis. Values of 0 or 1 imply no minor ticks. Negative values specify no labels will be drawn for the associated axis.

  • tick_size[in] The length of minor tick marks specified in a normalized device coordinate unit. Major tick marks are twice as long as minor tick marks. A negative value reverses the tick marks on the axes from inward facing to outward facing (or vice versa).

void gr_axeslbl(double, double, double, double, int, int, double, void (*)(double, double, const char*, double), void (*)(double, double, const char*, double))

Create axes in the current workspace and supply a custom function for changing the behaviour of the tick labels.

Similar to gr_axes() but allows more fine-grained control over tick labels and text positioning by supplying callback functions. Within the callback function you can use normal GR text primitives for performing any manipulations on the label text.

See gr_axes() for more details on drawing axes.

Parameters:
  • x_tick[in] The interval between minor tick marks on the X axis.

  • y_tick[in] The interval between minor tick marks on the Y axis.

  • x_org[in] The world coordinate of the origin (point of intersection) of the X axis.

  • y_org[in] The world coordinate of the origin (point of intersection) of the Y axis.

  • major_x[in] Unitless integer value specifying the number of minor tick intervals between major tick marks on the X axis. Values of 0 or 1 imply no minor ticks. Negative values specify no labels will be drawn for the associated axis.

  • major_y[in] Unitless integer value specifying the number of minor tick intervals between major tick marks on the Y axis. Values of 0 or 1 imply no minor ticks. Negative values specify no labels will be drawn for the associated axis.

  • tick_size[in] The length of minor tick marks specified in a normalized device coordinate unit. Major tick marks are twice as long as minor tick marks. A negative value reverses the tick marks on the axes from inward facing to outward facing (or vice versa).

  • fpx[in] Function pointer to a function that returns a label for a given tick on the X axis. The callback function should have the following arguments:

  • x[in] NDC of the label in X direction.

  • y[in] NDC of the label in Y direction.

  • svalue[in] Internal string representation of the text drawn by GR at (x,y).

  • value[in] Floating point representation of the label drawn at (x,y).

  • fpy[in] Exactly same as the fpx above, but for the the Y axis.

void gr_axis(char, axis_t*)
void gr_drawaxis(char, axis_t*)
void gr_drawaxes(axis_t*, axis_t*, int)
void gr_freeaxis(axis_t*)
void gr_grid(double, double, double, double, int, int)

Draw a linear and/or logarithmic grid.

Major grid lines correspond to the axes origin and major tick marks whether visible or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid lines are drawn using black lines and minor grid lines are drawn using gray lines.

Parameters:
  • x_tick[in] The length in world coordinates of the interval between minor grid lines in X direction.

  • y_tick[in] The length in world coordinates of the interval between minor grid lines in Y direction.

  • x_org[in] The world coordinate of the origin (point of intersection) of the X axis.

  • y_org[in] The world coordinate of the origin (point of intersection) of the Y axis.

  • major_x[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the X axis. Values of 0 or 1 imply no grid lines.

  • major_y[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the Y axis. Values of 0 or 1 imply no grid lines.

void gr_grid3d(double, double, double, double, double, double, int, int, int)

Draw a linear and/or logarithmic grid.

Major grid lines correspond to the axes origin and major tick marks whether visible or not. Minor grid lines are drawn at points equal to minor tick marks. Major grid lines are drawn using black lines and minor grid lines are drawn using gray lines.

Parameters:
  • x_tick[in] The length in world coordinates of the interval between minor grid lines in X direction.

  • y_tick[in] The length in world coordinates of the interval between minor grid lines in Y direction.

  • z_tick[in] The length in world coordinates of the interval between minor grid lines in Z direction.

  • x_org[in] The world coordinate of the origin (point of intersection) of the X axis.

  • y_org[in] The world coordinate of the origin (point of intersection) of the Y axis.

  • z_org[in] The world coordinate of the origin (point of intersection) of the Z axis.

  • major_x[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the X axis. Values of 0 or 1 imply no grid lines.

  • major_y[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the Y axis. Values of 0 or 1 imply no grid lines.

  • major_z[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the Z axis. Values of 0 or 1 imply no grid lines.

void gr_verrorbars(int, double*, double*, double*, double*)

Draw a standard vertical error bar graph.

Parameters:
  • n[in] The number of points

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • e1[in] A pointer to the absolute values of the lower error bar data

  • e2[in] A pointer to the absolute values of the upper error bar data

void gr_herrorbars(int, double*, double*, double*, double*)

Draw a standard horizontal error bar graph.

Parameters:
  • n[in] The number of points

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • e1[in] A pointer to the absolute values of the lower error bar data

  • e2[in] A pointer to the absolute values of the upper error bar data

void gr_polyline3d(int, double*, double*, double*)

Draw a 3D curve using the current line attributes, starting from the first data point and ending at the last data point.

The values for x, y and z are in world coordinates. The attributes that control the appearance of a polyline are linetype, linewidth and color index.

Parameters:
  • n[in] The number of points

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • pz[in] A pointer to the Z coordinates

void gr_polymarker3d(int, double*, double*, double*)

Draw marker symbols centered at the given 3D data points.

The values for x, y and z are in world coordinates. The attributes that control the appearance of a polymarker are marker type, marker size scale factor and color index.

Parameters:
  • n[in] The number of points

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • pz[in] A pointer to the Z coordinates

void gr_axes3d(double, double, double, double, double, double, int, int, int, double)

Draw X, Y and Z coordinate axes with linearly and/or logarithmically spaced tick marks.

Tick marks are positioned along each axis so that major tick marks fall on the axes origin (whether visible or not). Major tick marks are labeled with the corresponding data values. Axes are drawn according to the scale of the window. Axes and tick marks are drawn using solid lines; line color and width can be modified using the gr_setlinetype and gr_setlinewidth functions. Axes are drawn according to the linear or logarithmic transformation established by the gr_setscale function.

Parameters:
  • x_tick[in] The length in world coordinates of the interval between minor grid lines in X direction.

  • y_tick[in] The length in world coordinates of the interval between minor grid lines in Y direction.

  • z_tick[in] The length in world coordinates of the interval between minor grid lines in Z direction.

  • x_org[in] The world coordinate of the origin (point of intersection) of the X axis.

  • y_org[in] The world coordinate of the origin (point of intersection) of the Y axis.

  • z_org[in] The world coordinate of the origin (point of intersection) of the Z axis.

  • major_x[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the X axis. Values of 0 or 1 imply no grid lines.

  • major_y[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the Y axis. Values of 0 or 1 imply no grid lines.

  • major_z[in] Unitless integer value specifying the number of minor grid lines between major grid lines on the Z axis. Values of 0 or 1 imply no grid lines.

  • tick_size[in] The length of minor tick marks specified in a normalized device coordinate unit. Major tick marks are twice as long as minor tick marks. A negative value reverses the tick marks on the axes from inward facing to outward facing (or vice versa).

void gr_titles3d(char*, char*, char*)

Display axis titles just outside of their respective axes.

Parameters:
  • x_title[in] The text to be displayed on the X axis

  • y_title[in] The text to be displayed on the Y axis

  • z_title[in] The text to be displayed on the Z axis

void gr_settitles3d(char*, char*, char*)

Set axis titles to display when gr_axes3d is called, similar to gr_titles3d.

Parameters:
  • x_title[in] The text to be displayed on the X axis

  • y_title[in] The text to be displayed on the Y axis

  • z_title[in] The text to be displayed on the Z axis

void gr_surface(int, int, double*, double*, double*, int)

Draw a three-dimensional surface plot for the given data points.

x and y define a grid. z is a singly dimensioned array containing at least nx * ny data points. z describes the surface height at each point on the grid. Data is ordered as shown in the following table:

LINES

0

Use X Y polylines to denote the surface

MESH

1

Use a wire grid to denote the surface

FILLED_MESH

2

Applies an opaque grid to the surface

Z_SHADED_MESH

3

Applies Z-value shading to the surface

COLORED_MESH

4

Applies a colored grid to the surface

CELL_ARRAY

5

Applies a grid of individually-colored cells to the surface

SHADED_MESH

6

Applies light source shading to the 3-D surface

To see option 2 correctly change linecolorind or fillcolorind. Both default values are black.

Parameters:
  • nx[in] The number of points along the X axis

  • ny[in] The number of points along the Y axis

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • pz[in] A pointer to the Z coordinates

  • option[in] Surface display option (see table)

void gr_contour(int, int, int, double*, double*, double*, double*, int)

Draw contours of a three-dimensional data set whose values are specified over a rectangular mesh. Contour lines may optionally be labeled.

Parameters:
  • nx[in] The number of points along the X axis

  • ny[in] The number of points along the Y axis

  • nh[in] The number of height values. If less than 1, 16 evenly spaced values will be used instead of h, which can safely be NULL

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • h[in] A pointer to the height values

  • pz[in] A pointer to the Z coordinates (at least nx * ny)

  • major_h[in] Directs GR to label contour lines. For example, a value of 3 would label every third line. A value of 1 will label every line. A value of 0 produces no labels. To produce colored contour lines, add an offset of 1000 to major_h

void gr_contourf(int, int, int, double*, double*, double*, double*, int)

Draw filled contour plot of a three-dimensional data set whose values are specified over a rectangular mesh.

Parameters:
  • nx[in] The number of points along the X axis

  • ny[in] The number of points along the Y axis

  • nh[in] The number of height values. 0 for default contours.

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • h[in] A pointer to the height values in ascending order. If NULL, use nh evenly distributed height values between minimum and maximum Z value.

  • pz[in] A pointer to the Z coordinates (at least nx * ny)

  • major_h[in] Directs GR to label contour lines. For example, a value of 3 would label every third line. A value of 1 will label every line. A value of 0 produces no labels. To produce colored contour lines, add an offset of 1000 to major_h. Use a value of -1 to disable contour lines and labels.

void gr_tricontour(int, double*, double*, double*, int, double*)

Draw a contour plot for the given triangle mesh.

Parameters:
  • npoints[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

  • z[in] A pointer to the Z coordinates

  • nlevels[in] The number of contour levels

  • levels[in] A pointer to the contour levels

int gr_hexbin(int, double*, double*, int)
const hexbin_2pass_t *gr_hexbin_2pass(int, double*, double*, int, const hexbin_2pass_t*)
void gr_setcolormap(int)

Set the currently used colormap.

A list of colormaps can be found at: https://gr-framework.org/colormaps.html

Using a negative index will use the reverse of the selected colormap.

Parameters:

index[in] Colormap index

void gr_inqcolormap(int*)
void gr_setcolormapfromrgb(int n, double *r, double *g, double *b, double *x)

Define a colormap by a list of RGB colors.

This function defines a colormap using the n given color intensities. If less than 256 colors are provided the colors intensities are linear interpolated. If x is NULL the given color values are evenly distributed in the colormap. Otherwise the normalized value of x defines the position of the color in the colormap.

Parameters:
  • n[in] The number of colors

  • r[in] A pointer to the red intensities in range 0.0 to 1.0

  • g[in] A pointer to the green intensities in range 0.0 to 1.0

  • b[in] A pointer to the blue intensities in range 0.0 to 1.0

  • x[in] A pointer to the positions of the corresponding color in the resulting colormap or NULL. The values of x must increase monotonically from 0.0 to 1.0. If x is NULL the given colors are evenly distributed in the colormap.

void gr_inqcolormapinds(int*, int*)

Inquire the color index range of the current colormap.

Parameters:
  • first_color_ind[out] The color index of the first color

  • last_color_ind[out] The color index of the last color

void gr_colorbar(void)
void gr_inqcolor(int, int*)
int gr_inqcolorfromrgb(double, double, double)
void gr_hsvtorgb(double h, double s, double v, double *r, double *g, double *b)
double gr_tick(double, double)
int gr_validaterange(double, double)
void gr_adjustlimits(double*, double*)
void gr_adjustrange(double*, double*)
void gr_beginprint(char*)

Open and activate a print device.

This function opens an additional graphics output device. The device type is obtained from the given file extension. The following file types are supported:

The following file types are supported:

.ps, .eps

PostScript

.pdf

Portable Document Format

.bmp

Windows Bitmap (BMP)

.jpeg, .jpg

JPEG image file

.png

Portable Network Graphics file (PNG)

.tiff, .tif

Tagged Image File Format (TIFF)

.svg

Scalable Vector Graphics

.wmf

Windows Metafile

.mp4

MPEG-4 video file

.webm

WebM video file

.ogg

Ogg video file

Parameters:

pathname[in] Filename for the print device.

void gr_beginprintext(char*, char*, char*, char*)

Open and activate a print device with the given layout attributes.

The available formats are:

A4

0.210 x 0.297

B5

0.176 x 0.250

Letter

0.216 x 0.279

Legal

0.216 x 0.356

Executive

0.191 x 0.254

A0

0.841 x 1.189

A1

0.594 x 0.841

A2

0.420 x 0.594

A3

0.297 x 0.420

A5

0.148 x 0.210

A6

0.105 x 0.148

A7

0.074 x 0.105

A8

0.052 x 0.074

A9

0.037 x 0.052

B0

1.000 x 1.414

B1

0.500 x 0.707

B10

0.031 x 0.044

B2

0.500 x 0.707

B3

0.353 x 0.500

B4

0.250 x 0.353

B6

0.125 x 0.176

B7

0.088 x 0.125

B8

0.062 x 0.088

B9

0.044 x 0.062

C5E

0.163 x 0.229

Comm10E

0.105 x 0.241

DLE

0.110 x 0.220

Folio

0.210 x 0.330

Ledger

0.432 x 0.279

Tabloid

0.279 x 0.432

Parameters:
  • pathname[in] Filename for the print device.

  • mode[in] Output mode (Color, GrayScale)

  • format[in] Output format (see table)

  • orientation[in] Page orientation (Landscape, Portrait)

void gr_endprint(void)
void gr_ndctowc(double*, double*)
void gr_wctondc(double*, double*)
void gr_wc3towc(double*, double*, double*)
void gr_drawrect(double, double, double, double)

Draw a rectangle using the current line attributes.

Parameters:
  • xmin[in] Left edge of the rectangle

  • xmax[in] Right edge of the rectangle

  • ymin[in] Bottom edge of the rectangle

  • ymax[in] Upper edge of the rectangle

void gr_fillrect(double, double, double, double)

Draw a filled rectangle using the current fill attributes.

Parameters:
  • xmin[in] Left edge of the rectangle

  • xmax[in] Right edge of the rectangle

  • ymin[in] Bottom edge of the rectangle

  • ymax[in] Upper edge of the rectangle

void gr_drawarc(double, double, double, double, double, double)

Draw a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at a1 and ends at a2 degrees. Angles are interpreted such that 0 degrees is at the 3 o’clock position. The center of the arc is the center of the given rectangle.

Parameters:
  • xmin[in] Left edge of the rectangle

  • xmax[in] Right edge of the rectangle

  • ymin[in] Bottom edge of the rectangle

  • ymax[in] Upper edge of the rectangle

  • a1[in] The start angle

  • a2[in] The end angle

void gr_fillarc(double, double, double, double, double, double)

Fill a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at a1 and ends at a2 degrees. Angles are interpreted such that 0 degrees is at the 3 o’clock position. The center of the arc is the center of the given rectangle.

Parameters:
  • xmin[in] Left edge of the rectangle

  • xmax[in] Right edge of the rectangle

  • ymin[in] Bottom edge of the rectangle

  • ymax[in] Upper edge of the rectangle

  • a1[in] The start angle

  • a2[in] The end angle

void gr_drawpath(int, vertex_t*, unsigned char*, int)

Draw simple and compound outlines consisting of line segments and bezier curves.

The following path codes are recognized:

STOP

end the entire path

MOVETO

move to the given vertex

LINETO

draw a line from the current position to the given vertex

CURVE3

draw a quadratic Bezier curve

CURVE4

draw a cubic Bezier curve

CLOSEPOLY

draw a line segment to the start point of the current path

Parameters:
  • n[in] The number of vertices

  • vertices[in] A pointer to the vertices

  • codes[in] A pointer to the path codes

  • fill[in] A flag indication whether resulting path is to be filled or not

void gr_setarrowstyle(int)

Set the arrow style to be used for subsequent arrow commands.

This function defines the arrow style for subsequent arrow primitives. The default arrow style is 1.

1

simple, single-ended

2

simple, single-ended, acute head

3

hollow, single-ended

4

filled, single-ended

5

triangle, single-ended

6

filled triangle, single-ended

7

kite, single-ended

8

filled kite, single-ended

9

simple, double-ended

10

simple, double-ended, acute head

11

hollow, double-ended

12

filled, double-ended

13

triangle, double-ended

14

filled triangle, double-ended

15

kite, double-ended

16

filled kite, double-ended

17

double line, single-ended

18

double line, double-ended

Parameters:

style[in] The arrow style to be used

void gr_setarrowsize(double)

Set the arrow size to be used for subsequent arrow commands.

This function defines the arrow size for subsequent arrow primitives. The default arrow size is 1.

Parameters:

size[in] The arrow size to be used

void gr_drawarrow(double, double, double, double)

Draw an arrow between two points.

Different arrow styles (angles between arrow tail and wing, optionally filled heads, double headed arrows) are available and can be set with the gr_setarrowstyle function.

Parameters:
  • x1[in] The X coordinate of the arrow start point (tail)

  • y1[in] The Y coordinate of the arrow start point (tail)

  • x2[in] The X coordinate of the arrow end point (head)

  • y2[in] The Y coordinate of the arrow end point (head)

int gr_readimage(char*, int*, int*, int**)
void gr_drawimage(double, double, double, double, int, int, int*, int)

Draw an image into a given rectangular area.

The points (xmin, ymin) and (xmax, ymax) are world coordinates defining diagonally opposite corner points of a rectangle. This rectangle is divided into width by height cells. The two-dimensional array data specifies colors for each cell.

The available color models are:

GR_MODEL_RGB

0

AABBGGRR

GR_MODEL_HSV

1

AAVVSSHH

Parameters:
  • xmin[in] X coordinate of the lower left point of the rectangle

  • ymin[in] Y coordinate of the lower left point of the rectangle

  • xmax[in] X coordinate of the upper right point of the rectangle

  • ymax[in] Y coordinate of the upper right point of the rectangle

  • width[in] X dimension of the color index array

  • height[in] Y dimension of the color index array

  • data[in] color array

  • model[in] color model

int gr_importgraphics(char*)
void gr_setshadow(double, double, double)

Allows drawing of shadows, realized by images painted underneath, and offset from, graphics objects such that the shadow mimics the effect of a light source cast on the graphics objects.

Parameters:
  • offsetx[in] An x-offset, which specifies how far in the horizontal direction the shadow is offset from the object

  • offsety[in] A y-offset, which specifies how far in the vertical direction the shadow is offset from the object

  • blur[in] A blur value, which specifies whether the object has a hard or a diffuse edge

void gr_settransparency(double)

Set the value of the alpha component associated with GR colors.

Parameters:

alpha[in] An alpha value (0.0 - 1.0)

void gr_inqtransparency(double*)

Inquire the value of the alpha component associated with GR colors.

Parameters:

alpha[out] A pointer to a double value which will hold the transparency value after the function call

void gr_setcoordxform(double[3][2])

Change the coordinate transformation according to the given matrix.

Parameters:

mat[in] 2D transformation matrix

void gr_begingraphics(char*)

Open a file for graphics output.

gr_begingraphics allows to write all graphics output into a XML-formatted file until the gr_endgraphics functions is called. The resulting file may later be imported with the gr_importgraphics function.

Parameters:

path[in] Filename for the graphics file.

void gr_endgraphics(void)
char *gr_getgraphics(void)
int gr_drawgraphics(char*)
int gr_startlistener(void)
void gr_mathtex(double, double, char*)

Generate a character string starting at the given location. Strings can be defined to create mathematical symbols and Greek letters using LaTeX syntax.

Parameters:
  • x[in] The X coordinate of the starting position of the text string

  • y[in] The Y coordinate of the starting position of the text string

  • string[in] The text string to be drawn

void gr_inqmathtex(double, double, char*, double*, double*)
void gr_mathtex3d(double, double, double, char*, int)

Generate a character string starting at the given location. Strings can be defined to create mathematical symbols and Greek letters using a limited LaTeX syntax.

Parameters:
  • x[in] The X coordinate of the starting position of the text string

  • y[in] The Y coordinate of the starting position of the text string

  • z[in] The Z coordinate of the starting position of the text string

  • string[in] The text string to be drawn

  • axis[in] The plane to draw on (1: YX-plane, 2: XY plane, 3: YZ plane, 4: XZ plane), negative flips direction

void gr_inqmathtex3d(double, double, double, char*, int, double*, double*, double*, double*)

This function calculates the bounding box of the text that would be drawn using gr_mathtex3d. tbx, tby, tbz contain the corner coordinates, while baseline contains the baseline point.

Parameters:
  • x[in] The X coordinate of the starting position of the text string in world coordinates

  • y[in] The Y coordinate of the starting position of the text string in world coordinates

  • z[in] The Z coordinate of the starting position of the text string in world coordinates

  • string[in] The text string that would be drawn

  • axis[in] The plane to draw on (1: YX-plane, 2: XY plane, 3: YZ plane, 4: XZ plane), negative flips direction

  • tbx[in] A 4-element double array to write the x-coordinates of the corners

  • tby[in] A 4-element double array to write the y-coordinates of the corners

  • tbz[in] A 4-element double array to write the z-coordinates of the corners

  • baseline[in] A 3-element (x, y, z) array to write the baseline point coordinates to

void gr_beginselection(int, int)
void gr_endselection(void)
void gr_setbboxcallback(int, void (*)(int, double, double, double, double))
void gr_cancelbboxcallback(void)
void gr_moveselection(double, double)
void gr_resizeselection(int, double, double)
void gr_inqbbox(double*, double*, double*, double*)
double gr_precision(void)
int gr_text_maxsize(void)
void gr_setregenflags(int)
int gr_inqregenflags(void)
void gr_savestate(void)
void gr_restorestate(void)
void gr_savecontext(int)
void gr_selectcontext(int)
void gr_destroycontext(int)
void gr_unselectcontext(void)
int gr_uselinespec(char*)
void gr_delaunay(int, const double*, const double*, int*, int**)
void gr_reducepoints(int, const double*, const double*, int, double*, double*)

Reduces the number of points of the x and y array.

Parameters:
  • n[in] the number of points of the x and y arrays

  • x[in] the x value array

  • y[in] the y value array

  • points[in] the requested number of points

  • x_array[out] the return array for the x values

  • y_array[out] the return array for the y values

void gr_trisurface(int, double*, double*, double*)

Draw a triangular surface plot for the given data points.

Parameters:
  • n[in] The number of points

  • px[in] A pointer to the X coordinates

  • py[in] A pointer to the Y coordinates

  • pz[in] A pointer to the Z coordinates

void gr_gradient(int, int, double*, double*, double*, double*, double*)
void gr_quiver(int, int, double*, double*, double*, double*, int)
void gr_interp2(int nx, int ny, const double *x, const double *y, const double *z, int nxq, int nyq, const double *xq, const double *yq, double *zq, interp2_method_t method, double extrapval)

Interpolation in two dimensions using one of four different methods. The input points are located on a grid, described by nx, ny, x, y and z. The target grid ist described by nxq, nyq, xq and yq and the output is written to zq as a field of nxq * nyq values.

The available methods for interpolation are the following:

INTERP2_NEAREST

0

Nearest neighbour interpolation

INTERP2_LINEAR

1

Linear interpolation

INTERP_2_SPLINE

2

Interpolation using natural cubic splines

INTERP2_CUBIC

3

Cubic interpolation

Parameters:
  • nx[in] The number of the input grid’s x-values

  • ny[in] The number of the input grid’s y-values

  • x[in] Pointer to the input grid’s x-values

  • y[in] Pointer to the input grid’s y-values

  • z[in] Pointer to the input grid’s z-values (num. of values: nx * ny)

  • nxq[in] The number of the target grid’s x-values

  • nyq[in] The number of the target grid’s y-values

  • xq[in] Pointer to the target grid’s x-values

  • yq[in] Pointer to the target grid’s y-values

  • zq[out] Pointer to the target grids’s z-values, used for output

  • method[in] Used method for interpolation

  • extrapval[in] The extrapolation value

const char *gr_version(void)

Returns the version string of the GR runtime.

Returns:

A pointer to the GR runtime version string.

void gr_shade(int, double*, double*, int, int, double*, int, int, int*)
void gr_shadepoints(int, double*, double*, int, int, int)

Display a point set as a aggregated and rasterized image.

The values for x and y are in world coordinates.

The available transformation types are:

XFORM_BOOLEAN

0

boolean

XFORM_LINEAR

1

linear

XFORM_LOG

2

logarithmic

XFORM_LOGLOG

3

double logarithmic

XFORM_CUBIC

4

cubic

XFORM_EQUALIZED

5

histogram equalized

Parameters:
  • n[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

  • xform[in] The transformation type used for color mapping

  • w[in] The width of the grid used for rasterization

  • h[in] The height of the grid used for rasterization

void gr_shadelines(int, double*, double*, int, int, int)

Display a line set as a aggregated and rasterized image.

The values for x and y are in world coordinates. NaN values can be used to separate the point set into line segments.

The available transformation types are:

XFORM_BOOLEAN

0

boolean

XFORM_LINEAR

1

linear

XFORM_LOG

2

logarithmic

XFORM_LOGLOG

3

double logarithmic

XFORM_CUBIC

4

cubic

XFORM_EQUALIZED

5

histogram equalized

Parameters:
  • n[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

  • xform[in] The transformation type used for color mapping

  • w[in] The width of the grid used for rasterization

  • h[in] The height of the grid used for rasterization

void gr_panzoom(double, double, double, double, double*, double*, double*, double*)
int gr_findboundary(int, double*, double*, double, double (*)(double, double), int, int*)
void gr_setresamplemethod(unsigned int)

Set the resample method for resampling.

The available options are:

GKS_K_RESAMPLE_DEFAULT

0x00000000

default

GKS_K_RESAMPLE_NEAREST

0x01010101

nearest neighbour

GKS_K_RESAMPLE_LINEAR

0x02020202

linear

GKS_K_RESAMPLE_LANCZOS

0x03030303

Lanczos

Alternatively, combinations of these methods can be selected for horizontal or vertical upsampling or downsampling:

GKS_K_UPSAMPLE_VERTICAL_DEFAULT

0x00000000

default for vertical upsampling

GKS_K_UPSAMPLE_HORIZONTAL_DEFAULT

0x00000000

default for horizontal upsampling

GKS_K_DOWNSAMPLE_VERTICAL_DEFAULT

0x00000000

default for vertical downsampling

GKS_K_DOWNSAMPLE_HORIZONTAL_DEFAULT

0x00000000

default for horizontal downsampling

GKS_K_UPSAMPLE_VERTICAL_NEAREST

0x00000001

nearest neighbor for vertical upsampling

GKS_K_UPSAMPLE_HORIZONTAL_NEAREST

0x00000100

nearest neighbor for horizontal upsampling

GKS_K_DOWNSAMPLE_VERTICAL_NEAREST

0x00010000

nearest neighbor for vertical downsampling

GKS_K_DOWNSAMPLE_HORIZONTAL_NEAREST

0x01000000

nearest neighbor for horizontal downsampling

GKS_K_UPSAMPLE_VERTICAL_LINEAR

0x00000002

linear for vertical upsampling

GKS_K_UPSAMPLE_HORIZONTAL_LINEAR

0x00000200

linear for horizontal upsampling

GKS_K_DOWNSAMPLE_VERTICAL_LINEAR

0x00020000

linear for vertical downsampling

GKS_K_DOWNSAMPLE_HORIZONTAL_LINEAR

0x02000000

linear for horizontal downsampling

GKS_K_UPSAMPLE_VERTICAL_LANCZOS

0x00000003

lanczos for vertical upsampling

GKS_K_UPSAMPLE_HORIZONTAL_LANCZOS

0x00000300

lanczos for horizontal upsampling

GKS_K_DOWNSAMPLE_VERTICAL_LANCZOS

0x00030000

lanczos for vertical downsampling

GKS_K_DOWNSAMPLE_HORIZONTAL_LANCZOS

0x03000000

lanczos for horizontal downsampling

Parameters:

flag[in] Resample method

void gr_inqresamplemethod(unsigned int*)

Inquire the resample flag status.

Returns:

Resample flag

void gr_path(int, double*, double*, const char*)

Draw paths using given vertices and path codes.

The values for x and y are in world coordinates. n is the number of vertices to use. The codes describe several patch primitives that can be used to create compound paths.

The following path codes are recognized:

Code

Description

x

y

M, m

move

x

y

L, l

line

x

y

Q, q

quadratic Bezier

x1, x2

y1, y2

C, c

cubic Bezier

x1, x2, x3

y1, y2, y3

A, a

arc

rx, a1, reserved

ry, a2, reserved

Z

close path

S

stroke

s

close path and stroke

f

close path and fill

F

close path, fill and stroke

g

close path and fill (nonzero)

G

close path, fill (nonzero) and stroke

  • M, m

    Moves the current position to (x, y). The new position is either absolute (M) or relative to the current position (m). The initial position of gr_path is (0, 0).

    Example:

    double x[2] = {0.5, -0.1};
    double y[2] = {0.2, 0.1};
    gr_path(2, x, y, "Mm");
    
    The first move command in this example moves the current position to the absolute coordinates (0.5, 0.2). The second move to performs a movement by (-0.1, 0.1) relative to the current position resulting in the point (0.4, 0.3).

  • L, l

    Draws a line from the current position to the given position (x, y). The end point of the line is either absolute (L) or relative to the current position (l). The current position is set to the end point of the line.

    Example:

    double x[3] = {0.1, 0.5, 0.0};
    double y[3] = {0.1, 0.1, 0.2};
    gr_path(3, x, y, "MLlS");
    
    The first line to command draws a straight line from the current position (0.1, 0.1) to the absolute position (0.5, 0.1) resulting in a horizontal line. The second line to command draws a vertical line relative to the current position resulting in the end point (0.5, 0.3).

  • Q, q

    Draws a quadratic bezier curve from the current position to the end point (x2, y2) using (x1, y1) as the control point. Both points are either absolute (Q) or relative to the current position (q). The current position is set to the end point of the bezier curve.

    Example:

    double x[5] = {0.1, 0.3, 0.5, 0.2, 0.4};
    double y[5] = {0.1, 0.2, 0.1, 0.1, 0.0};
    gr_path(5, x, y, "MQqS");
    
    This example will generate two bezier curves whose start and end points are each located at y=0.1. As the control points are horizontally in the middle of each bezier curve with a higher y value both curves are symmetrical and bend slightly upwards in the middle. The current position is set to (0.9, 0.1) at the end.

  • C, c

    Draws a cubic bezier curve from the current position to the end point (x3, y3) using (x1, y1) and (x2, y2) as the control points. All three points are either absolute (C) or relative to the current position (c). The current position is set to the end point of the bezier curve.

    Example:

    double x[7] = {0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.3};
    double y[7] = {0.1, 0.2, 0.0, 0.1, 0.1, -0.1, 0.0};
    gr_path(7, x, y, "MCcS");
    
    This example will generate two bezier curves whose start and end points are each located at y=0.1. As the control points are equally spaced along the x-axis and the first is above and the second is below the start and end points this creates a wave-like shape for both bezier curves. The current position is set to (0.8, 0.1) at the end.

  • A, a

    Draws an elliptical arc starting at the current position. The major axis of the ellipse is aligned with the x-axis and the minor axis is aligned with the y-axis of the plot. rx and ry are the ellipses radii along the major and minor axis. a1 and a2 define the start and end angle of the arc in radians. The current position is set to the end point of the arc. If a2 is greater than a1 the arc is drawn counter-clockwise, otherwise it is drawn clockwise. The a and A commands draw the same arc. The third coordinates of the x and y array are ignored and reserved for future use.

    Examples:

    double x[4] = {0.1, 0.2, -3.14159 / 2, 0.0};
    double y[4] = {0.1, 0.4, 3.14159 / 2, 0.0};
    gr_path(4, x, y, "MAS");
    
    This example draws an arc starting at (0.1, 0.1). As the start angle -pi/2 is smaller than the end angle pi/2 the arc is drawn counter-clockwise. In this case the right half of an ellipse with an x radius of 0.2 and a y radius of 0.4 is shown. Therefore the current position is set to (0.1, 0.9) at the end.
    double x[4] = {0.1, 0.2, 3.14159 / 2, 0.0};
    double y[4] = {0.9, 0.4, -3.14159 / 2, 0.0};
    gr_path(4, x, y, "MAS");
    
    This examples draws the same arc as the previous one. The only difference is that the starting point is now at (0.1, 0.9) and the start angle pi/2 is greater than the end angle -pi/2 so that the ellipse arc is drawn clockwise. Therefore the current position is set to (0.1, 0.1) at the end.

  • Z

    Closes the current path by connecting the current position to the target position of the last move command (m or M) with a straight line. If no move to was performed in this path it connects the current position to (0, 0). When the path is stroked this line will also be drawn.

  • S, s

    Strokes the path with the current border width and border color (set with gr_setborderwidth and gr_setbordercolorind). In case of s the path is closed beforehand, which is equivalent to ZS.

  • F, f, G, g

    Fills the current path using the even-odd-rule for F and f or the nonzero / winding rule for G and g in the current fill color. Filling a path implicitly closes the path. The fill color can be set using gr_setfillcolorind. In case of F and G the path is also stroked using the current border width and color afterwards.

Parameters:
  • n[in] The number of points

  • x[in] A pointer to the X coordinates

  • y[in] A pointer to the Y coordinates

  • codes[in] Path codes as a null-terminated string

void gr_setborderwidth(double)

Define the border width of subsequent path output primitives.

Parameters:

width[in] The border width scale factor

void gr_inqborderwidth(double*)
void gr_setbordercolorind(int)

Define the border color of subsequent path output primitives.

Parameters:

color[in] The border color index (COLOR < 1256)

void gr_inqbordercolorind(int*)
void gr_selectclipxform(int)
void gr_inqclipxform(int*)
void gr_setprojectiontype(int)

Set the projection type with this flag.

The available options are:

GR_PROJECTION_DEFAULT

0

default

GR_PROJECTION_ORTHOGRAPHIC

1

orthographic

GR_PROJECTION_PERSPECTIVE

2

perspective

Parameters:

flag[in] projection type

void gr_inqprojectiontype(int*)

Return the projection type.

void gr_setperspectiveprojection(double, double, double)

Set the far and near clipping plane for perspective projection and the vertical field ov view

Switches projection type to perspective

Parameters:
  • near_plane – distance to near clipping plane

  • far_plane – distance to far clipping plane

  • fov – vertical field of view, input must be between 0 and 180 degrees

void gr_inqperspectiveprojection(double*, double*, double*)

Return the parameters for the perspective projection.

void gr_settransformationparameters(double, double, double, double, double, double, double, double, double)

Method to set the camera position, the upward facing direction and the focus point of the shown volume

Parameters:
  • camera_pos_x – x component of the cameraposition in world coordinates

  • camera_pos_y – y component of the cameraposition in world coordinates

  • camera_pos_z – z component of the cameraposition in world coordinates

  • up_x – x component of the up vector

  • up_y – y component of the up vector

  • up_z – z component of the up vector

  • focus_point_x – x component of focus-point inside volume

  • focus_point_y – y component of focus-point inside volume

  • focus_point_z – z component of focus-point inside volume

void gr_inqtransformationparameters(double*, double*, double*, double*, double*, double*, double*, double*, double*)

Return the camera position, up vector and focus point.

void gr_setorthographicprojection(double, double, double, double, double, double)

Set parameters for orthographic transformation

Switches projection type to orthographic

Parameters:
  • left – xmin of the volume in worldcoordinates

  • right – xmax of volume in worldcoordinates

  • bottom – ymin of volume in worldcoordinates

  • top – ymax of volume in worldcoordinates

  • near_plane – distance to near clipping plane

  • far_plane – distance to far clipping plane

void gr_inqorthographicprojection(double*, double*, double*, double*, double*, double*)

Return the parameters for the orthographic projection.

void gr_camerainteraction(double, double, double, double)

Rotate the current scene according to a virtual arcball.

This function requires values between 0 (left side or bottom of the drawing area) and 1 (right side or top of the drawing area).

Parameters:
  • start_mouse_pos_x – x component of the start mouse position

  • start_mouse_pos_y – y component of the start mouse position

  • end_mouse_pos_x – x component of the end mouse position

  • end_mouse_pos_y – y component of the end mouse position

void gr_setwindow3d(double, double, double, double, double, double)

Set the three dimensional window. Only used for perspective and orthographic projection.

Parameters:
  • xmin – min x-value

  • xmax – max x-value

  • ymin – min y-value

  • ymax – max y-value

  • zmin – min z-value

  • zmax – max z-value

void gr_inqwindow3d(double*, double*, double*, double*, double*, double*)
void gr_setscalefactors3d(double, double, double)

Set the scale factor for each axis.

The scaling factors must not be zero.

Parameters:
  • x_axis_scale – factor for scaling the x-axis

  • y_axis_scale – factor for scaling the y-axis

  • z_axis_scale – factor for scaling the z-axis

void gr_inqscalefactors3d(double*, double*, double*)

Returns the scaling factor for each axis.

void gr_setspace3d(double, double, double, double)

Set the camera for orthographic or perspective projection.

The center of the 3d window is used as the focus point and the camera is positioned relative to it, using camera distance, azimuthal angle and polar angle similar to gr_setspace. This function can be used if the user prefers spherical coordinates to setting the camera position directly, but has reduced functionality in comparison to gr_settransformationparameters, gr_setscalefactors3d, gr_setperspectiveprojection and gr_setorthographicprojection.

Parameters:
  • phi – azimuthal angle of the spherical coordinates

  • theta – polar angle of the spherical coordinates

  • fov – vertical field of view(0 or NaN for orthographic projection)

  • cam – distance between the camera and the focus point (in arbitrary units, 0 or NaN for the radius of the object’s smallest bounding sphere)

void gr_inqspace3d(int*, double*, double*, double*, double*)
void gr_text3d(double, double, double, char*, int axis)
void gr_inqtext3d(double, double, double, char*, int axis, double*, double*)

Allows you to get the 2d coordinates and transformed coordinates of a text as if displayed by gr_text3d

The first 8 coordinates are pre-transformation coordinates, while the last 8 coordinates are transformed coordinates The first 4 coordinates each are the corners of the bounding box, including ascender and descender space, while the last 4 coordinates are without ascenders and descenders.

Parameters:
  • x[in] The base X coordinate

  • y[in] The base Y coordinate

  • z[in] The base z coordinate

  • chars[in] The string to draw

  • axis[in] In which direction the text is drawn (1: YX-plane, 2: XY plane, 3: YZ plane, 4: XZ plane)

  • tbx[in] A double array of 16 elements to write x-coordinates to

  • tby[in] A double array of 16 elements to write y-coordinates to

void gr_settextencoding(int)
void gr_inqtextencoding(int*)
void gr_loadfont(char*, int*)

Load a font file from a given filename.

This function loads a font from a given filename and assigns a font index to it. To use the loaded font call gr_settextfontprec using the resulting font index and precision 3.

 int font;
 gr_loadfont(filename, &font);
 gr_settextfontprec(font, 3);
The filename can either be an absolute path or a filename like Arial.ttf. Font files are searched in the directories specified by the GKS_FONT_DIRS environment variable and the operating systems default font locations.

As the font file is internally loaded using FreeType, it is required that FreeType support is compiled in and FreeType has to support the given file type. On error the font index is set to -1.

Parameters:
  • filename[in] The absolute filename of the font

  • font[out] The font index to use with gr_settextfontprec

void gr_setcallback(char *(*)(const char*))
void gr_setthreadnumber(int)

Set the number of threads which can run parallel. The default value is the number of threads the cpu has. The only usage right now is inside gr_cpubasedvolume and gr_volume_nogrid.

Parameters:

num[in] number of threads

void gr_setpicturesizeforvolume(int, int)

Set the width and height of the resulting picture. These values are only used for the volume rendering methods. The default values are 1000 for both.

Parameters:
  • width[in] width of the resulting image

  • height[in] height of the resulting image

void gr_setvolumebordercalculation(int)

Set the gr_volume border type with this flag. This inflicts how the volume is calculated. When the flag is set to GR_VOLUME_WITH_BORDER the border will be calculated the same as the points inside the volume.

The available options are:

GR_VOLUME_WITHOUT_BORDER

0

default value

GR_VOLUME_WITH_BORDER

1

gr_volume with border

Parameters:

flag[in] calculation of the gr_volume border

void gr_setapproximativecalculation(int)

Set if gr_cpubasedvolume is calculated approximative or exact. To use the exact calculation set approximative_calculation to 0. The default value is the approximative version, which can be set with the number 1.

Parameters:

approximative_calculation[in] exact or approximative calculation of the volume

void gr_inqvolumeflags(int*, int*, int*, int*, int*)

Inquire the parameters which can be set for gr_cpubasedvolume. The size of the resulting image, the way the volumeborder is calculated and the amount of threads which are used.

Parameters:
  • border[out] flag which tells how the border is calculated

  • max_threads[out] number of threads

  • picture_width[out] width of the resulting image

  • picture_height[out] height of the resulting image

  • approximative_calculation[out] exact or approximative calculation of gr_cpubasedvolume

void gr_cpubasedvolume(int, int, int, double*, int, double*, double*, double*, double*)

Draw volume data with raycasting using the given algorithm and apply the current GR colormap.

Available algorithms are:

GR_VOLUME_EMISSION

0

emission model

GR_VOLUME_ABSORPTION

1

absorption model

GR_VOLUME_MIP

2

maximum intensity projection

Parameters:
  • nx[in] number of points in x-direction

  • ny[in] number of points in y-direction

  • nz[in] number of points in z-direction

  • data[in] an array of shape nx * ny * nz containing the intensities for each point

  • algorithm[in] the algorithm to reduce the volume data

  • dmin_ptr[inout] The variable this parameter points at will be used as minimum data value when applying the colormap. If it is negative, the variable will be set to the actual occuring minimum and that value will be used instead. If dmin_ptr is NULL, it will be ignored.

  • dmax_ptr[inout] The variable this parameter points at will be used as maximum data value when applying the colormap. If it is negative, the variable will be set to the actual occuring maximum and that value will be used instead. If dmax_ptr is NULL, it will be ignored.

  • min_val[in] array with the minimum coordinates of the volumedata

  • max_val[in] array with the maximum coordinates of the volumedata

const cpubasedvolume_2pass_t *gr_cpubasedvolume_2pass(int, int, int, double*, int, double*, double*, double*, double*, const cpubasedvolume_2pass_t*)

Draw volume data with raycasting using the given algorithm and apply the current GR colormap. This is the two pass version of gr_cpubasedvolume and can be used to retrieve dmin and dmax in a first call before the actual volume is drawn in the second call.

Available algorithms are:

GR_VOLUME_EMISSION

0

emission model

GR_VOLUME_ABSORPTION

1

absorption model

GR_VOLUME_MIP

2

maximum intensity projection

Parameters:
  • nx[in] number of points in x-direction

  • ny[in] number of points in y-direction

  • nz[in] number of points in z-direction

  • data[in] an array of shape nx * ny * nz containing the intensities for each point

  • algorithm[in] the algorithm to reduce the volume data

  • dmin_ptr[inout] The variable this parameter points at will be used as minimum data value when applying the colormap. If it is negative, the variable will be set to the actual occuring minimum and that value will be used instead. If dmin_ptr is NULL, it will be ignored.

  • dmax_ptr[inout] The variable this parameter points at will be used as maximum data value when applying the colormap. If it is negative, the variable will be set to the actual occuring maximum and that value will be used instead. If dmax_ptr is NULL, it will be ignored.

  • min_val[in] array with the minimum coordinates of the volumedata

  • max_val[in] array with the maximum coordinates of the volumedata

  • context[inout] pointer to a cpubasedvolume_2pass_t context struct. In the first pass, this pointer must be NULL. In the second pass, the return value of the first call must be used as context parameter.

Returns:

a context struct in the first pass, NULL in the second pass.

void gr_inqvpsize(int*, int*, double*)
void gr_polygonmesh3d(int, const double*, const double*, const double*, int, const int*, const int*)
void gr_volume_nogrid(unsigned long, const data_point3d_t*, const void*, int, kernel_f, double*, double*, double, radius_f)

Draws unstructured volume data using splatting, given volume rendering model and currently set GR colormap.

Each data point is only calculated and drawn as far as radius/radius_callback. The used interpolation method can be given using callback callback is expected to integrate along a given ray for the given data point. For trilinear interpolation, you can use gr_volume_interp_tri_linear. For interpolation using the multivariate gaussian distribution, you can use gr_volume_interp_gauss.

The supported volume rendering models are:

GR_VOLUME_EMISSION

0

emission model

GR_VOLUME_ABSORPTION

1

absorption model

Parameters:
  • ndt_pt[in] Count of data points (dt_pts)

  • dt_pts[in] The data points to draw

  • extra_data[in] Optional extra data, one for each data point if specified

  • algorithm[in] Selected algorithm to draw

  • callback[in] Callback to use to integrate

  • dmin_val[inout] if set, will contain lower bound of pixel intensity

  • dmax_val[inout] if set, will contain upper bound of pixel intensity

  • radius[in] the calculation radius of each data point in world coordinates

  • radius_callback[in] if given, ignores radius and can return the calculation radius per data point

void gr_volume_interp_tri_linear_init(double, double, double)

Initializes default parameters for trilinear interpolation.

Parameters:
  • grid_x[in] The extent of density

  • grid_y[in] The extent of density

  • grid_z[in] The extent of density

void gr_volume_interp_gauss_init(double, double*)

Initializes default parameters for interpolation using the gaussian multivariate distribution.

if \(\Sigma\) is the covariance matrice:

Parameters:
  • determinant[in] \(\left|\Sigma\right|\)

  • mat[in] \(\Sigma^{-\frac{1}{2}}\)

double gr_volume_interp_tri_linear(const data_point3d_t*, const void*, const point3d_t*, const point3d_t*)

Integrates the given ray through a axis-aligned trilinear interpolation density.

The parameters of the density are set using either gr_volume_interp_tri_linear_init or extra_data (as tri_linear_t)

Parameters:
  • dt_pt[in] The data point with associated intensity and optional density parameters

  • extra_data[in] Optional extra data for data point

  • from[in] Start point of ray

  • len[in] The direction and length of ray

Returns:

The integrated density

double gr_volume_interp_gauss(const data_point3d_t*, const void*, const point3d_t*, const point3d_t*)

Integrates the given ray through a gaussian multivariate distribution.

The parameters of the distribution are set using either gr_volume_interp_gauss_init or extra_data (as gauss_t)

Parameters:
  • dt_pt[in] The data point with associated intensity and optional distribution parameters

  • extra_data[in] Optional extra data for data point

  • from[in] Start point of ray

  • len[in] The direction and length of ray

Returns:

The integrated density

void gr_setmathfont(int font)
void gr_inqmathfont(int *font)
void gr_setclipregion(int region)
void gr_inqclipregion(int *region)
void gr_setclipsector(double start_angle, double end_angle)
void gr_inqclipsector(double *start_angle, double *end_angle)
void gr_settextoffset(double xoff, double yoff)
char *gr_ftoa(char *string, double value, format_reference_t *reference)
void gr_getformat(format_reference_t *result, double origin, double min, double max, double tick_width, int major)
struct vertex_t

Public Members

double x
double y
struct point3d_t
#include <gr.h>

Three-dimensional coordinate

Public Members

double x
double y
double z
struct data_point3d_t
#include <gr.h>

Data point for gr_volume_nogrid

Public Members

point3d_t pt

Coordinates of data point

double data

Intensity of data point

struct gauss_t
#include <gr.h>

Provides optional extra data for gr_volume_interp_gauss

Public Members

double sqrt_det

Square root of determinant of covariance matrix

point3d_t gauss_sig_1
point3d_t gauss_sig_2
point3d_t gauss_sig_3

\(\Sigma^{-\frac{1}{2}}\) encoded as three column vectors

struct tri_linear_t
#include <gr.h>

Provides optional extra data for gr_volume_interp_tri_linear

Public Members

double grid_x_re

Reciproke of interpolation kernel extent in x-direction

double grid_y_re

Reciproke of interpolation kernel extent in y-direction

double grid_z_re

Reciproke of interpolation kernel extent in z-direction

struct cpubasedvolume_2pass_t

Public Members

double dmin
double dmax
int action
cpubasedvolume_2pass_priv_t *priv
struct hexbin_2pass_t

Public Members

int nc
int cntmax
int action
hexbin_2pass_priv_t *priv
struct format_reference_t

Public Members

int scientific
int decimal_digits
struct tick_t

Public Members

double value
int is_major
struct tick_label_t

Public Members

double tick
char *label
double width
struct axis_t

Public Members

double min
double max
double tick
double org
double position
int major_count
int num_ticks
tick_t *ticks
double tick_size
int num_tick_labels
tick_label_t *tick_labels
double label_position
int draw_axis_line