home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
gp35emx.zip
/
emxvga.trm
< prev
next >
Wrap
Text File
|
1995-12-06
|
3KB
|
121 lines
/* GNUPLOT - emxvga.trm */
/*
* Copyright (C) 1994
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the modified code. Modifications are to be distributed
* as patches to released version.
*
* This software is provided "as is" without express or implied warranty.
*
* This file is included by ../term.c. Be sure to add term_tbl[EMXVGA].
*
* This terminal driver supports:
* SVGA 640x480x256 on PC's running DOS or OS/2, windowed or full-screen,
* emx run-time lib required for OS/2.
*
* AUTHOR
* David J. Liu (liudj0@minerva.cis.yale.edu)
*/
/*
* Compile with GCC (emx) with VESA and SVGAKIT maintained by
* Johannes Martin <z946785@corn.cso.niu.edu>
* with addition of g_string() by David J. Liu (liudj0@minerva.cis.yale.edu)
* ftp.uni-stuttgart.de:/pub/systems/os2/emx-0.8h/contrib/gstring.zip
* alternatively, define BORLAND to use Borland fonts (untested)
* supports Trident, Cirrus, ET4000, WD, S3 and all other VESA cards.
*/
#include <vesa.h>
#include <graph.h>
#undef DOWN /* to avoid a conflict */
#undef RIGHT /* between graph.h and other terminals */
#define EMXVGA_VCHAR 8
#define EMXVGA_HCHAR 8
#define EMXVGA_VTIC 4
#define EMXVGA_HTIC 4
#define EMXVGA_XMAX 0 /* These two entries are just place holders. */
#define EMXVGA_YMAX 0 /* The actual values will be filled in init. */
static int EMXVGA_vmode=G640x480x256 ; /* default mode */
static int vgacolor[]={7,8,2,3,4,5,9,14,12,15,13,10,11,1,6} ;
static int graphics_on=FALSE ;
int startx,starty,lasty ;
int EMXVGA_angle,EMXVGA_color ;
char EMXVGA_chr ;
EMXVGA_init ()
{
if (!g_mode(EMXVGA_vmode))
{ fprintf (stderr,"Unable to initiate graphics.\n") ; return (1) ; }
term_tbl[term].xmax=g_xsize ;
term_tbl[term].ymax=g_ysize ;
lasty=g_ysize-1 ;
#ifdef BORLAND
gf_loadfont ("default.chr") ;
#endif
}
EMXVGA_reset ()
{
g_mode (GTEXT) ; graphics_on=FALSE ;
}
EMXVGA_text ()
{
if (graphics_on)
{ VesaGetCharacter (&EMXVGA_chr) ; g_mode (GTEXT) ; graphics_on=FALSE ; }
}
EMXVGA_graphics ()
{
if (!graphics_on) { g_mode (EMXVGA_vmode) ; graphics_on=TRUE ; }
}
EMXVGA_linetype (linetype)
{
EMXVGA_color=vgacolor[(linetype%13)+2] ;
}
EMXVGA_move (x,y)
{
startx=x ; starty=y ;
}
EMXVGA_vector (x,y)
{
g_line (startx,lasty-starty,x,lasty-y,EMXVGA_color) ;
startx=x ; starty=y ;
}
int EMXVGA_text_angle (ang)
int ang ;
{
#ifdef BORLAND
EMXVGA_angle=ang ;
#else
EMXVGA_angle=ang*90 ;
#endif
return (TRUE) ;
}
EMXVGA_put_text (x,y,str)
unsigned int x,y ;
char *str ;
{
#ifdef BORLAND
gf_setdirection (EMXVGA_angle) ;
gf_drawstring (x,lasty-y,str,EMXVGA_color) ;
#else
g_string (x,lasty-y-3,EMXVGA_color,EMXVGA_angle,str) ;
#endif
}