home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
CLIPPER
/
RPCX10
/
RPCXLIB.DOC
< prev
next >
Wrap
Text File
|
1993-09-15
|
28KB
|
787 lines
.-------------------------------------------------------------------------.
| |
| RPCXLib version 1.0 (11/08/93) |
| |
| |
| (c) 1993 Rolf van Gelder, EINDHOVEN |
| |
|_________________________________________________________________________|
1 INTRODUCTION --------------------------------------------------------
RPCXLib is a CLIPPER LIBRARY with GRAPHIC FUNCTIONS.
Because RPCXLib is fully written in ASSEMBLER its functions are
VERY FAST !
Therefore the library is also INDEPENDENT of the Clipper version and
can be used in combination with Clipper Summer'87, Clipper 5.0,
Clipper 5.01, Clipper 5.2x, etc.
RPCXLib is the successor of the shareware function R_ShowPCX(),
a function to show PCX-files on the screen.
This function has been CONSIDERABLY IMPROVED and EXTENDED and is
included in the new RPCXLib library.
RPCXLib is a Shareware product :
You have the opportunity to try the program at no charge to see if
it meets your needs.
If you continue to use the program after evaluation,
please complete the included registration form (RPCXLib.FRM)
and send it with the applicable registration fee to the author.
FEATURES :
* RShowPCX function to display a PCX graphic file :
- very FAST !
- of UNLIMITED SIZE
- on a SPECIFIC screen location
- on EGA/VGA and SUPERVGA screens
- up to a resolution of 640 x 480 x 256 (SUPERVGA)
- with AUTOMATIC DETECTION and USE of almost all
SUPERVGA adapters
- with support of the INTERNATIONAL VESA STANDARD
* Functions to mix ones own CLIPPER COLOURS
YOU CAN COMPOSE 262.144 DIFFERENT COLOURS !
* Functions to slowly DIM the screen
* Functions to determine the GRAPHIC CONFIGURATION of a PC :
Is there a EGA, VGA, MCGA or SUPERVGA adapter available ?
When there is a SUPERVGA adapter available you can, in most
cases, determine the brand
* A NORTON GUIDE with a description of all functions in the library
2 GRAPHIC ADAPTERS AND VIDEO MODES ------------------------------------
The minimum requirements for using RPCXLib is a PC with an EGA card;
CGA and Hercules adapters are not supported.
To show PCX-files (using the function R_ShowPCX()) you can use
EGA, VGA and SuperVGA adapters.
EGA :
When you have an EGA adapter you are able to show 16 colour PCX-files
up to a dimension of 640 x 350 pixels.
(Maximum resolution: 640 x 350 x 16)
VGA :
When you have a STANDARD VGA adapter you are able to show 16 colour
PCX-files up to a dimension of 640 x 480 and 256 colour files up to
a dimension of 320 x 200 pixels.
(Maximum resolution: 640 x 480 x 16 or 320 x 200 x 256)
SuperVGA :
When you have a SUPERVGA adapter (which is supported by RPCXLib)
you are able to show 256 colours PCX-files up to a dimension of
640 x 480 pixels. Provided that the used adapter supports the
640 x 480 x 256 video mode.
(Maximum resolution: 640 x 480 x 256)
RPCXLib detects and uses the following SuperVGA adapters :
- Ahead Systems, type A & B
- ATI Wonder Card
- Chips & Technologies
- Everex VGA
- Genoa GVGA
- NCR 77C22
- Oak Technologies OTI-67
- Paradise VGA
- Trident 8800
- Trident 8900
- Tseng Labs ET3000
- Tseng Labs ET4000
- VESA BIOS Extensions
- Video 7
When your adapter is NOT listed above you probably still can use
the SuperVGA features of RPCXLib.
This can be done using the VESA BIOS EXTENSIONS driver.
VESA (Video Electronics Standards Association) is a standardization
in the field of graphic adapters.
For almost any SuperVGA card there is a little (TSR) program that
emulates the VESA standard. By using this program, RPCXLib will
work together with your (not listed) SuperVGA adapter.
The VESA emulation programs mentioned above are often included in
the software package that comes with the SuperVGA card.
When this is not the case you can probably find the program in the
Public Domain / Shareware circuit.
3 EGA/VGA COLOUR PALETTES ----------------------------------------------
In RPCXLib the are some functions to change the colour palette of your
EGA/VGA adapter. You can use these functions to compose your own
Clipper colour palette.
Clipper uses 16 pre-defined colours. Each Clipper colour is paired with
a so-called colour register. A colour register contains the "composition"
of a specific colour. This composition consists of a RED, GREEN and BLUE
component (values ranging from 0 to 63).
Some examples (values actually used by Clipper) :
------- Components -------
RED GREEN BLUE
BLACK 0 0 0
BRIGHT WHITE 63 63 63
NORMAL WHITE 42 42 42
GREY 21 21 21
BRIGHT RED 63 0 0
RED 42 0 0
GREEN 0 42 0
BLUE 0 0 42
MAGENTA 42 0 42
The composition of the Clipper colours can be found in the header
file (RPCXLib.CH).
Clipper DOESN'T use register numbers 0-15 but :
Registers # 0 - 7 : normal colours
Registers # 56 - 63 : bright colours
All Clipper colours and matching register numbers are listed in
the header file RPCXLib.CH.
Example :
To determine the register number of the Clipper colour MAGENTA you
can use the pre-defined PL_MAGENTA constant that substitutes the
correct register number.
The use of the palette functions is described in the next chapter.
4 FUNCTIONS IN RPCXLIB ------------------------------------------------
4.1 Function R_DefPal : Installs the default Clipper colour palette
Syntax
R_DefPal ()
Parameters
(None)
Returns
NIL
Description
By calling the R_DefPal () function the 16 Clipper colours are
initialized to their default values. This function is for example
useful at the end of an application : it makes sure that the
the colour palette is reset to its original state (after possible
changes you made to the palette).
Example
See the demo program PCXDemo.PRG
4.2 Function R_GetRGB : Determines the composition of a specific colour
Syntax
R_GetRGB ( nRegNr, @nRed, @nGreen, @nBlue )
Parameters
nRegNr Number of the colour register of which the composition
has to be determined
(range : 0-63)
@nRed Variable (BY REFERENCE !) to which the RED component
is returned
(range : 0-63)
@nGreen Variable (BY REFERENCE !) to which the GREEN component
is returned
(range : 0-63)
@nBlue Variable (BY REFERENCE !) to which the BLUE component
is returned
(range : 0-63)
Returns
NIL (The values are returned BY REFERENCE to the variables
nRed, nGreen and nBlue)
Description
R_GetRGB () determines the actual colour composition of a specific
colour register. To determine the composition of the Clipper colours
you may use the pre-defined register numbers in RPCXLib.CH.
Example
&& Determine the components of the Clipper colour MAGENTA
*-- RPCXLib definitions
#include "RPCXLib.CH"
LOCAL nRed, nGreen, nBlue
[...]
R_GetRGB ( PL_MAGENTA, @nRed, @nGreen, @nBlue )
?'Magenta : RED ',nRed,' GREEN ',nGreen,' BLUE ',nBlue
4.3 Function R_IsEGA : Determines if an EGA card is present
Syntax
lIsEGA := R_IsEGA ()
Parameters
(None)
Returns
lIsEGA .T. : EGA card is present or can be emulated
.F. : No EGA card present
Description
This function can determine if the PC supports EGA.
That might be important for the function R_ShowPCX ().
Example
IF R_IsEGA ()
R_ShowPCX ( 'STANDEGA.PCX' )
[...]
ELSE
Alert ( 'EGA adapter required to display this picture.' )
ENDIF
4.4 Function R_IsMCGA : Determines if a MCGA card is present
Syntax
lIsMCGA := R_IsMCGA ()
Parameters
(None)
Returns
lIsMCGA .T. : MCGA card present or can be emulated
.F. : No MCGA card present
Description
This function can determine if the PC supports MCGA.
Example
See PCXDemo.PRG
4.5 Function R_IsSVGA : Determines if a SuperVGA adapter is available
Syntax
lIsSVGA := R_IsSVGA ()
Parameters
(None)
Returns
lIsSVGA .T. : PC has a, by RPCXLib supported, SuperVGA
adapter
.F. : PC doesn't have a supported SuperVGA adapter
Description
This function determines if the PC has a SuperVGA adapter which
is supported by RPCXLib.
Example
IF R_IsSVGA ()
R_ShowPCX ( 'SUPERPIC.PCX' )
[...]
ELSE
IF R_IsVGA ()
R_ShowPCX ( 'STANDVGA.PCX' )
[...]
ELSEIF R_IsEGA ()
R_ShowPCX ( 'STANDEGA.PCX' )
[...]
ELSE
Alert ( 'Minimum requirement is an EGA adapter !' )
ENDIF
ENDIF
Remark
This function is a pseudo function and is declared in RPCXLib.CH.
4.6 Function R_IsVGA : Determines if a VGA card is present
Syntax
lIsVGA := R_IsVGA ()
Parameters
(None)
Returns
lIsVGA .T. : VGA card is present or can be emulated
.F. : No VGA card present
Description
This function can determine if the PC supports VGA.
Example
IF R_IsVGA ()
R_ShowPCX ( 'STANDVGA.PCX' )
[...]
ELSE
Alert ( 'Minimum requirement is a VGA adapter !' )
ENDIF
4.7 Function R_PCXInfo : Gets information of a specific PCX-file
Syntax
nRet :=
R_PCXInfo ( cPCXFile, @nWidth, @nHeight, @nColors, @nAdapter )
Parameters
cPCXFile Filespec of the PCX-file to be examined
Format : [drive:][\path\]filename.PCX
Example : C:\PICTURES\TREE.PCX
The extension (.PCX) may not be omitted !
@nWidth Variable (BY REFERENCE !) to which the WIDTH of the
picture is returned
@nHeight Variable (BY REFERENCE !) to which the HEIGHT of the
picture is returned
@nColors Variable (BY REFERENCE !) to which the NUMBER OF COLOURS
of the picture is returned (16 or 256)
@nAdapter Variable (BY REFERENCE !) to which the CODE of the
REQUIRED ADAPTER is returned
These codes are defined in RPCXLib.CH :
1 = PL_EGA EGA adapter required
2 = PL_VGA Standard VGA adapter required
3 = PL_SVGA SuperVGA adapter required
Returns
nRet Return code of R_PCXInfo()
The values and descriptions of this return code are
defined in RPCXLib.CH :
0 = PL_OKAY Okay
1 = PL_INVALID_PARAMETER Invalid parameter passed
2 = PL_OPEN_PCX Error opening PCX-file
3 = PL_READ_PCX Error reading PCX-file
4 = PL_NO_PCXFILE File is no valid
PCX-file
5 = PL_INVALID_BPP Invalid number of
Bits-Per-Pixel
Description
Using the R_PCXInfo() function makes it possible to get information
about a PCX-file before displaying it.
For example you can see what kind of graphic adapter is needed
to display the specific picture.
Example
See PCXDemo.PRG
4.8 Function R_RestPal : Restores a saved Clipper colour palette
Syntax
R_RestPal ( cPalet )
Parameters
cPalet A 48 byte string with the 16 colours of the Clipper
colour palette (saved by de R_SavePal() function).
Returns
NIL
Description
With R_RestPal () a previously saved Clipper colour palette
can be restored.
Example
See the R_SavePal () function
4.9 Function R_SavePal : Saves the actual Clipper colour palette to a string
Syntax
cPalet := R_SavePal ()
Parameters
(None)
Returns
cPalet A 48 byte string with the actual values of the
16 Clipper colours
Description
With the R_SavePal () function you can save the actual values
of the Clipper colours (temporarily) to a string.
This saved palette can be restored using the R_RestPal () function.
Example
*-- RPCXLib definitions
#include "RPCXLib.CH"
LOCAL cPalet := R_SavePal () && Save Clipper palette
[...]
&& Change the Clipper MAGENTA-colour to another colour
R_SetRGB ( PL_MAGENTA, 20, 43, 5 )
[...]
&& Restore the previous saved Clipper palette
R_RestPal ( cPalet )
4.10 Function R_SetRGB : Changes the composition of a specific colour
Syntax
R_SetRGB ( nRegNr, nRed, nGreen, nBlue )
Parameters
nRegNr Number of the colour register to change
(range 0-63; codes are in RPCXLib.CH)
nRed Units RED to be used (range : 0-63)
nGreen Units GREEN to be used (range : 0-63)
nBlue Units BLUE to be used (range : 0-63)
Returns
NIL
Description
Function R_SetRGB makes it possible to define ones own 16 Clipper
colours. They can be replaced by self mixed colours.
There are 64 x 64 x 64 = 262.144 (!) possible colours so almost
any desired colour can be composed and used in applications.
Example
&& Replace the Clipper colour GREEN by a self mixed colour.
&& The new colour is composed of 5 units RED, 30 units GREEN
&& and 30 units BLUE
*-- RPCXLib definitions
#include "RPCXLib.CH"
R_SetRGB ( PL_GREEN, 5, 30, 30 )
A nice example of interactive mixing of colours can be found
in RPCXDemo.PRG.
4.11 Function R_ShowPCX : Shows a PCX-file on EGA/VGA/SuperVGA screens
Syntax
nRet := R_ShowPCX ( cPCXFile [, nYPos [, nXPos [, cDriver ] ] ] )
Parameters
cPCXFile Filespec of the PCX-file to be examined
Format : [drive:][\path\]filename.PCX
Example : C:\PICTURES\TREE.PCX
The extension (.PCX) may not be omitted !
nYPos Vertical screen position of the upper left corner
of the display area (in pixels).
If omitted the picture will be CENTRED VERTICALLY.
nXPos Horizontal screen position of the upper left corner
of the display area (in pixels).
If omitted the picture will be CENTRED HORIZONTALLY.
cDriver Filespec of the RPCXLib SuperVGA driver file.
Format : [drive:][\path\]filename.ext
When a picture should be displayed in SuperVGA mode
the function R_ShowPCX must be able to locate the
SuperVGA driver file.
This file is included in the RPCXLib package and is
called RPCXLib.GDR.
If the driver file is not located in the current
DOS-directory this parameter should be used to
indicate where the driver file can be found.
Returns
nRet Return code of R_ShowPCX()
The values and descriptions of this return code are
defined in RPCXLib.CH :
0 = PL_OKAY Okay
1 = PL_INVALID_PARAMETER Invalid parameter passed
2 = PL_OPEN_PCX Error opening PCX-file
3 = PL_READ_PCX Error reading PCX-file
4 = PL_NO_PCXFILE File is no valid
PCX-file
5 = PL_INVALID_BPP Invalid number of
Bits-Per-Pixel
6 = PL_INVALID_DIM PCX-file has invalid
dimensions (> 640 x 480)
7 = PL_UNKNOWN_SVGA Unknown SuperVGA card
8 = PL_OPEN_DRIVER Error OPENING RPCXLib.GDR
driver
9 = PL_READ_DRIVER Error READING RPCXLib.GDR
driver
10 = PL_SVGA_NOTSUPPORTED SuperVGA-card not
supported (yet)
11 = PL_BUFFER_MEMORY Not enough memory
for internal buffer
Description
R_ShowPCX() displays a PCX-file on a specific screen location.
This function is perfect to show Company Logo's, Graphs,
Wallpapers etc.
The function chooses the most suitable video mode depending
on the dimensions and number of colours of the picture to show.
When needed the appropriate SuperVGA driver is loaded
automatically.
The next scheme shows the relationship between the dimension of
the picture and the adapter that will be used :
PCX-file
│
┌──────────────┴──────────────┐
│ │
16 colours 256 colours
┌───────┴──────┐ ┌───────┴──────┐
│ │ │ │
<= 640 x 350 <= 640 x 480 <= 320 x 200 <= 640 x 480
EGA VGA VGA SuperVGA
After the picture is displayed the R_ShowPCX() returns to the
calling program while leaving the picture on the screen (the
graphic video remains active).
The calling program should take further action : for example
wait for a keypress (with the INKEY()-function). When a key
is pressed by the user the original video mode (TEXTMODE) should
be restored using the R_VMSet()-function.
This principle is demonstrated in the following example.
Example
&& Shows a PCX-file PICTURE.PCX on the screen
&& on position (y,x) = (10,50)
*-- RPCXLib definitions
#include "RPCXLib.CH"
*-- Return code R_ShowPCX()
LOCAL nRet
*-- Array with error messages
LOCAL aPCXErrors := PL_ERRMSG
*-- Save the actual video mode
LOCAL nVidMode := R_VMGet ()
[...]
nRet := R_ShowPCX ( 'PICTURE.PCX', 10, 50 )
IF nRet = PL_OKAY
*-- Picture displayed, still on the screen
*-- Wait for a keypress ... (max 10 seconds)
Inkey ( 10 )
*-- Restore video mode
R_VMSet ( nVidMode )
ELSE
*-- Oops, error while displaying the picture
*-- Display the error message
ALERT ( 'Error R_ShowPCX() : ' + aPCXErrors [nRet] )
ENDIF
&& Continuation of the program
[...]
See for more detailed examples PCXDemo.PRG.
4.12 Function R_VGACard : Determines which SuperVGA adapter is present
Syntax
nSVGACard := R_VGACard ()
Parameters
(None)
Returns
nSVGACard Code of the detected SuperVGA adapter.
These codes are defined in RPCXLib.CH.
Description
This function tries to determine which SuperVGA adapter is
available in the PC.
Example
&& Determines the SuperVGA adapter
*-- RPCXLib definitions
#include "RPCXLib.CH"
*-- Code of SuperVGA adapter
LOCAL nSVGACard
*-- Array with the names of the known SuperVGA adapters
LOCAL aSVGANames := PL_SVGA_NAMES
nSVGACard := R_VGACard ()
? 'SuperVGA in this PC : ', aSVGANames [nSVGACard]
4.13 Function R_VMGet : Determines the actual video mode
Syntax
nVidMode := R_VMGet ()
Parameters
(None)
Returns
nVidMode The actual video mode
Description
Determines which video mode is active at the moment.
This function can be used in combination with R_ShowPCX().
Example
See the example of R_ShowPCX().
4.14 Function R_VMSet : Changes the actual video mode
Syntax
R_VMSet ( nVidMode )
Parameters
nVidMode The video mode to be used
Returns
NIL
Description
Changes the actual video mode. This function can be used in
combination with R_ShowPCX().
Example
See the example of R_ShowPCX().
5 REGISTRATION --------------------------------------------------------
RPCXLib is a Shareware product. It is available through Users Groups,
Bulletin Boards, etc.
You have the opportunity to try the program at no charge to see
if it meets your needs. If you continue to use the program after
evaluation, please complete the included registration form
(RPCXLib.FRM) and send it to:
Ing. R.P.B. van Gelder
Binnenwiertzstraat 27
5615 HG EINDHOVEN
THE NETHERLANDS
The price for registration is :
If you want to receive the library by E-MAIL : US $ 15,00
If you want to receive the library by POST : US $ 20,00
.---------------------------------------------------------------------.
| REGISTERED USERS OF RSHOWPCX ONLY PAY THE EXTRA COSTS |
| |
| RECEPTION BY E-MAIL : $ 5,00 |
| RECEPTION BY POST : $ 10,00 |
|_____________________________________________________________________|
Payment :
Just include the appropriate amount of money (in cash) with the
registration form and send it to the address as mentioned above.
5.1 BENEFITS OF REGISTRATION --------------------------------------------
1) A registered version of RPCXLib will be sent to you by E-MAIL or
by POST.
.--------------------------------------------------------------.
| THE REGISTERED VERSION DOESN'T DISPLAY THE REGISTRATION |
| MESSAGE AND DOESN'T HAVE THE 3 AND 8 SECONDS DELAYS. |
|______________________________________________________________|
2) Run-time royalty-free license. You will be free to integrate
RPCXLib functions into your Clipper applications without having
to pay any royalty or fee for doing so. You may also distribute
or market any such applications royalty-free.
3) Support through E-Mail
E-Mail addresses :
Internet: RCROLF@urc.tue.nl
Bitnet : RCROLF@heitue5
5.2 USER GROUPS / SHAREWARE DISTRIBUTORS --------------------------------
PC User Groups are welcome to add RShowPCX to their libraries under
the following conditions :
1) It must be completely unmodified
2) A diskette/copying fee of $5 of less is charged; and
3) This documentation file MUST be included.
I would appreciate notification that you have added RPCXLib
to your library.
IF YOU RECEIVED RPCXLIB THROUGH EITHER A USER GROUP OR A SHAREWARE
DISTRIBUTOR, PLEASE REMEMBER THAT THE DISKETTE FEE YOU PAYED DOES NOT
CONSTITUTE LICENSING THE SOFTWARE, AND YOU ARE STILL OBLIGATED TO
REGISTER IF YOU DECIDE TO USE RPCXLIB.
6 DISCLAIMER ----------------------------------------------------------
The copyright owner disclaims all warranties and is not liable for
damages of any kind. By using RPCXLib you agree to this.