`=̀ =

`_= 0
E0=0=0= 1=1=1= 2=2=2= 3=3=3= =
E=
\== =
E{\fourteenbf}{\twelvecal\def \\ {{\cal \char''6E}}} {\twelvemit\def \\ {{\cal \char''6E}}}
E =height 9.9pt depth 4.1pt width 0pt=height 17pt depth 7pt width 0pt=height 8.5pt depth 3.5pt width 0pt=height 8.5pt depth 3.5pt width 0pt

Grafix
A PC graphics library


By Scott Snyder

Grafix is a simple graphics library for the IBM Color Graphics Adapter (CGA), Enhanced Graphics Adapter (EGA), and compatables. It consists of two parts: a collection of simple primitives and a collection of routines that emulate some of the most common functions of the popular HALO graphics library. Detailed descriptions of the library functions are given on the following pages.

=1000 =24pt by- ==Grafix 1.0 =– –

intro(1)

=0ptNAME

intro — introduction to graphics functions

=0ptDESCRIPTION

Using the library

When writing a program that uses the Grafix library, you should include the file graf.h . This file defines prototypes for all the graphics functions and several symbolic constants. When linking, simply include the Grafix library in the list of libraries you supply to LINK. The small model library is named grafix.lib , and the medium, compact, and large model libraries are named grafixm.lib , grafixc.lib , and grafixl.lib , respectively.

Note that g_init must be the first function in the library to be called, and that g_open must be the second. When you finish with the graphics display, you should call g_close to reset the display to text mode.

Supported hardware

The Grafix library currently supports the following graphics hardware:

IBM Color Graphics Adapter (CGA) with a Color Display or equivalents.

IBM Enhanced Graphics Adapter (EGA) with a Enhanced Graphics Display, with a Color Display, or with a Monochrome Display or equivalents.

Colors

It should be kept in mind that the color values which are passed to the graphics routines and written into the graphics buffers correspond only indirectly to the colors actually displayed on the screen. The mapping between color values and displayed colors can be changed by the g_setback and g_setpal functions. See the ``colors(1)'' manual page for a description of the available colors.

=0ptEXAMPLE

grafex1.c

colors(1)

colors(1)

=0ptNAME

colors — summary of displayable colors

=0ptDESCRIPTION

The following summarizes the displayable colors in the various supported graphics modes.

CGA 320 by 200 four color mode

In this mode, color value 0 is the background. By default it is black but may be changed by use of the g_setback function to any of the following colors:


&val&ue    & &value&&color

&0&& black &1&& blue &2&& green &3&& cyan &4&& red &5&& purple &6&& brown &7&& white &8&& grey &9&& bright blue &10&& bright green &11&& bright cyan &12&& bright red &13&& bright purple &14&& bright yellow &15&& bright white
Color values  1–3 are the foreground, and two color mappings or ``palettes'' are available. By default, palette 1 is active, but it may be changed with the g_setpal function with the following results:


&color&value    &background    & &color value&& $\it palette=0$& $\it palette=1$

&& 0 &background&background && 1 &green&cyan && 2 &red&magenta && 3 &yellow&white

CGA 640 by 200 two color mode

In this mode, color value 0 is the background and is always displayed as black. Color value 1 is the foreground and has a default color of white. This may be changed, however, with the g_setpal function to any of the colors listed as a CGA background color in the previous section.

EGA sixteen color mode

The EGA has 64 displayable colors, 16 of which can be displayed at any time. The displayable colors are represented as a six-bit value with format rgbRGB, where the intensities of of the primary colors (red, green, and blue) are in the range 0–3 and represented as the two-bit values Rr, Gg, and Bb. The mapping of color values to these colors can be changed using the g_setpal function (or g_setback for color value 0). The default mapping is as follows:


&color &value    &bright yellow    &six-bit & &color value&&color&six-bit value

&0&&black&0& &1&&blue&1& &2&&green&2& &3&&cyan&3& &4&&red&4& &5&&purple&5& &6&&brown&20& &7&&white&7& &8&&grey&56& &9&&bright blue&57& &10&&bright green&58& &11&&bright cyan&59& &12&&bright red&60& &13&&bright purple&61& &14&&bright yellow&62& &15&&bright white&63&

=0ptSEE ALSO

=10000

intro(1), g_setback(1), g_setpal(1).

g_box(1)

=0ptNAME

g_box — draw a rectangular box

=0ptSYNOPSIS


void g_box(x1, y1, x2, y2, color)

int x1, y1, x2, y2; unsigned color;

=0ptDESCRIPTION

The g_box function draws the rectangular box defined by the points (x1, y1) and (x2, y2) in the current drawing buffer with color color . If xor mode is on, the rectangle will be logically xor'ed with the existing data in the buffer.

=0ptSEE ALSO

=10000

g_line(1).

g_circle(1)

=0ptNAME

g_circle — draw a circle

=0ptSYNOPSIS


void g_circle(x, y, r, color)

int x, y, r; unsigned color;

=0ptDESCRIPTION

The g_circle function draws a circle centered on the point (x, y) with radius r . The circle is drawn in the current drawing buffer with color color . If xor mode is on, the circle is logically xor'ed with the existing data in the buffer. The radius is taken to be half of the horizontal diameter of the circle, in pixels (because of the graphics display's aspect ratio, this will not in general be the same as the vertical radius of the circle).

=0ptSEE ALSO

=10000

g_ellipse(1).

g_clear(1)

=0ptNAME

g_clear — clear the area within the clipping boundary to a given color

=0ptSYNOPSIS


void g_clear(color)

unsigned color;

=0ptDESCRIPTION

The g_clear function sets all the pixels within the current clipping boundary in the current drawing buffer to color color .

=0ptSEE ALSO

=10000

g_clearall(1), g_regfill(1), g_setclip(1).

g_clearall(1)

=0ptNAME

g_clearall — clear an entire buffer to a specified color

=0ptSYNOPSIS


void g_clearall(color)

unsigned color;

=0ptDESCRIPTION

The g_clearall function sets the entire current drawing buffer to color color , regardless of clipping boundaries. For clearing the entire screen, g_clearall should be somewhat faster than g_clear .

=0ptSEE ALSO

=10000

g_clear(1).

g_close(1)

=0ptNAME

g_close — terminate graphics drawing

=0ptSYNOPSIS


void g_close()

=0ptDESCRIPTION

The g_close function terminates graphics drawing and resets the display to 80-column text mode.

=0ptSEE ALSO

=10000

g_init(1), g_open(1).

g_ellipse(1)

=0ptNAME

g_ellipse — draw an ellipse

=0ptSYNOPSIS


void g_ellipse(x, y, r_sub_m, aspect, color)

int x, y, r_sub_m; float aspect; unsigned color;

=0ptDESCRIPTION

The g_ellipse function draws an ellipse in the current drawing buffer with color color centered on the point (x, y) with semi-major axis length r_sub_m and aspect ratio aspect . The aspect ratio is defined as the ratio of the vertical diameter of the ellipse to its horizontal diameter, and the semi-major axis length is half the length of the largest diameter (which is vertical if aspect > 1.0 and horizontal if aspect < 1.0). If xor mode is on, the ellipse will be logically xor'ed with the existing data in the buffer. Note that this routine can only be used to draw ellipses that have their axes oriented horizontally and vertically.

=0ptBUGS

The aspect ratio of the screen is not accounted for in this routine. If you want to have an ellipse drawn in the same shape on all supported displays, get the display's aspect ratio with the g_info call and multiply your desired aspect ratio by it before passing it to g_ellipse .

=0ptSEE ALSO

=10000

g_circle(1), g_info(1).

g_info

=0ptNAME

g_info — get information about the graphics device in use

=0ptSYNOPSIS


void g_info(info)

struct g_info *info;

=0ptDESCRIPTION

The g_info function copies parameters for the current mode and adapter into the structure info . The g_info structure is defined in the file graf.h as:

by 1em


`=̀ ##1 `
=0 struct g_info unsigned card; unsigned display; unsigned xsize, ysize; unsigned xchsize, ychsize; unsigned colormax; unsigned pages; unsigned curpage; ;
Card and display contain the current types of the graphics card and the graphics display, respectively (the types are defined in graf.h ). Xsize and ysize contain the X and Y sizes of the display, xchsize and ychsize contain the size of the screen in characters, and colormax contains the maximum color value (i.e., if there are four colors, colormax will be 3). Pages contains the number of displayable pages that the graphics adapter supports and curpage contains the page that is currently being displayed.

G_info must be called after the display is opened with g_open .

=0ptSEE ALSO

=10000

g_init(1), g_open(1).

=0ptNAME

g_init — initialize the graphics library

=0ptSYNOPSIS


void g_init(card, display)

unsigned card, display;

=0ptDESCRIPTION

The g_init function initializes the graphics library for the graphics card and display in use. If g_init is called with card set to zero, it will attempt to determine what graphics hardware is attached. The display parameter is ignored in this case and may be omitted. If card is one of the (nonzero) symbolic constants for graphics adapters defined in graf.h , the graphics library assumes that that card is attached. In this case, the parameter display must also be specified as one of the symbolic constants defined in graf.h .

This function must be called before any others.

=0ptSEE ALSO

=10000

g_open(1), g_close(1), g_info(1).

g_line(1)

=0ptNAME

g_line — draw a line

=0ptSYNOPSIS


void g_line(x1, y1, x2, y2, color)

int x1, y1, x2, y2; unsigned color;

=0ptDESCRIPTION

The g_line function draws a line in the current drawing buffer with color color between the points (x1, y1) and (x2, y2). If xor mode is on, the line is logically xor'ed with the existing data in the buffer.

=0ptSEE ALSO

=10000

g_box(1), g_point(1).

g_open(1)

=0ptNAME

g_open — turn on graphics mode and prepare for drawing

=0ptSYNOPSIS


void g_open(mode)

unsigned mode;

=0ptDESCRIPTION

The g_open function switches the display to a graphics mode and prepares the graphics routines for drawing. The interpretation of the mode parameter is device-dependent. Currently, on the CGA, mode = CGA_640 is the 640 by 200 two color mode, and mode = CGA_320 is the 320 by 200 four color mode. The CGA_640 and CGA_320 constants are defined in graf.h . On the EGA, the mode parameter is ignored, and the display is opened in the 640 by 350 sixteen color mode using the Enhanced Color Display, the 640 by 200 sixteen color mode using the Color Display, and the 640 by 350 monochrome mode using the Monochrome Display. To use an EGA in a CGA mode, pass CGA as the card parameter to g_init .

Besides setting the graphics mode, the g_open function also clears the screen, resets the color mapping to the default, turns off xor mode and screen buffering, and resets the clipping boundaries to the physical boundaries of the screen.

This function must be called after g_init , and before any other graphics functions.

=0ptSEE ALSO

=10000

g_init(1), g_close(1), g_info(1).

g_point(1)

=0ptNAME

g_point — plot a point

=0ptSYNOPSIS


void g_point(x, y, color)

int x, y; unsigned color;

=0ptDESCRIPTION

The g_point function sets the point (x, y) in the current drawing buffer to color color . If xor mode is on, the point is xor'ed with the existing data in the buffer.

=0ptSEE ALSO

=10000

g_line(1).

g_regfill(1)

=0ptNAME

g_regfill — fill a rectangular region with a color

=0ptSYNOPSIS


void g_regfill(x1, y1, x2, y2, color)

int x1, y1, x2, y2; unsigned color;

=0ptDESCRIPTION

The g_regfill function sets all the points in the current drawing buffer within the rectangle defined by the points (x1, y1) and (x2, y2) (and within the current clipping boundary) to color color .

=0ptBUGS

Doesn't support xor mode

=0ptSEE ALSO

=10000

g_clear(1).

g_setback(1)

=0ptNAME

g_setback — set the background color

=0ptSYNOPSIS


void g_setback(color)

unsigned color;

=0ptDESCRIPTION

The g_setback function changes the color displayed for the background color value (0).

The actual functioning of this routine depends on the graphics mode as follows:

CGA 640 by 200 two color mode

The g_setback function does not work in this mode.

CGA 320 by 200 four color mode

The color parameter should be the value of one of the colors listed in the CGA background color table on the ``colors(1)'' manual page.

EGA sixteen color mode

The color parameter is a six-bit color value as discussed on the EGA section in the ``colors(1)'' manual page.

=0ptBUGS

Doesn't work in the CGA two color mode.

=0ptSEE ALSO

=10000

intro(1), colors(1), g_setpal(1).

g_setbuf(1)

=0ptNAME

g_setbuf — turn on screen buffering

=0ptSYNOPSIS


void g_setbuf(flag)

unsigned flag;

=0ptDESCRIPTION

The g_setbuf function turns screen buffering on, if flag is nonzero, or off if flag is zero. When screen buffering is on, drawing takes place in an off-screen buffer, instead of in the buffer that is currently being displayed. This off-screen buffer can then be made visible almost instantaneously with the g_show function. This can be a great help in achieving smooth animation and other effects.

There is, however, one important consideration to keep in mind. For effeciency reasons, the g_show function is implemented differently on different graphics devices. On the CGA, the drawing is done in a single off-screen buffer which is then copied to the physical screen buffer when g_show is called. On the EGA, which has two display pages, drawing is done in the page that is not visible and the pages are swapped when g_show is called. This means that immediately after calling g_show on a CGA, the drawing buffer contains a copy of the image being shown on the display. But immediately after calling it on an EGA, the drawing buffer contains the image that was visible just before it was called. This difficulty can be avoided by the simple expedient of erasing the active area of the drawing buffer immediately after every call to g_show .

=0ptSEE ALSO

=10000

g_show(1).

g_setclip(1)

=0ptNAME

g_setclip — set the clipping boundaries

=0ptSYNOPSIS


void g_setclip(x1, y1, x2, y2)

int x1, y1, x2, y2;

=0ptDESCRIPTION

The g_setclip function restricts drawing to the rectangular area defined by the points (x1, y1) and (x2, y2). Points that lie outside this rectangle (the ``clipping boundaries'') will be protected from change by any the routines that respect the clipping boundaries. The clipping boundaries cannot be set outside of the physical screen. The functions which respect the clipping boundaries are g_box, g_circle, g_clear, g_ellipse, g_line, g_point, and g_regfill .

g_setpal(1)

=0ptNAME

g_setpal — change the color mapping

=0ptSYNOPSIS


void g_setpal(palette, value)

unsigned palette, value;

=0ptDESCRIPTION

The g_setpal function allows one to change the mapping between the foreground color values passed to the graphics routines and the visible colors actually displayed.

The actual functioning of this routine depends on the graphics mode in use as follows:

CGA 640 by 200 two color mode

The g_setpal function changes the color of the foreground color value (1). The value of palette is ignored, and value should be the value of one of the colors listed in CGA background color table in the ``colors(1)'' manual page. The visible color of the foreground will be changed to this color.

CGA 320 by 200 four color mode

In this mode, the value parameter is ignored, and palette should be either 0 or 1. The displayed colors are given by the following table:


&color&value    &background    & &color value&& $\it palette=0$& $\it palette=1$

&& 0 &background&background && 1 &green&cyan && 2 &red&magenta && 3 &yellow&white

EGA sixteen color mode

In this mode, the g_setpal function directly sets the visible color of the color value given by palette to value , which is a six-bit color as discussed in the EGA section of the ``colors(1)'' manual page.

=0ptSEE ALSO

=10000

intro(1), colors(1), g_setback(1).

g_setxor(1)

=0ptNAME

g_setxor — turn xor mode on or off

=0ptSYNOPSIS


void g_setxor(flag)

unsigned flag;

=0ptDESCRIPTION

The g_setxor function turns xor mode on if flag is nonzero, or off if flag is zero. When xor mode is off, drawn objects are simply written over existing data in the drawing buffer. But if xor mode is on, drawn objects are logically xor'ed with the existing data. Thus if an object is drawn twice in a row in exactly the same position with xor mode on, it will be completely erased after the second drawing and the image on the screen restored to its state previous to the first drawing. This makes xor mode useful for animation and other effects. Functions which support xor mode are g_box, g_circle, g_ellipse, g_line, and g_point .

g_show(1)

=0ptNAME

g_show — make the drawing buffer visible

=0ptSYNOPSIS


void g_show()

=0ptDESCRIPTION

If screen buffering is on, the g_show function makes the drawing buffer visible by either copying it to the physical screen buffer (on adapters with only one page) or swapping it with the currently visible page (on adapters with more than one page). If screen buffering is off, g_show does nothing.

See the description of the g_setbuf function for further discussion of screen buffering.

=0ptSEE ALSO

=10000

g_setbuf(1).

g_writech(1)

=0ptNAME

g_writech — write a character

=0ptSYNOPSIS


void g_writech(row, col, ch, color, page)

unsigned row, col; char ch; unsigned color; int page;

=0ptDESCRIPTION

The g_writech function writes the single character ch at character position (row, col) with color color . If page is -1, the character is written to the current drawing buffer; otherwise it is written to page page (note: this is not supported with the CGA, as it only has one page).

=0ptBUGS

With the CGA adapter, the page parameter is ignored.

Xor mode is not supported.

Clipping boundaries are not respected.

=0ptSEE ALSO

=10000

g_writestr(1).

g_writestr(1)

=0ptNAME

g_writestr — write a string teletype style

=0ptSYNOPSIS


void g_writestr(row, col, s, color, page)

unsigned row, col; char *s; unsigned color; int page;

=0ptDESCRIPTION

The g_writestr writes the null-terminated string pointed to by s starting at character position (row, col) with color color . If page is -1, the character is written to the current drawing buffer; otherwise it is written to page page (note: this is not supported with the CGA, as it only has one page).

The characters are written from left to right, top to bottom. If the writing goes off the right edge of the screen, it continues at the beginning of the next line. If the writing goes off the bottom of the screen, the function is aborted.

The only special characters recognized are newline (octal 12), which causes the writing to wrap around to the beginning of the next line, and carriage return (octal 15) which is simply ignored.

=0ptBUGS

With the CGA adapter, the page parameter is ignored.

Xor mode is not supported.

Clipping boundaries are not respected.

=0ptSEE ALSO

=10000

g_writech(1).

intro(2)

=0ptNAME

intro — introduction to halo emulation library

=0ptDESCRIPTION

The halo emulation library is a collection of routines that emulate some of the most frequently used routines of the popular HALO graphics library. It was written to assist in converting HALO programs to the Grafix library.

To use the halo functions, you should include the file halo.h at the start of your program and link with the graphics library as usual.

Most of these functions are fairly straightforward; however, there are a few things you should be aware of. First of all, and probably most important, all the parameters to all the halo routines must be passed by reference, i.e., you must pass pointers to the desired arguments to the graphics routines, not the arguments themselves. Second, the halo routines remember one point, called the graphics cursor, and a color, called the current drawing color. The halo drawing routines use these values instead of explicitly passed parameters in many instances. They may be set with the movabs , movrel , and setcolor functions. And third, the halo drawing routines always take world coordinates, never device coordinates (as is possible in the original HALO library).

=0ptEXAMPLE

grafex2.c

box(2)

=0ptNAME

box — draw a rectangular box

=0ptSYNOPSIS


void box(x1, y1, x2, y2)

float *x1, *y1, *x2, *y2;

=0ptDESCRIPTION

The box function draws the rectangular box defined by the points (*x1, *y1) and (*x2, *y2) (in world coordinates) in the current drawing buffer with the current drawing color. If xor mode is on, the rectangle is logically xor'ed with the existing data in the buffer.

=0ptSEE ALSO

=10000

g_box(1).

cir(2)

=0ptNAME

cir — draw a circle

=0ptSYNOPSIS


void cir(r)

float *r;

=0ptDESCRIPTION

The g_cir function draws a circle centered on the current graphics cursor with radius r (in world coordinates). The circle is drawn in the current drawing buffer with the current drawing color. If xor mode is on, the circle is logically xor'ed with the existing data in the buffer. The radius is taken to be half of the horizontal diameter of the circle, in world coordinates.

=0ptSEE ALSO

=10000

g_circle(1).

coordinates(2)

=0ptNAME

coordinates — coordinate systems used

=0ptDESCRIPTION

The halo routines utilize three different coordinate systems: device, normalized device, and world. The following sections explain these coordinate systems and their interrelationships.

Device coordinates

The first and simplest coordinate system is device coordinates. In device coordinates, the origin is at the upper left corner of the screen and the axes are scaled in pixels. Thus in the four-color mode of the CGA, for example, device coordinates range from (0, 0) to (319, 199). All the graphics routines listed in section 1 of this manual use device coordinates. Device coordinates are always expressed as integers.

to 4in(0, 0)(319, 0)


to 4inheight3in to 3inDevice coordinates height3in

to 4in(0, 199)(319, 199)


Normalized device coordinates

In normalized device coordinates, the origin is still the upper left corner of the screen, but the point (1.0, 1.0) is fixed at the lower right corner. This allows one to specify coordinates without knowing the physical size of the screen. Normalized device coordinates are always expressed as floats.

to 4in(0.0, 0.0)(1.0, 0.0)


to 4inheight3in to 3inNormalized device coordinates height3in

to 4in(0.0, 1.0)(1.0, 1.0)


World coordinates

In world coordinates you can set up a coordinate system with an arbitrary offset and scale. For example, if you want to have the x coordinates range from -100 to +100 and the y coordinates range from -50 to +50, you would call the setworld function as follows:

by 1em


`=̀ ##1 `
=0 x1 = -100.0; /* lower left corner */ y1 = -50.0; x2 = 100.0; /* upper right corner */ y2 = 50.0; setworld(&x1, &y1, &x2, &y2);
This sequence results in the following situation:

to 4in(-100.0, 50.0)(100.0, 50.0)


to 4inheight3in to 3inWorld coordinates height3in

to 4in(-100.0, -50.0)(100.0, -50.0)


Coordinate transformations

The following routines are available for converting points from one coordinate system to another: mapdton — convert device to normalized device coordinates mapdtow — convert device to world coordinates mapntod — convert normalized device to device coordinates mapntow — convert normalized device to world coordinates mapwtod — convert world to device coordinates mapwton — convert world to normalized device coordinates

Viewports

Viewports allow one to draw only on a portion of the screen. For example, if we wanted the same coordinate system as we had in the last example but we wanted to use only the upper left corner of the screen, we could use:

by 1em


`=̀ ##1 `
=0 x1 = 0.0; /* upper left corner of viewport in NDC */ y1 = 0.0; x2 = 0.5; /* lower right corner of viewport in NDC */ y2 = 0.5; c = -1; /* no border or clearing */ setviewport(&x1, &y1, &x2, &y2, &c, &c);

x1 = -100.0; /* lower left corner */ y1 = -50.0; x2 = 100.0; /* upper right corner */ y2 = 50.0; setworld(&x1, &y1, &x2, &y2); This results in the following:

to 4in(-100.0, 50.0)to 2in(100.0, 50.0)


to 4inheight 3in to 3into 2in to 1.5in Viewport height 1.5in

to 2in(-100.0, -50.0) to 3in

(100.0, -50.0) height 3in


Note that the viewport corners are specified using normalized device coordinates.

=0ptSEE ALSO

=10000

mapdton(2), mapdtow(2), mapntod(2), mapntow(2), mapwtod(2), mapwton(2), setworld(2), setviewport(2).

halo_init(2)

=0ptNAME

halo_init — initialize the halo routines

=0ptSYNOPSIS


void halo_init()

=0ptDESCRIPTION

The halo_init function initializes the halo routines, resets the viewport to the entire screen, and resets world coordinates to device coordinates (i.e., x coordinates range from 0 to the x size of the device, similarly for y coordinates). It also moves the graphics cursor to (0, 0) and sets the current drawing color to 0. This function must be called after every call to g_open and before any other halo routines are used.

=0ptSEE ALSO

=10000

g_open(1).

lnabs(2)

=0ptNAME

lnabs — draw a line to a specified point

=0ptSYNOPSIS


void lnabs(x, y)

float *x, *y;

=0ptDESCRIPTION

The lnabs function draws a line from the current graphics cursor position to the point (*x, *y) in world coordinates and the graphics cursor is set to (*x, *y). The line is drawn in the current drawing buffer with the current drawing color. If xor mode is on the line is logically xor'ed with the existing data in the buffer.

=0ptSEE ALSO

=10000

g_line(1), lnrel(2).

lnrel(2)

=0ptNAME

lnrel — draw a line relative to the current graphics cursor position

=0ptSYNOPSIS


void lnrel(dx, dy)

float *dx, *dy;

=0ptDESCRIPTION

The lnrel function draws a line from the current graphics cursor to the point (cur_x + *dx, cur_y + *dy) in world coordinates, where (cur_x, cur_y) is the current position of the graphic cursor. After the line is drawn, the graphics cursor is moved to (cur_x + *dx, cur_y + *dy). The line is drawn in the current drawing buffer with the current drawing color. If xor mode is on the line is logically xor'ed with the existing data in the buffer.

=0ptSEE ALSO

=10000

g_line(1), lnabs(2).

mapdton(2)

=0ptNAME

mapdton — map device to normalized device coordinates

=0ptSYNOPSIS


void mapdton(dx, dy, nx, ny)

int *dx, *dy; float *nx, *ny;

=0ptDESCRIPTION

The mapdton function converts the device coordinates (*dx, *dy) to the corresponding normalized device coordinates (*nx, *ny).

=0ptSEE ALSO

=10000

coordinates(2), mapdtow(2), mapntod(2), mapntow(2), mapwtod(2), mapwton(2), setworld(2), setviewport(2).

mapdtow(2)

=0ptNAME

mapdtow — map device to world coordinates

=0ptSYNOPSIS


void mapdtow(dx, dy, wx, wy)

int *dx, *dy; float *wx, *wy;

=0ptDESCRIPTION

The mapdtow function converts the device coordinates (*dx, *dy) to the corresponding world coordinates (*wx, *wy).

=0ptSEE ALSO

=10000

coordinates(2), mapdton(2), mapntod(2), mapntow(2), mapwtod(2), mapwton(2), setworld(2), setviewport(2).

mapntod(2)

=0ptNAME

mapntod — map normalized device to device coordinates

=0ptSYNOPSIS


void mapntod(nx, ny, dx, dy)

float *nx, *ny; int *dx, *dy;

=0ptDESCRIPTION

The mapntod function converts the normalized device coordinates (*nx, *ny) to the corresponding device coordinates (*dx, *dy).

=0ptSEE ALSO

=10000

coordinates(2), mapdton(2), mapdtow(2), mapntow(2), mapwtod(2), mapwton(2), setworld(2), setviewport(2).

mapntow(2)

=0ptNAME

mapntow — map normalized device to world coordinates

=0ptSYNOPSIS


void mapntow(nx, ny, wx, wy)

float *nx, *ny; float *wx, *wy;

=0ptDESCRIPTION

The mapntow function converts the normalized device coordinates (*nx, *ny) to the corresponding world coordinates (*wx, *wy).

=0ptSEE ALSO

=10000

coordinates(2), mapdton(2), mapdtow(2), mapntod(2), mapwtod(2), mapwton(2), setworld(2), setviewport(2).

mapwtod(2)

=0ptNAME

mapwtod — map world to device coordinates

=0ptSYNOPSIS


void mapwtod(wx, wy, dx, dy)

float *wx, *wy; int *dx, *dy;

=0ptDESCRIPTION

The mapwtod function converts the world coordinates (*wx, *wy) to the corresponding device coordinates (*dx, *dy).

=0ptSEE ALSO

=10000

coordinates(2), mapdton(2), mapdtow(2), mapntod(2), mapntow(2), mapwton(2), setworld(2), setviewport(2).

mapwton(2)

=0ptNAME

mapwton — map world to normalized device coordinates

=0ptSYNOPSIS


void mapwton(wx, wy, nx, ny)

float *wx, *wy; float *nx, *ny;

=0ptDESCRIPTION

The mapwton function converts the world coordinates (*wx, *wy) to the corresponding normalized device coordinates (*nx, *ny).

=0ptSEE ALSO

=10000

coordinates(2), mapdton(2), mapdtow(2), mapntod(2), mapntow(2), mapwtod(2), setworld(2), setviewport(2).

movabs(2)

=0ptNAME

movabs — move the graphics cursor to a specified point

=0ptSYNOPSIS


void movabs(x, y)

float *x, *y;

=0ptDESCRIPTION

The movabs function moves the graphics cursor to the position (*x, *y) in world coordinates.

=0ptSEE ALSO

=10000

movrel(2).

movrel(2)

=0ptNAME

movrel — move the graphics cursor relatively

=0ptSYNOPSIS


void movrel(dx, dy)

float *dx, *dy;

=0ptDESCRIPTION

The movrel function moves the graphics cursor to the position (cur_x + *dx, cur_y + *dy) in world coordinates where (cur_x, cur_y) is the current position of the graphics cursor.

=0ptSEE ALSO

=10000

movabs(2).

setcolor(2)

=0ptNAME

setcolor — set the current drawing color

=0ptSYNOPSIS


void setcolor(c)

int *c;

=0ptDESCRIPTION

The setcolor function sets the current drawing color to c . If c is greater than the maximum color value available on the graphics device in use, the maximum value is used instead.

setviewport(2)

=0ptNAME

setviewport — set the active viewport

=0ptSYNOPSIS


void setviewport(x1, y1, x2, y2, border, backgnd)

float *x1, *y1, *x2, *y2; int *border, *backgnd;

=0ptDESCRIPTION

The setviewport function sets the viewport and the clipping boundaries to the rectangular area defined by the points (x1, y1) and (x2, y2) in normalized device coordinates. If border is not -1, a border of color border will be drawn around the viewport (if there is room for it), and if backgnd is not -1, the interior of the viewport will be cleared to color backgnd .

=0ptSEE ALSO

=10000

g_setclip(1), coordinates(2), setworld(2).

setworld(2)

=0ptNAME

setworld — set world coordinates

=0ptSYNOPSIS


void setworld(x1, y1, x2, y2)

float *x1, *y1, *x2, *y2;

=0ptDESCRIPTION

The setworld function changes the current world coordinate system. The world coordinates of the lower left corner of the viewport become (x1, y1), and the world coordinates of the upper right corner of the viewport become (x2, y2).

=0ptSEE ALSO

=10000

coordinates(2), setviewport(2).

setxor(2)

=0ptNAME

setxor — turn xor mode on or off

=0ptSYNOPSIS


void setxor(flag)

int *flag;

=0ptDESCRIPTION

The setxor function turns xor mode on if *flag is nonzero, or off if *flag is zero. When xor mode is off, drawn objects are simply written over existing data in the drawing buffer. But if xor mode is on, drawn objects are logically xor'ed with the existing data. Thus if an object is drawn twice in a row in exactly the same position with xor mode on, it will be completely erased after the second drawing and the image on the screen restored to its state previous to the first drawing. This makes xor mode useful for animation and other effects. Functions which support xor mode are g_box, g_circle, g_ellipse, g_line, g_point, box, cir, lnabs, and lnrel .

P>