


      GRAF(3X)                   (Bull-SPS9)                   GRAF(3X)



      NAME
           graf - low-level graphics library for Bull-SPS9 Monochrome
           Display

      SYNTAX
           #include <sys/graf.h>

           int g_init (screenForm)
           struct Form *screenForm;

           int g_readpixel (x, y)
           int x, y;

           g_writepixel (x, y, color)
           int x, y, color;

           g_drawline (x0, y0, x1, y1)
           int x0, y0, x1, y1;

           g_flush ()

           g_clbm ()

           g_clscreen ()

           g_pencolor (color)
           int color;

           g_penwidth (width)
           int width;

      DESCRIPTION
           The graf library allows low-level graphics access to the
           Bull-SPS9 Monochrome Display disp(7).  These functions are
           used to create graphic images in the calling process' own
           address space, a part of which is mapped to the display
           screen as described in the Bull-SPS9 Multi-Window Display
           Management Guide.

           These functions operate directly on the display bitmap of
           the process, and provide no synchronization with other
           processes which may also be updating the display screen, and
           thus may interfere with manipulations of the screen by the
           multi-window display management software.

           The g_init function must be called once before the other
           functions to allow internal data structures to be
           initialized.  An ioctl(2) system call is made using the open
           file descriptor 2 (stderr) to determine the size of the
           screen and the starting address of the display bitmap.
           These values are returned in the structure pointed to by
           screenForm, as defined in the include file:



      Page 1                                         (73 A2 02MTA REV1)






      GRAF(3X)                   (Bull-SPS9)                   GRAF(3X)



                struct Form {
                        int width;
                        int height;
                        unsigned int *bits;
                };

           The height and width of the screen are measured in pixels,
           and the address in virtual memory of the display bitmap is
           placed in the bits field.  A non-zero value returned by
           g_init indicates an error, such as not having file
           descriptor 2 bound to a Bull-SPS9 monochrome display.

           The value returned by g_readpixel is the content of the bit
           found at the location specified by x and y.  The address is
           relative to the top left corner of the screen, which is
           addressed as 0,0.  The value returned is either Black or
           White, as defined in the include file; the value -1 is
           returned if the address is out of range for the screen.

           The content of the bit found at the location specified by x
           and y is set to the given color by g_writepixel.  The colors
           Black and White set the bit to the value as defined in the
           include file, while any other color value will cause the bit
           to be complemented.

           G_drawline draws the pixels that correspond to a straight
           line segment from the point specified as x0,y0 to the point
           specified as x1,y1.  Display device coordinates are used,
           and the line is clipped to the edges of the screen.  The
           default color of lines is Black, and the width is one pixel,
           but either of these attributes may be changed as described
           below.  For efficiency, specialized algorithms are used for
           the common cases of horizontal or vertical lines, or lines
           that are one pixel wide.

           The function g_flush is called to flush the display bitmap
           in main memory to the display controller refresh memory.
           Any pages in the display bitmap that have been modified will
           be written to the refresh memory, causing the screen image
           to be updated.

           No change to the screen image occurs until the bitmap is
           flushed, so this function may be used to get the effect of
           ``double-buffering'', where the screen displays the previous
           image while a new image is being created in the bitmap.
           G_clbm clears the display bitmap to White, in preparation
           for further drawing.  G_clscreen clears the screen by
           calling g_clbm followed by g_flush.

           G_pencolor sets the color to be used for line-drawing
           according to color.  The color value determines whether
           black or white pixels are used by g_drawline.  The values



      Page 2                                         (73 A2 02MTA REV1)






      GRAF(3X)                   (Bull-SPS9)                   GRAF(3X)



           Black (the initial color) and White are defined in the
           include file, while any other value will cause subsequent
           lines to be drawn using pixels which are the complement of
           the current background.

           G_penwidth sets the width in pixels of lines according to
           width.  The initial width is one, but any value greater than
           zero may be specified, and will be used for all subsequent
           lines drawn by g_drawline.

      FILES
           /usr/lib/libgraf.a

      SEE ALSO
           Bull-SPS9 Multi-Window Display Management Guide
           CopyBits(3X)







































      Page 3                                         (73 A2 02MTA REV1)



