F003 (2D Graphics C Library)
July 1990
INMOS document number: 72-OEK-244-00
66 Pages
© INMOS Limited 1990.
IMS F003 overview and environment
The IMS F003 software provides a two dimensional graphics library, functionally conformant with a subset of the Computer Graphics Interface (CGI) standard. This library is sufficiently flexible to allow it to be used as a building block to implement additional 2-dimensional graphics operations, or indeed, 3-dimensional graphics systems.
Functions in the library fall into a number of clearly defined areas. A family of functions exists for drawing points, lines, and arcs. Another family handles two dimensional drawing operations and fills. The text support provided by another family is expandable by the programmer to accommodate personalized font information. Two dimensional screen-pixel operations offer block copying, zooming, and rotation. An auxiliary category handles miscellaneous initialization of the graphics card and data structures used by the rest of the library.
In order to separate those parts of the graphics software that are hardware dependent, a supplementary library called B419.LIB provides framestore-specific initialization, multi-frame display buffering, and colour control, for the INMOS IMS B419 graphics card.
The CGI library will be useful in application areas from engineering drawing to mimic diagrams, from interactive drawing and modelling to concept visualization.
For brevity, the software will be referred to as the CGI library throughout this document.
The IMS F003 CGI software has been implemented in ANSI C, using the INMOS TCOFF Toolset C compiler.
There are two libraries provided. The main library CGILIB.LIB, handles all the CGI drawing operations which are independent of the chosen graphics card. It is supplied in binary form as a library, compatible with the INMOS TCOFF toolset.
The supplementary library, B419.LIB, adapts the behaviour of the main CGI library to run on the IMS B419 graphics TRAM (or compatible). This TRAM can form part of an arbitrary transputer network. The IMS B419 can support a wide range of display resolutions and pixel rates. The CGI library can be used with all of these, by simply altering initialization parameters to functions in the B419.LIB library at runtime. A major benefit accruing from this design decision is that the library can be used with other hardware by simply linking in a different hardware library. Further, facilities for altering the display parameters at run-time, and for convenient multiframe buffer access and colour control, are all isolated from the main CGI library with clean documented interfaces.
A programmer can access functions in the libraries from a C application. For the C programmer, a source header file, CGIDEFS.H, defines the prototypes of functions that can be accessed from user applications. This header file is included with the users' C source prior to compilation.
Files comprising the graphics library
There are six files on the diskette:
- B419.LIB
- CGIDEFS.H
- CGITYPES.H
- CGILIB.LIB
- EXAMPLE.C
- README
These should be copied to the appropriate directory.
Contents
1 IMS F003 overview and environment 1.1 Files comprising the graphics library 2 IMS F003 detail description 2.1 CGI conformance Table of graphical primitive functions Table of CGI attribute functions 2.2 Summary of functions 2.2.1 Plotting functions 2.2.2 Fill functions 2.2.3 Text functions 2.2.4 Image functions 2.2.5 Setup functions 2.2.6 Auxiliary functions 2.2.7 Hardware-dependent functions 2.3 Application areas 2.4 General concepts 2.4.1 Plot styles 2.4.2 Fill mode 2.4.3 Logical modes 2.5 Using the library 2.5.1 Choosing your monitor parameters 2.5.2 Compilation requirements 2.5.3 Linking requirements 2.5.4 An example program 2.5.5 Interpolation 2.5.6 Achieving transparency 2.6 General notes 2.6.1 The graphics card 2.6.2 Architecture 2.6.3 Initialization 2.6.4 Multiple plotting 2.6.5 Performance considerations 2.6.6 System extensions 3 Library functions 3.1 Alphabetic list of implemented functions 3.2 CGILIB.LIB functions 3.2.1 cgi_addsptext 3.2.2 cgi_addtext 3.2.3 cgi_arc 3.2.4 cgi_arcc 3.2.5 cgi_chrbegin 3.2.6 cgi_chrspace 3.2.7 cgi_chrz 3.2.8 cgi_circle 3.2.9 cgi_cls 3.2.10 cgi_copy 3.2.11 cgi_disjpolyline 3.2.12 cgi_dot 3.2.13 cgi_errstat 3.2.14 cgi_fcircle 3.2.15 cgi_ffan 3.2.16 cgi_fhline 3.2.17 cgi_frect 3.2.18 cgi_ftrap 3.2.19 cgi_init 3.2.20 cgi_line 3.2.21 cgi_paint 3.2.22 cgi_polygon 3.2.23 cgi_polyline 3.2.24 cgi_rect 3.2.25 cgi_rot 3.2.26 cgi_search 3.2.27 cgi_setbcol 3.2.28 cgi_setdrawmode 3.2.29 cgi_setdrawscreen 3.2.30 cgi_setfcol 3.2.31 cgi_setfillstyle 3.2.32 cgi_setfont 3.2.33 cgi_setlinestyle 3.2.34 cgi_setorient 3.2.35 cgi_setpelstyle 3.2.36 cgi_sptext 3.2.37 cgi_strokearc 3.2.38 cgi_text 3.2.39 cgi_zoom 3.3 B419.LIB functions 3.3.1 fs_displaybank 3.3.2 fs_initscreen 3.3.3 fs_initVTG 3.3.4 fs_screenaddr 3.3.5 fs_setpalette