home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
POLYEDIT.LZH
/
MODEL
/
GRAPHPCO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-31
|
2KB
|
117 lines
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <graphics.h>
#include "graph.h"
#define iskanji( c ) ( ( (c) & 0x80 ) != 0 )
int Cols, Lines ;
void graph_init()
{
int i ;
Cols = 80 ;
Lines = 25 ;
GrSetMode( GR_default_graphics );
Cols = GrSizeX() / 8 ;
Lines = GrSizeY() / 16 ;
for (i = 0; i < 8; ++i) {
GrSetColor( i, (i&4) ? 255 : 0, (i&2) ? 255 : 0, (i&1) ? 255 : 0 );
}
}
void graph_exit()
{
GrSetMode( GR_default_text );
}
void graph_line( x1, y1, x2, y2, color )
int x1 ;
int y1 ;
int x2 ;
int y2 ;
int color ;
{
if ( color < 16 )
GrLine( x1, y1, x2, y2, color );
else
GrLine( x1, y1, x2, y2, 0x100 + 0x0f );
}
void graph_cls( color )
int color ;
{
graph_fill( 0, 0, Cols*8, Lines*16, color );
}
void graph_fill( x1, y1, x2, y2, color )
int x1 ;
int y1 ;
int x2 ;
int y2 ;
int color ;
{
int y ;
for( y = y1 ; y <= y2 ; y++ )
{
GrLine( x1, y, x2, y, color );
}
}
void graph_palet( paletmode, g, r, b )
int paletmode ;
int g, r, b ;
{
GrSetColor( paletmode, r, g, b );
}
void graph_puts( str, x, y, atr )
char *str ;
int x, y ;
int atr ;
{
int i ;
for( i = 0 ; str[i] != '\0' ; i++ )
{
if ( iskanji( str[i] ) )
return ;
}
GrTextXY( x, y, str, atr & 15, atr >> 4 );
}
void graph_pattern( x, y, color, pat, h, v )
int x, y ;
int color ;
short *pat ;
int h, v ;
{
}
/* ボタン表示 */
void graph_box( x1, y1, x2, y2, sw )
int x1, y1, x2, y2 ;
int sw ;
{
if ( sw )
{
graph_line( x1, y1, x2, y1, 7 );
graph_fill( x1, y1, x1+1, y2, 7 );
graph_line( x1, y2, x2, y2, 0 );
graph_line( x2, y1, x2, y2, 0 );
}
else
{
graph_line( x1, y1, x2, y1, 0 );
graph_line( x1, y1, x1, y2, 0 );
graph_line( x1, y2, x2, y2, 7 );
graph_fill( x2, y1, x2+1, y2, 7 );
}
}