Contents
The OzAPI software is being developed to support the porting of the
OzGIS mapping system from the WINDOWS 3.1 (using MS FORTRAN 5.1, MS ‘C’
and the WIN3.1 SDK). The decision was made to spend more time to see if
the software could be made of general use.
OzAPI is developed using Visual C++ V4.0 and MS Fortran Powerstation
V4.0 under MS NT workstation 4.0
OzAPI can hence be used to develop or port FORTRAN code for 32bit WINDOWS
applications using MS Fortran Powerstation a nd presumeably DEC Visual
Fortran. It should be able to be used with any FORTRAN that can call and
be called by MS ‘C’ functions e.g. MS FORTRAN 5.1) with some hacking, but
you will probably need Visual C++ so you have the resource compiler, a
current linker and some include files.
The major component is a demonstration program that shows all the facilities.This
is also the development environment.
OzAPI allows the latest software development techniques to be applied
(i.e. you get the demo program running and hack it around to get what you
want).
You are free to use OzAPI to develop programs. If there is sufficient
interest the source code will be made available for purchase at a nominal
(I.e. exorbitant) price. There is nothing fancy about the software, but
it takes a lot of time to find relevant documentation.
OzAPI comes with an industry standard guarantee i.e. there isnt one!
You use the software at your own risk!
OzAPI will be enhanced to provide more facilities for OzGIS and other
features may be added upon request or if anyone donates source code.
OzAPI and OzGIS are available on the Net and are developed by:
Lloyd Simons,
The Clever Company P/L
Box 6108 East Queanbeyan
Australia 2620.
FAX +61 2 6299 3211
lse.simons@bigpond.com
First
Execute OzAPI.exe and work through the menu options to see what you can do.To develop an application you will first build this demonstartion program from the supplied files and then modify it (and incorporate your own code) to generate your WINDOWS application.
API Files
OzAPI.obj The WINDOWS main program
*.for FORTRAN files that you modify
OzAPI.lib Library of functions
OzAPI.rc Resource file. Some modifications may be made.
Res subdirectory of icons, bitmaps etc. Some modifications may be made.
OzAPI.hlp The help file. Optional. You may find it useful to initially
incorporate this for quick reference to the API functions.
Function parameters
Integers: Are all INTEGER*4
Logical: Are all LOGICAL*4
Reals: Are all REAL*4
Text: Input parameters are ‘C’ strings, which differ from Fortran character values in that they are terminated by a NULL byte i.e. CHAR(0) in FORTRAN-speak.
Examples are: 1. ‘Hello’C in MS Powerstation
2. ‘Hello’ // char(0)
3. character*40 string
character*1 null
null = char(0)
write (string, 100) num, null
100 format (‘Number is’,i4, a1)
etc
Be carefull of the blank filling of character types
Be especially careful to remember the null terminator
Character*n: These are used for input arrays, although the members are still C strings.
Where they are output arrays too the lengths must be specified and the
values will return as ordinary blank filled Fortran types.
MS Fortran / DEC
If you are using MS Development Studio with Fortran Powerstation, DEC
visual Fortran or any other Fortran the procedure to set up a new application
is as follows:
File->New and select project Workspace
Select Application
Give the program a name and a directory
From the command line copy the above API files into the directory (including res\*.*)
Insert->Files into project and give ozapi.obj, *.for and ozapi.rc
Build->Settings and select Link, Input. Put OzAPI.lib at front of library
list. You will also need msvcrtd.lib in the ignore libraries list.
Then build, and if you are lucky you should have a program that will
run.
An example set of files APIdemo.* are provided. You can set up a directory
called APIdemo and copy the files, and those above, to it.
Other Fortrans
You will probably need Visual C++ for the resource compiler and header files. This does give you a WINDOWS debugger.
Set up a directory.
From the command line copy the above API files into the directory (including res\*.*)
You will need to compile the *.FOR files and the resource file ozapi.rc
Link OzAPI.obj as the main program and reference the OzAPI.lib library.
Look at the APIdemo.mak file (if you can see past the garbage). If you
use NMAKE you can probably use it.
The OzAPI.inc file defines the ‘C’ function calls to Fortran Powerstation,
and will need to be modified for other compilers. For example the format
is different for MS Fortran 5.1
The file OzFTN.h defines the Fortran subroutines to Visual C++.
MS FORTRAN 5.1
There has been a quick attempt to use OzAPI on a WIN95 system, and some
*51* files are included.
You have to put ftn51.inc at the front of each fortran source file and
include ftn51def.inc in reach routine.
See menu51.for which is a replacement for ozmenu.for (as the compiler
kept running out of memory).
Problems came when trying to run the resource co0mpiler. A compiler
from Visual C++ was used. Some *.rc and *.h files from visual C++ were
required. Some DLLs were also required, so at this stage it was decided
that you probably need a new version of Visual C++.
Linking was tested, but a new linker was also required.
Source Modifications
You will need to modify all the *.FOR files for your application. They
are fairly well documented.
OZCURSOR.FOR - This is the call-back function when a cursor mode has
been set. Either add your code to handle the user’s selections or make
it a dummy routine if cursors are not used.
OZINISTP.FOR - Contains routines that are called at the start of the
program (on the first paint message) and at the end after the window has
been destroyed. You will normally generate your menus and carry out any
one-time initialisation in the start routine, and any termination code
in the end routine (but nothing that needs the window).
OZMENU.FOR - This is the call-back function that is activated whenever
the user chooses a menu item. In particular the handle given to identify
the menu item when it was created is passed so you know what was selected.
OZNEWDOC.FOR - This is a call-back function that is called at the start of the program and whenever File->New is chosen.
OZSERIAL.FOR - Call-back fuction that is activated when data are stored
or retrieved into the program by File->Save or File->Open. Most of the
processing is handled by the application framework,. Basically it is just
a matter of providing the addresses of data that are to be serialised (in
Windoze-speak) and the framework will either read or write it. You simply
place your global data in common blocks and reference the start of each
block and give its length (from a linker map file).
Resource Modifications
You will make most modifications within MS Development Studio. If you
are not using it you can edit OzAPI.rc with a bit of care.
Edit OzAPI.rc to change the saved file definition used in the File->Save etc menu items:
IDR_MAINFRAME "OzAPI\n\nOzAPI\nOzAPI Files (*.oza)\n.OZA\nOzAPI.Document\nOzAPI
Document"
Modify the About dialog for your application.
Modify the program icon.
The Files menu is usually present to provide file saving, printing and
program exit. If you dont want any of these the resource has to be modified.
Note that plotting is handled by the print mechanism via an appropriate
driver.
OZADDPULLDOWN
Description: Sequentially add pulldown menus to the menu bar.
Definition: INTEGER FUNCTION OZADDPULLDOWN (STRING)
Parameters: Name In/Out Type Description
C++: extern "C" long ozaddpulldown (char* string);
Notes: It is usual to add menu items immediately after defining the pulldown, which saves storing the handle.
Menus are usually defined in the OZINIT subroutine.
OZADDMENUITEM
Description: Sequentially adds items to a pulldown menu.
Definition: INTEGER FUNCTION OZADDMENUITEM (PULLDOWN, STRING,
IDENT)
Parameters: Name In/Out Type Description
PULLDOWN I Int The handle of the pulldown menu
STRING I Cstring The item text
IDENT I Int A unique identifier for the menu item.
Returns: Handle of the menu item within the pulldown (1,2,3…)
C++: extern "C" long ozaddmenuitem (long* pullDown, char* string,
long* Id);
Notes: When a user selects the menu item the call-back subroutine is called. You place your code to handle the selection there. See the file OZMENU.FOR
C
C IPULL = THE PULLDOWN MENU (1-10), 0=POPUP MENU
C ITEM = WHICH PULLDOWN ITEM
C IDENT = THE IDENTIFIER SPECIFIED WHEN CREATED
Description: Removes all items from a pulldown menu.
Definition: SUBROUTINE OZCLEARPULLDOWN (PULLDOWN)
Parameters: Name In/Out Type Description
PULLDOWN int The pulldown menu’s handle.
C++: extern "C" void ozclearpulldown (long* pullDown);
Notes: The entry is still there in the menu bar.
OZCLEARALLMENUS
Description: Remove all menus and clear the menu bar.
Definition: SUBROUTINE OZCLEARALLMENUS
C++: extern "C" void ozclearallmenus ();
Notes: initialises ready for a different set of menus.
OZADDPOPUPITEM
Description: Sequentially adds items to a popup menu.
Definition: INTEGER FUNCTION OZADDPOPUPITEM (STRING, IDENT)
Parameters: Name In/Out Type Description
STRING I Cstring The text that appears in the menu
IDENT I integer The identifier psassed to the menu callback routine
Returns: The item handle (1,2,3….)
C++: extern "C" long ozaddpopupitem (char* string, long* Id);
Notes: See OZADDMENUITEM.
OZCLEARPOPUPMENU
Description: Initialises for a new popup menu by removing all
items.
Definition: SUBROUTINE OZCLEARPOPUPMENU
C++: extern "C" void ozclearpopupmenu ();
Notes: saffdgfdsgfdsgsfgf
OZDISPLAYPOPUP
Description: Displays the current popup menu.
Definition: SUBROUTINE OZDISPLAYPOPUP
C++: extern "C" void ozdisplaypopup ();
Notes: The menu only allows one selection.
OZMESSAGEBOX
Description: Display of standard Windows message boxes.
Definition: INTEGER FUNCTION OZMESSAGEBOX (STRING, ITYPE, ICON,
IDEFAULT)
Parameters: Name In/Out Type Description
ITYPE I Integer The type of message box.
2 = The message box has just the OK button.
3 = The message box has OK and Cancel
4 = The message box has Retry and cancel
5 = The message box has Yes and No
6 = The message box has Yes, No and Cancel
2 = Information
3 = Question mark
4 = Stop sign
5 = xxx
6 = xxx
0 = ran out of memory
1 = Abort
2 = Cancel
3 = Ignore
4 = No
5 = OK
6 = Retry
7 = Yes
C++: extern "C" long ozmessagebox (char* text, long* type, long*
icon, long* button);
Notes: The user can disable the warning beep by using the Control Panel
Sound application.
OZINTDLG
Description: Asks for an integer value.
Definition: INTEGER FUNCTION OZINTDLG (PROMPT, MIN, MAX, DEFAULT)
Parameters: Name In/Out Type Description
MIN I Integer minimum acceptable value.
MAX I Integer maximum acceptable value.
DEFAULT I Integer default value.
C++: extern "C" long ozintdlg (char* prompt, long* min, long*
max, long* default)
OZREALDLG
Description: Asks for a real value.
Definition: REAL FUNCTION OZREALDLG (PROMPT, MIN, MAX, DEFAULT)
Parameters: Name In/Out Type Description
MIN I Real minimum acceptable value.
MAX I Real maximum acceptable value.
DEFAULT I Real default value.
C++: extern "C" float ozrealdlg (char* prompt, float* min, float*
max, float* default)
OZSTRINGDLG
Description: Accepts a string from the user.
Definition: SUBROUTINE OZSTRINGDLG (PROMPT, STRING, LENGTH)
Parameters: Name In/Out Type Description
STRING O character Strng typed by user.
LENGTH I Integer Size of output STRING character variable.
Notes: Make sure you get the length right as it is blank filled e.g.
CHARACTER*40 TEXT needs a value of 40
OZLISTBOXDLG
Description: Displays a list from which a selection can be made..
Definition: INTEGER FUNCTION OZLISTBOXDLG (PROMPT, ITEMS,
ITEMS I Character Array for list.
ITEMSIZE I Integer Items are
C++: extern "C" long ozlistboxdlg (char* prompt, char* items,
long* itemSize, long* numItems);
Notes: You will often sort the array first.
OZFILELISTBOXDLG
Description: Displays a listbox populated from a file.
Definition: SUBROUTINE OZFILELISTBOXDLG (PROMPT, FILENAME, ITEM,
- ITEMTEXT, LENTEXT)
Parameters: Name In/Out Type Description
FILENAME I Cstring The file.
ITEM O Integer The record number of the selected item.
ITEMTEXT O Char The text of the selected item.
LENTEXT I Int ITEMTEXT is CHARACTER*LENTEXT
char* text, long* lenStr)
Notes: Keep the file records to < 100 chars.
OZTEXTDLG
Description: Display the contents of an ascii file in a dialog.
Definition: SUBROUTINE OZTEXTDLG (FILENAME)
Parameters: Name In/Out Type Description
Notes: Keep the file records to < 100 chars.
OZHELPCONTENTS
Description: SUBROUTINE OZHELPCONTENTS (FNAME).
Definition: Display contents from windows help file.
Parameters: Name In/Out Type
.
Notes: Try one of the shareware Help File systems off the Net to prepare
your help.
OZHELPINDEX
Description: SUBROUTINE OZHELPINDEX (FNAME).
Definition: Display index from windows help file.
Parameters: Name In/Out Type Description
OZABOUT
Description: Displays the help dialog.
Definition: SUBROUTINE OZABOUT ()
C++: extern "C" void ozabout ();
Notes: Edit the About dialog that comes with OzAPI.
OZCOLOURDLG
Description: Standard dialog to allow a colour to be chosen & a standard set of 16 colours
Parameters: Name In/Out Type Description
GREEN I Real .
BLUE I Real .
ICUST I Integer Dimension 32.
C++: extern "C" BOOL ozcolourdlg (float* red, float* green, float* blue,
OZFILENAME
Description: Displays the standard File Open / Save dialogs.
Definition: LOGICAL FUNCTION OZFILENAME (SAVEFILE, FNAME,
NUMPATTERN, FILTERNAME, NAMESIZE,
PATTERN, PATTERNSIZE)
New file name on output
range 256 - 300
Make it CHARACER*256!
DEFEXTN I Cstring Default extension e.g. ‘DAT’.
PATTERNSIZE I Integer PATTERN is
C++: extern "C" BOOL ozfilename (BOOL* save, char* fileName,
long* numPattern, char* filterName, long* nameSize,
Notes: You must get all the parameters right. If the dialog displays
but theres something wrong ITS YOUR FAULT!. (and its not obvious what the
parameters are!)
Serialization is the term for saving and restoring the programs environment
to files. E.g. a wordprocessor saves documents.
The process is handled by the application framework and initiated by
the File->Save and File->Open menu items. When the user selects the menu
item the OZSERIAL.FOR module is called. All you have to do is reference
all the data that you need to save and restore. Usually you just reference
the first variable in each common block and give the length of that block.
OZSERIALSTRING
Description: Serialise a character variable.
Definition: CHARACTER*?? STRING
SUBROUTINE OZSERIALSTRING(STRING, LENGTH)
Parameters: Name In/Out Type Description
length I Integer number of chars.
Notes: Can be start of common block.
OZSERIALREAL
Description: Serialise a real variable.
Definition: SUBROUTINE OZSERIALREAL(VAR)
Parameters: Name In/Out Type Description
OZSERIALINT
Description: Serialise a real variable.
Definition: SUBROUTINE OZSERIALINT(VAR)
Parameters: Name In/Out Type Description
OZSERIALREALARRAY
Description: Serialise a real array.
Definition: REAL VAR(??)
SUBROUTINE OZSERIALREALARRAY(VAR, LENGTH)
Parameters: Name In/Out Type Description
length I Integer array size.
Notes: Can be start of common block.
OZSERIALINTARRAY
Description: Serialise a real array.
Definition: REAL VAR(??)
SUBROUTINE OZSERIALINTARRAY(VAR, LENGTH)
Parameters: Name In/Out Type Description
length I Integer array size.
Notes: Can be start of common block.
OZTITLE
Description: Displays text in the main window title bar..
Definition: SUBROUTINE OZTITLE (STRING)
Parameters: Name In/Out Type Description
Notes: Usually called from the OZINIT subroutine to set the program
title. Can also be used for trace messages.
BUSY CURSOR
Description: These functions turn the cursor to the busy hourglass
shape..
Definition: SUBROUTINE OZBUSY
SUBROUTINE OZNOTBUSY
C++: extern "C" void ozbusy ();
A set of graphics functions are provided that were originally based
on the FORTRAN bindings of the GKS standard. They have now been distorted
to fit the WONDOZE environment, and enable traditional interactive graphics
on a single window.
Segments are the core of the display mechanism.
Segments hold graphics data in memory:
Window definitions
Viewport definitions
Polygons
Lines
markers
Text
When windows needs to redraw the screen the contents of all the segments are displayed. This occurs
When the window is resized
Upon user request
When printing.
When the program outputs graphics they are actually stored in the current
segment and displayed only when a request to update the screen or print
is issued.
Segments are displayed in order (1,2,3….) and the data within each segment
in the order that it was added. Care needs to be taken with segment order
e.g. as solid polygons will overwrite anything on the screen they would
normally be added to a segment with a lower number than that used to hold
text.
GOPKS
Description: Inititialise GKS functions.
Definition: CALL GOPKS
C++: extern "C" void gopks ()
Notes: Must be called at start of program.
GCLKS
Description: Terminates use of GKS functions.
Definition: CALL GCLKS
C++: extern "C" void gclks ()
Notes: Should be called at end of program.
GOPWK
Description: Open a workstation.
Definition: SUBROUTINE GOPWK (IDWK, IDCON, ITYPE)
Parameters: Name In/Out Type Description
idcon I integer connection id .
itype I integer workstation type,0=output, 2=input-output.
Notes: Called before any drawing takes place.
There is only one workstation in this implementation so the parameters
are redundant. However you should probably have a variable for the workstation
ID that you use in all calls - just in case multiple workkstations (windows)
are implemented later.
Printing is done with the WINDOZE facilities, so there is no special
workstation required.
GCLWK
Description: Close workstation.
Definition: CALL GCLWK (IDWK)
Parameters: Name In/Out Type Description
Notes: Called when drawing is complete.
GACWK
Description: SUBROUTINE GACWK (IDWK).
Definition: Activate workstation
Parameters: Name In/Out Type Description
Notes: Called before drawing.
GDAWK
Description: SUBROUTINE GDAWK (IDWK).
Definition: Dectivate workstation
Parameters: Name In/Out Type Description
Notes: Called after drawing.
GCLRWK
Description: Clear workstation.
Definition: SUBROUTINE GCLRWK (IDWK, ICTRL).
Parameters: Name In/Out Type Description
ictrl I Integer control flag, 0=conditional, 1=always.
Notes: Clears the screen i.e. clears all segments.
Description: Update workstation..
Definition: SUBROUTINE GUWK (IDWK, ICTRL)
Parameters: Name In/Out Type Description
ictrl I Integer control flag.
Notes: Tells WINDOWS to repaint the screen. The contents of the segments are displayed.
GPL
Description: Draw polyline..
Definition: DIMENSION PX(), PY()
px I Real array X values in world coordinates.
py I Real array Y values in world coordinates.
C++: extern "C" long gpl (long* n, float* px, float* py)
Notes: Adds a line to the current segment i.e. vertices and current
attributes.
GPM
Description: Draw polymarker ..
Definition: DIMENSION PX(), PY()
px I Real array X values in world coordinates.
py I Real array Y values in world coordinates.
C++: extern "C" long gpm (long* n, float* px, float* py)
Notes: Adds a set of markers to the current segment i.e. vertices and
current attributes.
GFA
Description: Draw filled area.
Definition: DIMENSION PX(), PY()
LOGICAL BND
px I Real array X values in world coordinates.
py I Real array Y values in world coordinates.
bnd I logical If boundaries are to be drawn.
C++: extern "C" long gfa (long* num, float* px, float* py, long*
bnd)
Notes: Adds a polygon to the current segment i.e. vertices and current attributes.
The current line colour is used for the boundary.
GTX
Description: Draw text ..
Definition: SUBROUTINE GTX (PX, PY, STRING)
Parameters: Name In/Out Type Description
py I Real Y value in world coordinates.
string I Cstring The text.
C++: extern "C" long gtx (float* px, float* py, char* pString)
Notes: Adds a text string to the current segment i.e. point, string
and current attributes.
GFRECT
Description: Draw a filled rectangle.
Definition: SUBROUTINE GFRECT (X1,X2,Y1,Y2)
Parameters: Name In/Out Type Description
X2 I Real X value in world coordinates.
Y1 I Real Y value in world coordinates.
Y2 I Real Y value in world coordinates.
C++: extern "C" long gfrect (float* x1, float* x2, float* y1,
float* y2)
Notes: Easy way of displaying a rectangle by giving the corners. Handled
internally as a polygon.
GUPDPL
Description: Update attributes of a polyline.
Definition: SUBROUTINE GUPDPL (IHAND, ITYPE, IWIDTH, ICOLOUR)
Parameters: Name In/Out Type Description
itype I Integer new line type.
iwidth I Integer newline width.
icolour I Integer new colour.
Notes: Changes the attributes of a polyline within the current segment.
The handle is the identifier returned when created. Hence enables the appearance
to be modified..
GUPDPM
Description: Update attributes of a polymarker.
Definition: SUBROUTINE GUPDPM (IHAND, SIZE, ICOLOUR)
Parameters: Name In/Out Type Description
size I Real new marker size.
icolour I Integer new colour.
Notes: Changes the attributes of a polymarker within the current segment.
The handle is the identifier returned when created. Hence enables the appearance
to be modified..
GUPDFA
Description: Update attributes of a filled area.
Definition: SUBROUTINE GUPDFA (IHAND, ICOLOUR)
Parameters: Name In/Out Type Description
icolour I Integer new colour.
Notes: Changes the attributes of a polygon within the current segment.
The handle is the identifier returned when created. Hence enables the appearance
to be modified..
GSSEG
Description: set current segment.
Definition: SUBROUTINE GSSEG (ISEG)
Parameters: Name In/Out Type Description
Notes: Defines the current segment i.e. where drawing primitives are
to be stored..
GSLN
Description: Sets the line type.
Definition: SUBROUTINE GSLN (ITYPE)
Parameters: Name In/Out Type Description
Notes: Line types are:
1 = solid
2 = dashed
3 = dotted
4 = dash dot
5 = dash dot dot
The line width must be 1 for patterns to be applied.
GSLW
Description: Define polyline width.
Definition: SUBROUTINE GSLW (IWIDTH)
Parameters: Name In/Out Type Description
Notes: Defines the line width in pixels. Usually 1..
GSPLCI
Description: Set polyline colour index.
Definition: SUBROUTINE GSPLCI (ICOLOUR)
Parameters: Name In/Out Type Description
Notes: The index is to the colour look-up table (or palette).
GSMK
Description: Set the marker type.
Definition: SUBROUTINE (MTYPE)
Parameters: Name In/Out Type Description
Notes: The type is the character number within the marker font.
GSMKSIZE
Description: Set the marker size.
Definition: SUBROUTINE GSMKSIZE (SIZE)
Parameters: Name In/Out Type Description
Notes: Sets character size. The size is given in normalised device coordinates
i.e. range 0 to 1.0, being the proportion of the window.
GSPMCI
Description: Set polymarker colour index.
Definition: SUBROUTINE GSPMCI (ICOLOUR)
Parameters: Name In/Out Type Description
Notes: The index is to the colour look-up table (or palette).
WINFNT
Description: Defines the fonts that can be used.
Definition: SUBROUTINE WINFNT (NAME, IDENT)
Parameters: Name In/Out Type Description
ident I Integer Identifier (1-10).
Notes: Fonts can be chosen from those listed in the Fonts section of the control panel.
Fonts default to the System font.
Description: Defines the font to be used for drawing markers.
Definition: SUBROUTINE MRKFNT (NAME,)
Parameters: Name In/Out Type Description
Notes: The font can be chosen from those listed in the Fonts section of the control panel.
The font defaults to the Wingdings font.
Description: Set font and precision.
Definition: SUBROUTINE GSTXFP (IFONT, IPREC)
Parameters: Name In/Out Type Description
iprec I Integer precision, 0=string, 1=char, 2=stroke.
Notes: Default precision is currently used.
Description: Set text character height.
Definition: SUBROUTINE GSCHH (HT)
Parameters: Name In/Out Type Description
GSCHXP
Description: Set character expansion factor.
Definition: SUBROUTINE GSCHXP (RATIO)
Parameters: Name In/Out Type Description
Notes: Default x/y ratio is 0.75.
GSTXCI
Description: Set text colour index.
Definition: SUBROUTINE GSTXCI (ICOLOUR)
Parameters: Name In/Out Type Description
Notes: The index is to the colour look-up table (or palette).
GSTXP
Description: set text path.
Definition: SUBROUTINE GSTXP (IPATH)
Parameters: Name In/Out Type Description
Notes: Sets direction that text is to be drawn.
GSTXAL
Description: set text alignment.
Definition: SUBROUTINE GSTXAL (IHORIZ, IVERT)
Parameters: Name In/Out Type Description
ivert I integer vertical, 1=top, 4=base.
Notes: Defines alignment of text relative to drawing point..
GSFAIS
Description: set fill area interior style.
Definition: SUBROUTINE GSFAIS (ISTYLE)
Parameters: Name In/Out Type Description
Notes: Solid fill is most likely to be used. Style codes are:
2=diagonal hatch at 45
3=horiz/vert hatch
4=cross hatch at 45
5=diagonal hatch at 135
6=horizontal hatch
GSFACI
Description: Set polyline colour index.
Definition: SUBROUTINE GSFACI (ICOLOUR)
Parameters: Name In/Out Type Description
Notes: The index is to the colour look-up table (or palette).
GSCR
Description: set colour representation.
Definition: SUBROUTINE GSCR (IDWK, INDEX, RED, GREEN, BLUE)
Parameters: Name In/Out Type Description
index I integer colour index (0 - 255).
Red I real red intensity (0.0 - 1.0)
Green I real green intensity (0.0 - 1.0)
Blue I real blue intensity (0.0 - 1.0)
Notes: Sets the colour look-up table. Basically defines the colour for
each pixel value. E.g. the video memory is usually initialised to zero,
so the background colour is index zero.
Colour palettes are complicated:
The designers of the WINDOZE API know that you are an idiot and cannot be trusted to directly handle colours.
Designers of display systems know that 256 simultaneous colours is already more than you deserve and are not going to give you any more..
Windows reserves 16 colours for a standard VGA and an extra 4 colours for super VGAs. This could be what they are:
1.0 1.0 1.0 WHITE (BACKGROUND)
0.0 0.0 1.0 RED
0.0 0.0 0.5 DARK RED
0.5 0.0 0.5 DARK MAGENTA
0.5 0.0 0.0 DARK BLUE
0.5 0.5 0.0 DARK CYAN
0.0 0.5 0.0 DARK GREEN
0.0 0.5 0.5 DARK YELLOW
1.0 0.0 1.0 MAGENTA
1.0 1.0 0.0 CYAN
0.0 1.0 0.0 GREEN
0.0 0.0 0.0 BLACK
0.0 1.0 1.0 YELLOW
0.753 0.753 0.753 DARK GREY
1.0 0.0 0.0 BLUE
0.5 0.5 0.5 GREY
Hence on the usual 256 colour system you can define an additional (256-20)
colours.
The colours you load into the table are matched to those in the actual
hardware lookup table. If you load too many colours (e.g. if are operating
in 16 colour mode) the system will match colouirs the best it can.
So if you load any of the standard colours (red, green etc) they will always be matched exactly. Often this will be all you need. The order doesnt matter.
If you need many colours simply load up to 256 of them and you will
get something that will look OK.
Complications are likely to arise when colours are allocated for other
purposes such as displaying lots of bit maps that each have different colour
paletrtes.
GSLUT
Description: set whole 256 value colour look-up table.
Definition: DIMENSION RED(256), GREEN(256),BLUE(256)
SUBROUTINE GSLUT(IDWK, RED, GREEN, BLUE)
Parameters: Name In/Out Type Description
Red I real array red intensity (0.0 - 1.0)
Green I real array green intensity (0.0 - 1.0)
Blue I real array blue intensity (0.0 - 1.0)
Notes: Convenient way of seeting all colours. See GSCR..
GSWN
Description: Define window.
Definition: SUBROUTINE GSWN (ITRANS, XMIN, XMAX, YMIN, YMAX)
Parameters: Name In/Out Type Description
xmin I real Drawing range.
xmax I real Drawing range.
ymin I real Drawing range.
ymax I real Drawing range.
Notes: Defines world coordinate system (user coordinates, drawing coordinates).
See GSVP.
Description: Set viewport.
Definition: SUBROUTINE GSVP (ITRANS, XMIN, XMAX, YMIN, YMAX)
Parameters: Name In/Out Type Description
xmin I real Screen range (0.0 - 1.0).
xmax I real Screen range (0.0 - 1.0).
ymin I real Screen range (0.0 - 1.0).
ymax I real Screen range (0.0 - 1.0) Use max 0.75.
Notes: The viewport is the part of the screen that the current window
is defined on. i.e. points are transformed from the world coordinates defined
by the window onto the viewport.
The viewport is defined in normalised device coordinate (N.D.C.) i.e.
range 0 - 1.
Hence a WINDOZE window is actually a viewport (but the designers of
the WINDOZE API seem to have no knowledge of basic computer graphics).
The viewport and window are stored in the current segment. As segments
may not be drawn in the order that graphics are defined in the program
it is good practice to ensure that the window and viewport are defined
at the start of each segment (they can be changed as required).
The window and viewport do not have to have the same aspect ratio, but
they often will.
As the user can resize the wiindow (the WINDOZE window that is) the
viewport will actually be transformed to the screen so that a viewport
with aspect ratio 4:3 will always be visible). Hence use a maximum viewport
(0, 1.0, 0, 0.75). Note that the GKS workstation window and workstation
viewport are superceded by this process.
GSCLIP
Description: Set clipping.
Definition: LOGICAL CLIP
SUBROUTINE GSCLIP (CLIP)
Parameters: Name In/Out Type Description
Notes: Turning on clipping stops any graphics outside the viewport (and
window) from appearing..
GDEFN
Description: Get screen parameters.
Definition: SUBROUTINE GDEFN (NOPIX, NOLINE, NOLUT)
Parameters: Name In/Out Type Description
noline I integer no lines down screen .
nolut I integer number of colour palette entries.
Notes: Returns drawing area currently used in aspect ratio 4:3.
GINLC
Description: Initialise locator. Set cursor mode.
Definition: DIMENSION START(20)
loctype I integer type of locator.
start I real initial data where required.
ihand I integer Identifier to be passed to the
Notes: Sets the cursor into a mode. The user clicks the left button
to initiate a selection. When the button is released the cursor parameters
are passed to the ozcursor callback routine. See OZCURSOR.FOR
The cursor mode must be explicitly disabled. There are also a set of
single selection functions.
The window / viewport of the current segment is applied, so the segment
MUST be chosen before the call.
The cursor type is:
. 0 = none, disable
1 = cross hair (point)
2 = box cursor (select both corners)
3 = circle type, select centre & outside point
4 = straight line (select both ends)
5 = fixed size box
6 = digitise line
Initial data is required for:
fixed size box - size of box in world coords X then Y size
GRQLC
Description: request locator (Cross hair point cursor).
Definition: SUBROUTINE GRQLC (IDWK, PX, PY)
Parameters: Name In/Out Type Description
px O Real X value in world coordinates.
py O Real Y value in world coordinates.
Notes: Returns a location selected by the user..
GRQBOX
Description: request locator - box type, select both corners.
Definition: SUBROUTINE GRQBOX (IDWK, XMIN, XMAX, YMIN, YMAX)
Parameters: Name In/Out Type Description
xmin O real Box corner. World coordinates.
xmax O real Box corner.
ymin O real Box corner.
ymax O real Box corner.
Notes: Enables selection of two corners of a rectangular area.
GRQFB
Description: request locator - fixed size box.
Definition: SUBROUTINE GRQFB (IDWK, XMIN, XMAX, YMIN, YMAX)
Parameters: Name In/Out Type Description
xmin I/O real Box corner. World coordinates.
xmax I/O real Box corner.
ymin I/O real Box corner.
ymax I/O real Box corner.
Notes: Enables selection of a rectangular area of fixed size. The initial
values define the size.
GRQCIRC
Description: request locator - circle type
Definition: SUBROUTINE GRCIRC (IDWK, PX, PY, RADIUS)
Parameters: Name In/Out Type Description
px O Real X centre in world coordinates.
py O Real Y centre in world coordinates.
radius O Real radius of circle in world coordinates.
Notes: select centre, then outside point.
GRQLIN
Description: request locator - line type.
Definition: SUBROUTINE GRQLIN (IDWK, X1, Y1, X2, Y2)
Parameters: Name In/Out Type Description
X1 O real Start. World coordinates.
Y1 O real Start.
X2 O real End.
Y2 O real End.
Notes: Select both ends.
GRQDIG
Description: request locator - digitise a line
Definition: REAL PX(NSIZE),PY(NSIZE)
px O Real array X points in world coordinates.
py O Real array Y points in world coordinates.
nsize I integer array size.
numdig O integer number of points.
Notes: Returns the points traced by the cursor.