CGA
EGA
EGAMONO
VGA
MCGA
DETECT (Requests auto-detection)
Some graphics_modes for each driver supported by Turbo C.
CGAC0 320x200 palette 0
CGAHI 640x200
MCGAC0 320x200 palette 0
MCGAMED 640x200
MCGAHI 640x480
EGALO 640x200 16 color
EGAHI 640x350 16 color
EGA64LO 640x200 16 color
EGA64HI 640x350 4 color
EGAMONOHI 640x350
VGALO 640x200
VGAMED 640x350
VGAHI 640x480
The most fundamental graphics routine is the one that writes the pixel, the smallest addressable point on the video monitor. Turbo C allows you to write a pixel at specified point on your screen with the help of the putpixel().
prototype : void far putpixel(int x, int y, int color);
where x and y are the screen co-ordinates and color specifies the color with which the pixel is drawn on the screen. e.g.:- putpixel(200, 100, 3);
some functions from graphics.h
bar: draws a bar
void far bar(int left, int top, int right, int bottom);
bar3d: draws a 3-D bar
void far bar3d(int left, int top, int right, int bottom, int depth, int topflag);
circle: draws a circle at (x,y) of the given radius
void far circle(int x, int y, int radius);
cleardevice: clears the graphics screen
void far cleardevice(void);
clearviewport: clears the current viewport
void far clearviewport(void);
ellipse: draws an elliptical arc
void far ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);
(x,y) is the center point. stangle and endangle are start and end angles in degrees. xradius and yradius are horizontal and vertical radii.
fillellipse: draws and fills elliptical arc
void far fillellipse(int x, int y, int xradius, int yradius);
Uses (x,y) as the center point and fills arc using the current fill pattern. xradius and yradius are horizontal and vertical radii.
floodfill: flood-fills a bounded region
void far floodfill(int x, int y, int border);
getimage: saves a bit image of the specified
region into memory
void far getimage(int left, int top, int right, int bottom, void far *bitmap);
getmaxcolor: returns maximum color value
int far getmaxcolor(void);
getmaxx: returns maximum x screen coordinate
int far getmaxx(void);
getmaxy: returns maximum y screen coordinate
int far getmaxy(void);
line: draws a line between two specified points
void far line(int x1, int y1, int x2, int y2);
Draws a line from (x1,y1) to (x2,y2) using the current color, line style and thickness.
lineto: draws a line from the Current Position to (x,y)
void far lineto(int x, int y);
moveto: moves the Current Position to (x,y)
void far moveto(int x, int y);
outtext: displays a string in the viewport
void far outtext(char far *textstring);
outtextxy: sends a string to the specified location (graphics mode)
void far outtextxy(int x, int y, char far *textstring);
pieslice: draws and fills in pie slice
void far pieslice(int x, int y, int stangle, int endangle, int radius);
putimage: outputs a bit image onto the screen
void far putimage(int left, int top, void far *bitmap, int op);
bitmap points to a bitmap, normally created by the getimage function. The op value specifies how the image will be combined with the current contents of the area at (left,top).
imagesize: returns the number of bytes required to store a bit image
unsigned far imagesize(int left, int top, int right, int bottom);
If the size required for the selected image is greater than or equal to 64K-1 bytes, it returns 0xFFFF.
rectangle: draws a rectangle (graphics mode)
void far rectangle(int left, int top, int right, int bottom);
Uses current line style, thickness and color.
sector: draws/fills elliptical pie slice
void far sector(int x, inty, int stangle, int endangle, int xradius, int yradius);
x and y define the center point. stangle and endangle define start and end angles. xradius and yradius are horizontal and vertical radii.
setcolor: sets the current drawing color
void far setcolor(int color);
setfillstyle: sets the fill pattern and color
void far setfillstyle(int pattern, int color);
setfillstyle patterns
EMPTY_FILL uses background color
SOLID_FILL uses solid fill color
LINE_FILL --- fill
LTSLASH_FILL /// fill
SLASH_FILL /// fill thick lines
BKSLASH_FILL \\\ fill thick lines
LTBKSLASH_FILL \\\ fill
settextstyle: sets the current text characteristics
void far settextstyle(int font, int direction, int charsize);
Enumerated type: font_names
DEFAULT_FONT 8x8 bit mapped font
TRIPLEX_FONT "Stroked" fonts
SMALL_FONT0
SANS_SERIF_FONT
GOTHIC_FONT
Defines: direction of graphics output
HORIZ_DIR left to right
VERT_DIR bottom to top
gettime: gets system time
syntax : void gettime(struct time *timeptr);
Structure: time
struct time
{
unsigned char ti_min;
unsigned char ti_hour;
unsigned char ti_hund;
unsigned char ti_sec;
};
getdate: gets MS-DOS date
syntax : void getdate(struct date *dateptr);
Share with your friends: |