#ifndef _Svga_Dev_H_
#define _Svga_Dev_H_

//#define  STANDAND_C_GRAPH_LIBRARY

#define RGBQUAD_STYLE_SYSTEM  0
#define RGBQUAD_STYLE_BITMAP  1
#define RGBQUAD_STYLE_ICON    2
#define RGBQUAD_STYLE_GIF     3

#ifndef SVGA16
#define SVGA16    20

#define SVGA_320X200X16  0
#define SVGA_640X200X16  1
#define SVGA_640X350X16  2
#define SVGA_640X480X16  3
#define SVGA_800X600X16  4
#define SVGA_1024X768X16 5

#endif

#ifndef SVGA256
#define SVGA256    21

#define SVGA_320X200X256  0
#define SVGA_640X350X256  1
#define SVGA_640X480X256  2
#define SVGA_800X600X256  3
#define SVGA_1024X768X256 4

#endif


#ifndef VESA
#define VESA                  11
#define VESA640_480_16        0x0   //6A
;
#define VESA640_400_256       0x1   //100H
#define VESA640_480_256       0x2   //101H
#define VESA800_600_16        0x3   //102H
#define VESA800_600_256       0x4   //103H
#define VESA1024_768_16       0x5   //104H
#define VESA1024_768_256      0x6   //105H
#define VESA1280_1024_16      0x7   //106H
#define VESA1280_1024_256     0x8   //107H
;
#define VESA320_200_256       0x80
#define VESA320_240_256       0x81
#define VESA320_240_SED1335   0x82
;
#define VESA640_400_8B        0x100   //100H
#define VESA640_480_8B        0x101   //101H
#define VESA800_600_4B        0x102   //102H
#define VESA800_600_8B        0x103   //103H
#define VESA1024_768_4B       0x104   //104H
#define VESA1024_768_8B       0x105   //105H
#define VESA1280_1024_4B      0x106   //106H
#define VESA1280_1024_8B      0x107   //107H
;
#define VESA80_60_TEXT        0x108   //108H
#define VESA132_25_TEXT       0x109   //109H
#define VESA132_43_TEXT       0x10A   //10AH
#define VESA132_50_TEXT       0x10B   //10BH
#define VESA132_60_TEXT       0x10C   //10CH
;
#define VESA320_200_15B       0x10D   //10DH
#define VESA320_200_16B       0x10E   //10EH
#define VESA320_200_24B       0x10F   //10FH
;
#define VESA640_480_15B       0x110  //110H
#define VESA640_480_16B       0x111  //111H
#define VESA640_480_24B       0x112  //112H
;
#define VESA800_600_15B       0x113  //113H
#define VESA800_600_16B       0x114  //114H
#define VESA800_600_24B       0x115  //115H
;
#define VESA1024_768_15B      0x116  //116H
#define VESA1024_768_16B      0x117  //117H
#define VESA1024_768_24B      0x118  //118H
;
#define VESA1280_1024_15B     0x119  //119H
#define VESA1280_1024_16B     0x11A  //11AH
#define VESA1280_1024_24B     0x11B  //11BH
;
#define VESA_USER_SPECIAL     0x81FF //81FF


#endif



#ifndef SED1335VGA
#define SED1335VGA            13
#define SED1335VGA_320_240_1   0
#define SED1335VGA_640_480_1   1
#define SED1335VGA_800_600_1   2
#define SED1335VGA_1024_768_1  3
#endif


#ifndef TFTVGA
#define TFTVGA              14
#define TFT_320_240_256   0
#define TFT_640_480_256   1
#define TFT_800_600_256   2
#define TFT_1024_768_256  3
#endif


#define MACRO_SED1335_SystemSet    0x40 //8 Parameter
#define MACRO_SED1335_SleepIn      0x53 //0 Parameter
#define MACRO_SED1335_DispOn       0x59 //1 Parameter
#define MACRO_SED1335_DispOff      0x58 //1 Parameter
#define MACRO_SED1335_Scroll       0x44 //10 Parameter
#define MACRO_SED1335_CsrForm      0x5d //2 Parameter
#define MACRO_SED1335_CGRamAddr    0x5c //2 Parameter
#define MACRO_SED1335_CsrdirLeft   0x4d //0 Parameter
#define MACRO_SED1335_CsrdirRight  0x4c //0 Parameter
#define MACRO_SED1335_CsrdirUp     0x4e //0 Parameter
#define MACRO_SED1335_CsrdirDown   0x4f //0 Parameter
#define MACRO_SED1335_HDotScr      0x5a //1 Parameter
#define MACRO_SED1335_Ovlay        0x5b //1 Parameter
#define MACRO_SED1335_CsrW         0x46 //2 Parameter
#define MACRO_SED1335_CsrR         0x47 //2 Parameter
#define MACRO_SED1335_MWrite       0x42 //m Parameter
#define MACRO_SED1335_MRead        0x43 //m Parameter


typedef struct tagRGBQUAD
{
	BYTE    rgbRed;//Red;
	BYTE    rgbGreen;
	BYTE    rgbBlue;//Blue;
	BYTE    rgbReserved;
}RGBQUAD;

int VgaToT6963_TransrateColor(int nColor);
int T6963ToVga_TransrateColor(int nColor);


void FAR Bar(RECT* pRc);
void FAR Rectangle(RECT* pRc);

int    FAR RegisterFarBgiDriver(void FAR *__driver);

void       FAR Arc(int __x, int __y, int __stangle, int __endangle,int __radius);
void       FAR Bar(int __left, int __top, int __right, int __bottom);
void       FAR Bar3D(int __left, int __top, int __right, int __bottom,int __depth, int __topflag);
void       FAR Circle(int __x, int __y, int __radius);
void       FAR ClearDevice(void);
void       FAR ClearViewPort(void);
void       FAR CloseGraph(void);
void       FAR DetectGraph(int FAR *__graphdriver,int FAR *__graphmode);
void       FAR DrawPoly(int __numpoints, const int FAR *__polypoints);
void       FAR Ellipse(int __x, int __y, int __stangle, int __endangle,int __xradius, int __yradius);
void       FAR FillEllipse( int __x, int __y, int __xradius, int __yradius );
void       FAR FillPoly(int __numpoints, const int FAR *__polypoints);
void       FAR FloodFill(int __x, int __y, int __border);
void       FAR GetArcCoords(struct arccoordstype FAR *__arccoords);
void       FAR GetAspectRatio(int FAR *__xasp, int FAR *__yasp);
int        FAR GetBkColor(void);
int        FAR GetColor(void);
struct palettetype FAR * FAR GetDefaultPalette( void );
char *     FAR GetDriverName( void );
void       FAR GetFillPattern(char FAR *__pattern);
void       FAR GetFillSettings(struct fillsettingstype FAR *__fillinfo);
int        FAR GetGraphMode(void);
void       FAR GetImage(int __left, int __top, int __right, int __bottom,void FAR *__bitmap);
void       FAR GetLineSettings(struct linesettingstype FAR *__lineinfo);
int        FAR GetMaxColor(void);
int        FAR GetMaxMode(void);
int        FAR GetMaxX(void);
int        FAR GetMaxY(void);
char *     FAR GetModeName( int __mode_number );
void       FAR GetModeRange(int __graphdriver, int FAR *__lomode,int FAR *__himode);
unsigned   FAR GetPixel(int __x, int __y);
void       FAR GetPalette(struct palettetype FAR *__palette);
int        FAR GetPaletteSize( void );
void       FAR GetTextSettings(struct textsettingstype FAR *__texttypeinfo);
void       FAR GetViewSettings(struct viewporttype FAR *__viewport);
int        FAR GetX(void);
int        FAR GetY(void);
void       FAR GraphDefaults(void);
char *     FAR GraphErrorMsg(int __errorcode);
void       FAR _GraphFreeMem(void FAR *__ptr, unsigned __size);
void FAR * FAR _GraphGetMem(unsigned __size);
int        FAR GraphResult(void);
unsigned   FAR ImageSize(int __left, int __top, int __right, int __bottom);
void       FAR InitGraph(int FAR *graphdriver,int FAR *graphmode, char FAR *pathtodriver);
#ifdef __BORLANDC__
        int        FAR InstallUserDriver( const char FAR *__name, int huge (*detect)(void) );
#endif
int        FAR InstallUserFont( const char FAR *__name );
void       FAR Line(int __x1, int __y1, int __x2, int __y2);
void       FAR Linerel(int __dx, int __dy);
void       FAR LineTo(int __x, int __y);
void       FAR Moverel(int __dx, int __dy);
void       FAR MoveTo(int __x, int __y);
void       FAR OutText(const char FAR *__textstring);
void       FAR OutTextXY(int x, int y, char FAR *textstring);

void       FAR PieSlice(int __x, int __y, int __stangle, int __endangle,int __radius);
void       FAR PutImage(int left, int top, void FAR *bitmap, int op);
void       FAR PutPixel(int __x, int __y, int __color);
void       FAR Rectangle(int __left, int __top, int __right, int __bottom);
void       FAR RestoreCrtMode(void);
void       FAR Sector( int __X, int __Y, int __StAngle, int __EndAngle,int __XRadius, int __YRadius );
void       FAR SetActivePage(int __page);
void       FAR SetAllPalette(const struct palettetype FAR *__palette);
void       FAR SetAspectRatio( int __xasp, int __yasp );
void       FAR SetBkColor(int __color);
void       FAR SetColor(int __color);
void       FAR SetFillPattern(const char FAR *__upattern, int __color);
void       FAR SetFillStyle(int __pattern, int __color);
unsigned   FAR SetGraphBufSize(unsigned __bufsize);
void       FAR SetGraphMode(int __mode);
void       FAR SetLineStyle(int __linestyle, unsigned __upattern,int __thickness);
void       FAR SetPalette(int __colornum, int __color);
void       FAR SetRgbPalette(int __colornum,int __red, int __green, int __blue);
void       FAR SetTextJustify(int __horiz, int __vert);
void       FAR SetTextStyle(int __font, int __direction, int __charsize);
void       FAR SetUserCharSize(int __multx, int __divx,int __multy, int __divy);
void       FAR SetViewPort(int __left, int __top, int __right, int __bottom,int __clip);
void       FAR SetVisualPage(int __page);
void       FAR SetWriteMode( int __mode );
int        FAR TextHeight(const char FAR *__textstring);
int        FAR TextWidth(const char FAR *__textstring);

//int        FAR GetPaletteLocation(int nLocation,
//				 RGBQUAD* pPane_User,int nCount,
//				 RGBQUAD* pPane_System,
//				 int nStyle);
void       FAR WrtiePalette(RGBQUAD* pPalette , int nCount,int nStart=0);
void       FAR ReadPalette(RGBQUAD* pPalette , int nCount,int nStart=0) ;

void       FAR SendBitmapLine(int nLeft, int nTop, int nWidth,BYTE* pBitmap);

int  GetDisplayDevice();
int  GetDisplayMode();
int  GetDisplayColor();
BOOL AfxGetMonoAttrib();

void SetVbeColorTransrate(BOOL bTransrate);
BOOL GetVbeColorTransrate();

int Transrate4Bit_16Bit(int nColor);
int Transrate16Bit_4Bit(int nColor);

void FAR KernelScreenDC(BYTE* pMemory, int nLeft, int nTop, int nWidth, int nHeight, BOOL bWriteVga);
void GetActiveViewRect(RECT* pRc);

#endif

