home *** CD-ROM | disk | FTP | other *** search
- // Structures and function declarations for dealing with graphics
- // Written by Yuri Kiselev, CZ 1994.
-
- #ifndef GRAPH_H
- #define GRAPH_H
-
- #include "common.h"
-
- #define MAXLENGTHROW 2048
- #define MAXCOUNTROW 1024
-
- typedef struct {
- BYTE r,g,b;
- } colortype;
- typedef colortype VGApalette[256];
-
- typedef struct {
- BYTE b,g,r;
- } BGRcolortype;
- typedef BGRcolortype BGRpalette[256];
-
- typedef BYTE rowtype[MAXLENGTHROW-1];
- typedef rowtype *rowptr;
- typedef rowptr imagetype[MAXCOUNTROW-1];
- typedef imagetype *imageptr;
-
- typedef struct {
- BYTE mode;
- char name[20];
- } modename;
-
- typedef struct {
- BYTE numberofmodes;
- modename modes[20];
- } modelisttype;
-
- //coordinates of a point.
- typedef struct { int x,y; } pointtype;
-
- //viewport settings
- typedef struct {
- int left,top,right,bottom;
- } viewporttype;
-
- //line settings
- typedef struct {
- WORD linestyle;
- WORD pattern;
- BYTE width;
- } linesettingstype;
-
- // Line Styles
- enum line_styles {
- SOLID_LINE,
- DOTTED_LINE,
- CENTER_LINE,
- DASHED_LINE,
- USERBIT_LINE // User defined line style
- };
-
- // Line widths
- enum line_widths {
- NORM_WIDTH = 1,
- DOUBLE_WIDTH = 2,
- THICK_WIDTH = 3,
- };
-
- //Pascal's Fill Pattern Constants
-
- //Fill patterns
- enum fill_patterns {
- EMPTY_FILL, // transparent
- SOLID_FILL, // fills area in solid fill color
- LINE_FILL, // --- fill
- LTSLASH_FILL, // /// fill
- SLASH_FILL, // /// fill with thick lines
- BKSLASH_FILL, // \\\ fill with thick lines
- LTBKSLASH_FILL, // \\\ fill
- HATCH_FILL, // light hatch fill
- XHATCH_FILL, // heavy cross hatch fill
- INTERLEAVE_FILL,// interleaving line fill
- WIDE_DOT_FILL, // Widely spaced dot fill
- CLOSE_DOT_FILL, // Closely spaced dot fill
- USER_FILL // user defined fill
- };
-
- #if !defined(__COLORS)
- #define __COLORS
-
- enum coloros {
- BLACK, // dark colors
- BLUE,
- GREEN,
- CYAN,
- RED,
- MAGENTA,
- BROWN,
- LIGHTGRAY,
- DARKGRAY, // light colors
- LIGHTBLUE,
- LIGHTGREEN,
- LIGHTCYAN,
- LIGHTRED,
- LIGHTMAGENTA,
- YELLOW,
- WHITE
- };
- #endif
-
- // Supported video modes
- // 16 colors(up to 800x600) - egavga16.asm
- // VGA 256 colors(320x200) - vga256.asm
- // SVGA 256 colors - svga256.asm
- // and so on.
- enum video_modes {
- // EGA & VGA standart(with 256k)
- EGA16,
- VGA16,
- VGA256,
- // SVGA 256k
- SVGA800x600x16,
- SVGA640x400x256,
- // SVGA 512k
- SVGA640x480x256,
- SVGA800x600x256,
- SVGA1024x768x16,
- // SVGA 1m
- SVGA1024x768x256,
- SVGA1280x1024x16,
- // SVGA 2m
- SVGA1280x1024x256,
- modecounter
- };
-
- //
- enum put_method {
- NORMAL_PUT,
- XOR_PUT,
- AND_PUT,
- OR_PUT
- };
-
- extern modelisttype modelist;
- extern BOOL drawpoly_in_fillpoly;
- // functions
- int graphinit(void);
- int switchmode(int mode); // swithes the video modes
- void closegraph(void);
- void setviewport(int x1,int y1,int x2,int y2);
- void putpixel(int x,int y,BYTE color);
- BYTE getpixel(int x,int y);
- extern void (*line)(int x1,int y1,int x2,int y2);
- void getimage(int x1,int y1,int x2,int y2,void* buffer);
- void putimage(int xo,int yo,void* buffer);
- long imagesize(int x1,int Y1,int x2,int y2);
- void rectangle(int x1,int y1,int x2,int y2);
- void linerel(int dx,int dy);
- void lineto(int x,int y);
- void moveto(int x,int y);
- void moverel(int dx,int dy);
- int getmaxx(void);
- int getmaxy(void);
- void setcolor(BYTE color);
- BYTE getcolor(void);
- void setbkcolor(BYTE Color);
- void setlinestyle(WORD linestyle,WORD pattern,BYTE wline);
- void setfillstyle(BYTE pattern,BYTE color);
- void setfillpattern(BYTE* pattern);
- void setwritemode(BYTE wrmode);
- void setglassflag(BYTE glflag);
-
- void bar(int x,int y,int x1,int y1);
- extern "C" void drawpoly(WORD numpoints,void* polypoints);
- extern "C" int fillpoly(WORD numpoints,void* polypoints);
-
- void putrow(rowptr row,int x,int y,int xcount);
-
- void ellipse(int xo,int yo,WORD xradius,WORD yradius);
- void circle(int x,int y,WORD radius);
-
- extern "C" void setDACblock(BYTE first,WORD Count,void *far Pal);
- extern "C" void getDACblock(BYTE first,WORD Count,void *far Pal);
- extern "C" void setVGApalette(void *far Pal);
-
- #endif